Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/__pycache__/axes_size.cpython-310.pyc +0 -0
- evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/axes_size.py +248 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/__main__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/dipeptide.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/nucleotide.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/plot_transcript.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/synergy.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/__pycache__/tripeptide.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/RUST/amino.py +420 -0
- falcon/lib/python3.10/site-packages/RUST/methods.py +94 -0
- falcon/lib/python3.10/site-packages/RUST/nucleotide.py +416 -0
- falcon/lib/python3.10/site-packages/RUST/predict_profiles.py +356 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/alias.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/bdist_wheel.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/build_clib.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/egg_info.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install_lib.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install_scripts.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/rotate.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/setuptools/command/build_clib.py +103 -0
- falcon/lib/python3.10/site-packages/setuptools/command/install.py +183 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/__init__.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/animate.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/container.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/elementfactory.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/etree.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/filters.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/image.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/masking.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/mixins.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/params.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/path.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/pattern.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/utils.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/__pycache__/version.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/animate.py +183 -0
- falcon/lib/python3.10/site-packages/svgwrite/base.py +285 -0
- falcon/lib/python3.10/site-packages/svgwrite/container.py +287 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/__init__.py +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/__pycache__/svgparser.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/__pycache__/typechecker.cpython-310.pyc +0 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/colors.py +156 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/full11.py +1405 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/pattern.py +30 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/typechecker.py +342 -0
- falcon/lib/python3.10/site-packages/svgwrite/data/types.py +81 -0
- falcon/lib/python3.10/site-packages/svgwrite/drawing.py +140 -0
- falcon/lib/python3.10/site-packages/svgwrite/etree.py +49 -0
- falcon/lib/python3.10/site-packages/svgwrite/extensions/__init__.py +3 -0
evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/__pycache__/axes_size.cpython-310.pyc
ADDED
|
Binary file (8.95 kB). View file
|
|
|
evalkit_tf437/lib/python3.10/site-packages/mpl_toolkits/axes_grid1/axes_size.py
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Provides classes of simple units that will be used with `.AxesDivider`
|
| 3 |
+
class (or others) to determine the size of each Axes. The unit
|
| 4 |
+
classes define `get_size` method that returns a tuple of two floats,
|
| 5 |
+
meaning relative and absolute sizes, respectively.
|
| 6 |
+
|
| 7 |
+
Note that this class is nothing more than a simple tuple of two
|
| 8 |
+
floats. Take a look at the Divider class to see how these two
|
| 9 |
+
values are used.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from numbers import Real
|
| 13 |
+
|
| 14 |
+
from matplotlib import _api
|
| 15 |
+
from matplotlib.axes import Axes
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class _Base:
|
| 19 |
+
def __rmul__(self, other):
|
| 20 |
+
return Fraction(other, self)
|
| 21 |
+
|
| 22 |
+
def __add__(self, other):
|
| 23 |
+
if isinstance(other, _Base):
|
| 24 |
+
return Add(self, other)
|
| 25 |
+
else:
|
| 26 |
+
return Add(self, Fixed(other))
|
| 27 |
+
|
| 28 |
+
def get_size(self, renderer):
|
| 29 |
+
"""
|
| 30 |
+
Return two-float tuple with relative and absolute sizes.
|
| 31 |
+
"""
|
| 32 |
+
raise NotImplementedError("Subclasses must implement")
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class Add(_Base):
|
| 36 |
+
"""
|
| 37 |
+
Sum of two sizes.
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
def __init__(self, a, b):
|
| 41 |
+
self._a = a
|
| 42 |
+
self._b = b
|
| 43 |
+
|
| 44 |
+
def get_size(self, renderer):
|
| 45 |
+
a_rel_size, a_abs_size = self._a.get_size(renderer)
|
| 46 |
+
b_rel_size, b_abs_size = self._b.get_size(renderer)
|
| 47 |
+
return a_rel_size + b_rel_size, a_abs_size + b_abs_size
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
class Fixed(_Base):
|
| 51 |
+
"""
|
| 52 |
+
Simple fixed size with absolute part = *fixed_size* and relative part = 0.
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
def __init__(self, fixed_size):
|
| 56 |
+
_api.check_isinstance(Real, fixed_size=fixed_size)
|
| 57 |
+
self.fixed_size = fixed_size
|
| 58 |
+
|
| 59 |
+
def get_size(self, renderer):
|
| 60 |
+
rel_size = 0.
|
| 61 |
+
abs_size = self.fixed_size
|
| 62 |
+
return rel_size, abs_size
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
class Scaled(_Base):
|
| 66 |
+
"""
|
| 67 |
+
Simple scaled(?) size with absolute part = 0 and
|
| 68 |
+
relative part = *scalable_size*.
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
def __init__(self, scalable_size):
|
| 72 |
+
self._scalable_size = scalable_size
|
| 73 |
+
|
| 74 |
+
def get_size(self, renderer):
|
| 75 |
+
rel_size = self._scalable_size
|
| 76 |
+
abs_size = 0.
|
| 77 |
+
return rel_size, abs_size
|
| 78 |
+
|
| 79 |
+
Scalable = Scaled
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
def _get_axes_aspect(ax):
|
| 83 |
+
aspect = ax.get_aspect()
|
| 84 |
+
if aspect == "auto":
|
| 85 |
+
aspect = 1.
|
| 86 |
+
return aspect
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
class AxesX(_Base):
|
| 90 |
+
"""
|
| 91 |
+
Scaled size whose relative part corresponds to the data width
|
| 92 |
+
of the *axes* multiplied by the *aspect*.
|
| 93 |
+
"""
|
| 94 |
+
|
| 95 |
+
def __init__(self, axes, aspect=1., ref_ax=None):
|
| 96 |
+
self._axes = axes
|
| 97 |
+
self._aspect = aspect
|
| 98 |
+
if aspect == "axes" and ref_ax is None:
|
| 99 |
+
raise ValueError("ref_ax must be set when aspect='axes'")
|
| 100 |
+
self._ref_ax = ref_ax
|
| 101 |
+
|
| 102 |
+
def get_size(self, renderer):
|
| 103 |
+
l1, l2 = self._axes.get_xlim()
|
| 104 |
+
if self._aspect == "axes":
|
| 105 |
+
ref_aspect = _get_axes_aspect(self._ref_ax)
|
| 106 |
+
aspect = ref_aspect / _get_axes_aspect(self._axes)
|
| 107 |
+
else:
|
| 108 |
+
aspect = self._aspect
|
| 109 |
+
|
| 110 |
+
rel_size = abs(l2-l1)*aspect
|
| 111 |
+
abs_size = 0.
|
| 112 |
+
return rel_size, abs_size
|
| 113 |
+
|
| 114 |
+
|
| 115 |
+
class AxesY(_Base):
|
| 116 |
+
"""
|
| 117 |
+
Scaled size whose relative part corresponds to the data height
|
| 118 |
+
of the *axes* multiplied by the *aspect*.
|
| 119 |
+
"""
|
| 120 |
+
|
| 121 |
+
def __init__(self, axes, aspect=1., ref_ax=None):
|
| 122 |
+
self._axes = axes
|
| 123 |
+
self._aspect = aspect
|
| 124 |
+
if aspect == "axes" and ref_ax is None:
|
| 125 |
+
raise ValueError("ref_ax must be set when aspect='axes'")
|
| 126 |
+
self._ref_ax = ref_ax
|
| 127 |
+
|
| 128 |
+
def get_size(self, renderer):
|
| 129 |
+
l1, l2 = self._axes.get_ylim()
|
| 130 |
+
|
| 131 |
+
if self._aspect == "axes":
|
| 132 |
+
ref_aspect = _get_axes_aspect(self._ref_ax)
|
| 133 |
+
aspect = _get_axes_aspect(self._axes)
|
| 134 |
+
else:
|
| 135 |
+
aspect = self._aspect
|
| 136 |
+
|
| 137 |
+
rel_size = abs(l2-l1)*aspect
|
| 138 |
+
abs_size = 0.
|
| 139 |
+
return rel_size, abs_size
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class MaxExtent(_Base):
|
| 143 |
+
"""
|
| 144 |
+
Size whose absolute part is either the largest width or the largest height
|
| 145 |
+
of the given *artist_list*.
|
| 146 |
+
"""
|
| 147 |
+
|
| 148 |
+
def __init__(self, artist_list, w_or_h):
|
| 149 |
+
self._artist_list = artist_list
|
| 150 |
+
_api.check_in_list(["width", "height"], w_or_h=w_or_h)
|
| 151 |
+
self._w_or_h = w_or_h
|
| 152 |
+
|
| 153 |
+
def add_artist(self, a):
|
| 154 |
+
self._artist_list.append(a)
|
| 155 |
+
|
| 156 |
+
def get_size(self, renderer):
|
| 157 |
+
rel_size = 0.
|
| 158 |
+
extent_list = [
|
| 159 |
+
getattr(a.get_window_extent(renderer), self._w_or_h) / a.figure.dpi
|
| 160 |
+
for a in self._artist_list]
|
| 161 |
+
abs_size = max(extent_list, default=0)
|
| 162 |
+
return rel_size, abs_size
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class MaxWidth(MaxExtent):
|
| 166 |
+
"""
|
| 167 |
+
Size whose absolute part is the largest width of the given *artist_list*.
|
| 168 |
+
"""
|
| 169 |
+
|
| 170 |
+
def __init__(self, artist_list):
|
| 171 |
+
super().__init__(artist_list, "width")
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
class MaxHeight(MaxExtent):
|
| 175 |
+
"""
|
| 176 |
+
Size whose absolute part is the largest height of the given *artist_list*.
|
| 177 |
+
"""
|
| 178 |
+
|
| 179 |
+
def __init__(self, artist_list):
|
| 180 |
+
super().__init__(artist_list, "height")
|
| 181 |
+
|
| 182 |
+
|
| 183 |
+
class Fraction(_Base):
|
| 184 |
+
"""
|
| 185 |
+
An instance whose size is a *fraction* of the *ref_size*.
|
| 186 |
+
|
| 187 |
+
>>> s = Fraction(0.3, AxesX(ax))
|
| 188 |
+
"""
|
| 189 |
+
|
| 190 |
+
def __init__(self, fraction, ref_size):
|
| 191 |
+
_api.check_isinstance(Real, fraction=fraction)
|
| 192 |
+
self._fraction_ref = ref_size
|
| 193 |
+
self._fraction = fraction
|
| 194 |
+
|
| 195 |
+
def get_size(self, renderer):
|
| 196 |
+
if self._fraction_ref is None:
|
| 197 |
+
return self._fraction, 0.
|
| 198 |
+
else:
|
| 199 |
+
r, a = self._fraction_ref.get_size(renderer)
|
| 200 |
+
rel_size = r*self._fraction
|
| 201 |
+
abs_size = a*self._fraction
|
| 202 |
+
return rel_size, abs_size
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
def from_any(size, fraction_ref=None):
|
| 206 |
+
"""
|
| 207 |
+
Create a Fixed unit when the first argument is a float, or a
|
| 208 |
+
Fraction unit if that is a string that ends with %. The second
|
| 209 |
+
argument is only meaningful when Fraction unit is created.
|
| 210 |
+
|
| 211 |
+
>>> from mpl_toolkits.axes_grid1.axes_size import from_any
|
| 212 |
+
>>> a = from_any(1.2) # => Fixed(1.2)
|
| 213 |
+
>>> from_any("50%", a) # => Fraction(0.5, a)
|
| 214 |
+
"""
|
| 215 |
+
if isinstance(size, Real):
|
| 216 |
+
return Fixed(size)
|
| 217 |
+
elif isinstance(size, str):
|
| 218 |
+
if size[-1] == "%":
|
| 219 |
+
return Fraction(float(size[:-1]) / 100, fraction_ref)
|
| 220 |
+
raise ValueError("Unknown format")
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
class _AxesDecorationsSize(_Base):
|
| 224 |
+
"""
|
| 225 |
+
Fixed size, corresponding to the size of decorations on a given Axes side.
|
| 226 |
+
"""
|
| 227 |
+
|
| 228 |
+
_get_size_map = {
|
| 229 |
+
"left": lambda tight_bb, axes_bb: axes_bb.xmin - tight_bb.xmin,
|
| 230 |
+
"right": lambda tight_bb, axes_bb: tight_bb.xmax - axes_bb.xmax,
|
| 231 |
+
"bottom": lambda tight_bb, axes_bb: axes_bb.ymin - tight_bb.ymin,
|
| 232 |
+
"top": lambda tight_bb, axes_bb: tight_bb.ymax - axes_bb.ymax,
|
| 233 |
+
}
|
| 234 |
+
|
| 235 |
+
def __init__(self, ax, direction):
|
| 236 |
+
_api.check_in_list(self._get_size_map, direction=direction)
|
| 237 |
+
self._direction = direction
|
| 238 |
+
self._ax_list = [ax] if isinstance(ax, Axes) else ax
|
| 239 |
+
|
| 240 |
+
def get_size(self, renderer):
|
| 241 |
+
sz = max([
|
| 242 |
+
self._get_size_map[self._direction](
|
| 243 |
+
ax.get_tightbbox(renderer, call_axes_locator=False), ax.bbox)
|
| 244 |
+
for ax in self._ax_list])
|
| 245 |
+
dpi = renderer.points_to_pixels(72)
|
| 246 |
+
abs_size = sz / dpi
|
| 247 |
+
rel_size = 0
|
| 248 |
+
return rel_size, abs_size
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/__main__.cpython-310.pyc
ADDED
|
Binary file (4.56 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/dipeptide.cpython-310.pyc
ADDED
|
Binary file (9.62 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/nucleotide.cpython-310.pyc
ADDED
|
Binary file (9.34 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/plot_transcript.cpython-310.pyc
ADDED
|
Binary file (8.57 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/synergy.cpython-310.pyc
ADDED
|
Binary file (3.77 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/__pycache__/tripeptide.cpython-310.pyc
ADDED
|
Binary file (7.78 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/RUST/amino.py
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python
|
| 2 |
+
#####################################################################################
|
| 3 |
+
# rust_amino, Produces RUST metagene profile of amino acids
|
| 4 |
+
# Copyright (C) 2015 Patrick O'Connor
|
| 5 |
+
|
| 6 |
+
# This program is free software: you can redistribute it and/or modify
|
| 7 |
+
# it under the terms of the GNU General Public License as published by
|
| 8 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 9 |
+
# (at your option) any later version.
|
| 10 |
+
|
| 11 |
+
# This program is distributed in the hope that it will be useful,
|
| 12 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
+
# GNU General Public License for more details.
|
| 15 |
+
|
| 16 |
+
# You should have received a copy of the GNU General Public License
|
| 17 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 18 |
+
#####################################################################################
|
| 19 |
+
|
| 20 |
+
import os, re, pysam, sys, math, argparse
|
| 21 |
+
from .methods import *
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
import matplotlib as mpl
|
| 25 |
+
|
| 26 |
+
mpl.use("Agg")
|
| 27 |
+
import matplotlib.pyplot as plt
|
| 28 |
+
from pylab import log2, MaxNLocator
|
| 29 |
+
except:
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def RUST_metagene_plot(infileopen36, ax36):
|
| 34 |
+
infileopen36.seek(0)
|
| 35 |
+
infileopen36.readline()
|
| 36 |
+
while 1:
|
| 37 |
+
line = infileopen36.readline()
|
| 38 |
+
linesplit = line.split(",")
|
| 39 |
+
if len(linesplit) == 1:
|
| 40 |
+
break
|
| 41 |
+
codon = linesplit[0]
|
| 42 |
+
coverage = list(map(float, linesplit[1:]))
|
| 43 |
+
coverage_a = coverage[0]
|
| 44 |
+
if coverage_a == 0:
|
| 45 |
+
continue
|
| 46 |
+
coverage_n = [n / coverage_a for n in coverage[1:]]
|
| 47 |
+
log2_values = [math.log(n, 2) for n in coverage_n]
|
| 48 |
+
ax36.plot(log2_values, color="gray")
|
| 49 |
+
# print log2(coverage_n) == math.log(coverage_n,2)
|
| 50 |
+
|
| 51 |
+
line = infileopen36.readline()
|
| 52 |
+
linesplit = line.split(",")
|
| 53 |
+
if "NA" not in line:
|
| 54 |
+
coverage = list(map(float, linesplit[2:]))
|
| 55 |
+
ax2 = ax36.twinx()
|
| 56 |
+
ax2.plot(coverage, color="blue")
|
| 57 |
+
for tl in ax2.get_yticklabels():
|
| 58 |
+
tl.set_color("blue")
|
| 59 |
+
tl.set_rotation(0)
|
| 60 |
+
|
| 61 |
+
ax2.yaxis.set_major_locator(MaxNLocator(3))
|
| 62 |
+
ax2.set_ylim(0, 1.0)
|
| 63 |
+
ax2.set_ylim(-2, 1.0)
|
| 64 |
+
ax2.set_yticks([0, 1], minor=False)
|
| 65 |
+
ax2.set_yticklabels(["0", "1"])
|
| 66 |
+
ax2.set_ylabel("Kullback-Leibler divergence", color="blue")
|
| 67 |
+
|
| 68 |
+
ax36.set_xticks([5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55])
|
| 69 |
+
ax36.set_xticklabels([-35, -30, -25, -20, -15, -10, -5, 0, 5, 10, 15])
|
| 70 |
+
ax36.set_xlabel("distance from A-site [codon]")
|
| 71 |
+
ax36.set_ylabel("Amino acid RUST ratio (observed/expected), log2")
|
| 72 |
+
ax36.axvline(40, color="red")
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def main(args):
|
| 76 |
+
|
| 77 |
+
mRNA_sequences = args.transcriptome # path to fastq file of transcripts
|
| 78 |
+
in_seq_handle = open(mRNA_sequences)
|
| 79 |
+
cds_start_dict = {}
|
| 80 |
+
cds_end_dict = {}
|
| 81 |
+
seq_dict = {}
|
| 82 |
+
for line in in_seq_handle:
|
| 83 |
+
if line[0] != ">":
|
| 84 |
+
seq_dict.setdefault(transcript, "")
|
| 85 |
+
seq_dict[transcript] += line[:-1]
|
| 86 |
+
continue
|
| 87 |
+
try:
|
| 88 |
+
transcript_split = line[:-1].split("\t")
|
| 89 |
+
transcript = transcript_split[0][1:]
|
| 90 |
+
cds_start_dict[transcript] = int(transcript_split[1])
|
| 91 |
+
cds_end_dict[transcript] = int(transcript_split[2])
|
| 92 |
+
except:
|
| 93 |
+
pass
|
| 94 |
+
in_seq_handle.close()
|
| 95 |
+
|
| 96 |
+
offset = args.offset
|
| 97 |
+
readlen_range = args.lengths
|
| 98 |
+
readlen_rangesplit = readlen_range.split(":")
|
| 99 |
+
if len(readlen_rangesplit) == 1:
|
| 100 |
+
accepted_read_lengths = [int(readlen_rangesplit[0])]
|
| 101 |
+
length_values = "%s" % int(readlen_rangesplit[0])
|
| 102 |
+
elif len(readlen_rangesplit) == 2:
|
| 103 |
+
accepted_read_lengths = [
|
| 104 |
+
readlen
|
| 105 |
+
for readlen in range(
|
| 106 |
+
int(readlen_rangesplit[0]), int(readlen_rangesplit[1]) + 1
|
| 107 |
+
)
|
| 108 |
+
]
|
| 109 |
+
length_values = "%s_%s" % (
|
| 110 |
+
int(readlen_rangesplit[0]),
|
| 111 |
+
int(readlen_rangesplit[1]),
|
| 112 |
+
)
|
| 113 |
+
else:
|
| 114 |
+
stop_err(
|
| 115 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 116 |
+
)
|
| 117 |
+
if len(accepted_read_lengths) == 0:
|
| 118 |
+
stop_err(
|
| 119 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
amino_acids = [
|
| 123 |
+
"A",
|
| 124 |
+
"C",
|
| 125 |
+
"E",
|
| 126 |
+
"D",
|
| 127 |
+
"G",
|
| 128 |
+
"F",
|
| 129 |
+
"I",
|
| 130 |
+
"H",
|
| 131 |
+
"K",
|
| 132 |
+
"M",
|
| 133 |
+
"L",
|
| 134 |
+
"N",
|
| 135 |
+
"Q",
|
| 136 |
+
"P",
|
| 137 |
+
"S",
|
| 138 |
+
"R",
|
| 139 |
+
"T",
|
| 140 |
+
"W",
|
| 141 |
+
"V",
|
| 142 |
+
"Y",
|
| 143 |
+
]
|
| 144 |
+
aligments_A1 = pysam.Samfile(
|
| 145 |
+
args.alignment, "rb"
|
| 146 |
+
) # path to aligments in bam format
|
| 147 |
+
|
| 148 |
+
amino_enrichment_dict = {}
|
| 149 |
+
codon_enrichment_expected_dict = {}
|
| 150 |
+
for amino_acid in amino_acids:
|
| 151 |
+
amino_enrichment_dict[amino_acid] = {}
|
| 152 |
+
codon_enrichment_expected_dict[amino_acid] = []
|
| 153 |
+
for number in range(0, 60, 1):
|
| 154 |
+
amino_enrichment_dict[amino_acid][number] = [0.0, 0.0]
|
| 155 |
+
|
| 156 |
+
list_transcripts = seq_dict.keys()
|
| 157 |
+
number_transcripts = 0
|
| 158 |
+
list_10_percentile = []
|
| 159 |
+
for value in range(1, 10):
|
| 160 |
+
list_10_percentile.append((len(list_transcripts) * value) / 10)
|
| 161 |
+
for transcript in list_transcripts:
|
| 162 |
+
number_transcripts += 1
|
| 163 |
+
if number_transcripts in list_10_percentile:
|
| 164 |
+
sys.stdout.write(
|
| 165 |
+
"%s percent\n"
|
| 166 |
+
% ((list_10_percentile.index(number_transcripts) + 1) * 10)
|
| 167 |
+
)
|
| 168 |
+
try: # use supplied CDS annotation
|
| 169 |
+
cds_start = cds_start_dict[transcript]
|
| 170 |
+
cds_end = cds_end_dict[transcript]
|
| 171 |
+
if cds_end < cds_start:
|
| 172 |
+
raise Exception
|
| 173 |
+
except Exception: # find longest ORF
|
| 174 |
+
transcript_seq = seq_dict[transcript]
|
| 175 |
+
cds_start = -1
|
| 176 |
+
start_post = []
|
| 177 |
+
end_post = []
|
| 178 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("ATG"), transcript_seq):
|
| 179 |
+
start_post.append(match.start())
|
| 180 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAG"), transcript_seq):
|
| 181 |
+
end_post.append(match.start())
|
| 182 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAA"), transcript_seq):
|
| 183 |
+
end_post.append(match.start())
|
| 184 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TGA"), transcript_seq):
|
| 185 |
+
end_post.append(match.start())
|
| 186 |
+
|
| 187 |
+
end_post.sort()
|
| 188 |
+
len_max_orf = 0
|
| 189 |
+
for value in start_post:
|
| 190 |
+
for value2 in end_post:
|
| 191 |
+
if value < value2:
|
| 192 |
+
if value % 3 == value2 % 3:
|
| 193 |
+
len_orf = value2 - value
|
| 194 |
+
if len_orf > len_max_orf:
|
| 195 |
+
cds_start = value
|
| 196 |
+
cds_end = value2 + 3
|
| 197 |
+
len_max_orf = len_orf
|
| 198 |
+
break
|
| 199 |
+
if cds_start == -1:
|
| 200 |
+
# sys.stdout.write( '%s, AUG codon not found\n'%transcript )
|
| 201 |
+
continue
|
| 202 |
+
|
| 203 |
+
elongation_region_all = seq_dict[transcript][cds_start:cds_end]
|
| 204 |
+
elongation_region_part = elongation_region_all[
|
| 205 |
+
120:-60
|
| 206 |
+
] # first 120 and last 60 nt are not used
|
| 207 |
+
|
| 208 |
+
if len(elongation_region_part) % 3 != 0:
|
| 209 |
+
# sys.stdout.write( '%s, CDS not divisible by 3\n'%transcript )
|
| 210 |
+
continue
|
| 211 |
+
peptide_sequence = translate_dna(elongation_region_all)
|
| 212 |
+
profile_list = [
|
| 213 |
+
0.0 for n in range(cds_start + 120, cds_end - 60)
|
| 214 |
+
] # records ribo-seq profile
|
| 215 |
+
if len(profile_list) < 50:
|
| 216 |
+
# sys.stdout.write( '%s, ORF too short\n'%transcript )
|
| 217 |
+
continue
|
| 218 |
+
all_reads = aligments_A1.fetch(transcript)
|
| 219 |
+
|
| 220 |
+
len_elongation_region = len(profile_list)
|
| 221 |
+
for read in all_reads:
|
| 222 |
+
readlen = read.qlen
|
| 223 |
+
if readlen not in accepted_read_lengths:
|
| 224 |
+
continue # selection of read of acceptable length
|
| 225 |
+
A_site = read.pos + offset - cds_start - 120 # addition of offset
|
| 226 |
+
if len_elongation_region > A_site > -1:
|
| 227 |
+
profile_list[A_site] += 1
|
| 228 |
+
|
| 229 |
+
average_gene_density = float(sum(profile_list)) / len(
|
| 230 |
+
profile_list
|
| 231 |
+
) # average gene density calculated
|
| 232 |
+
|
| 233 |
+
if average_gene_density != 0:
|
| 234 |
+
num_codon = len(
|
| 235 |
+
[
|
| 236 |
+
1
|
| 237 |
+
for number88 in range(0, len(profile_list), 3)
|
| 238 |
+
if (
|
| 239 |
+
(
|
| 240 |
+
profile_list[number88]
|
| 241 |
+
+ profile_list[number88 + 1]
|
| 242 |
+
+ profile_list[number88 + 2]
|
| 243 |
+
)
|
| 244 |
+
/ 3
|
| 245 |
+
)
|
| 246 |
+
> average_gene_density
|
| 247 |
+
]
|
| 248 |
+
)
|
| 249 |
+
# number of codons that exceed average gene density
|
| 250 |
+
expected_codon_density = float(num_codon) / (
|
| 251 |
+
len(profile_list) / 3
|
| 252 |
+
) # expected enrichment value
|
| 253 |
+
|
| 254 |
+
peptide_start = 0
|
| 255 |
+
for sliding_w_n in range(
|
| 256 |
+
0, len(elongation_region_part), 3
|
| 257 |
+
): # sliding window using increments of 3 nts
|
| 258 |
+
amino_window = str(peptide_sequence[peptide_start : peptide_start + 60])
|
| 259 |
+
if len(set(amino_window) - set(amino_acids)) != 0:
|
| 260 |
+
peptide_start += 1
|
| 261 |
+
continue
|
| 262 |
+
|
| 263 |
+
if (
|
| 264 |
+
profile_list[sliding_w_n]
|
| 265 |
+
+ profile_list[sliding_w_n + 1]
|
| 266 |
+
+ profile_list[sliding_w_n + 2]
|
| 267 |
+
) / 3 > average_gene_density:
|
| 268 |
+
for number in range(0, 60):
|
| 269 |
+
amino_acid_1 = amino_window[number : number + 1]
|
| 270 |
+
amino_enrichment_dict[amino_acid_1][number][0] += 1
|
| 271 |
+
amino_enrichment_dict[amino_acid_1][number][1] += 1
|
| 272 |
+
else:
|
| 273 |
+
for number in range(0, 60):
|
| 274 |
+
amino_acid_1 = amino_window[number : number + 1]
|
| 275 |
+
amino_enrichment_dict[amino_acid_1][number][0] += 1
|
| 276 |
+
|
| 277 |
+
amino_acid_1 = amino_window[40:41]
|
| 278 |
+
codon_enrichment_expected_dict[amino_acid_1].append(
|
| 279 |
+
expected_codon_density
|
| 280 |
+
)
|
| 281 |
+
|
| 282 |
+
peptide_start += 1
|
| 283 |
+
|
| 284 |
+
alignment_filename = args.alignment.split("/")[-1]
|
| 285 |
+
if not os.path.exists(args.Path):
|
| 286 |
+
os.mkdir(args.o)
|
| 287 |
+
outfile = open(
|
| 288 |
+
"%s/RUST_amino_file_%s_%s_%s"
|
| 289 |
+
% (args.Path, alignment_filename, args.offset, length_values),
|
| 290 |
+
"w",
|
| 291 |
+
)
|
| 292 |
+
outfile.write("amino, expected value")
|
| 293 |
+
for number106 in range(-40, 20):
|
| 294 |
+
outfile.write(", %s" % number106)
|
| 295 |
+
outfile.write("\n")
|
| 296 |
+
|
| 297 |
+
list_codons = []
|
| 298 |
+
list_amino_acids = list(amino_enrichment_dict)
|
| 299 |
+
list_amino_acids.sort()
|
| 300 |
+
rust_expected = []
|
| 301 |
+
rust_observed_metafootprint = []
|
| 302 |
+
for amino2 in list_amino_acids:
|
| 303 |
+
if amino2 in list_codons:
|
| 304 |
+
continue
|
| 305 |
+
list_codons.append(amino2)
|
| 306 |
+
outfile.write("%s" % amino2)
|
| 307 |
+
if codon_enrichment_expected_dict[amino2] != []:
|
| 308 |
+
outfile.write(", %s" % mean_value(codon_enrichment_expected_dict[amino2]))
|
| 309 |
+
list_data = []
|
| 310 |
+
for number in range(0, 60):
|
| 311 |
+
if amino_enrichment_dict[amino2][number][0] != 0:
|
| 312 |
+
outfile.write(
|
| 313 |
+
", %s"
|
| 314 |
+
% (
|
| 315 |
+
amino_enrichment_dict[amino2][number][1]
|
| 316 |
+
/ amino_enrichment_dict[amino2][number][0]
|
| 317 |
+
)
|
| 318 |
+
)
|
| 319 |
+
list_data.append(
|
| 320 |
+
amino_enrichment_dict[amino2][number][1]
|
| 321 |
+
/ amino_enrichment_dict[amino2][number][0]
|
| 322 |
+
)
|
| 323 |
+
else:
|
| 324 |
+
outfile.write(", 0")
|
| 325 |
+
list_data.append(0)
|
| 326 |
+
outfile.write("\n")
|
| 327 |
+
rust_expected.append(mean_value(codon_enrichment_expected_dict[amino2]))
|
| 328 |
+
rust_observed_metafootprint.append(list_data)
|
| 329 |
+
|
| 330 |
+
rust_expected_sum = sum(rust_expected)
|
| 331 |
+
q_values = [n / rust_expected_sum for n in rust_expected]
|
| 332 |
+
shannon_values = []
|
| 333 |
+
for loc_i in range(60):
|
| 334 |
+
rust_observed = [n[loc_i] for n in rust_observed_metafootprint]
|
| 335 |
+
rust_observed_sum = sum(rust_observed)
|
| 336 |
+
rust_observed_min = min(rust_observed)
|
| 337 |
+
if rust_observed_min == 0:
|
| 338 |
+
shannon_values.append("NA")
|
| 339 |
+
else:
|
| 340 |
+
p_values = [n / rust_observed_sum for n in rust_observed]
|
| 341 |
+
shannon = []
|
| 342 |
+
list_normalised = [] ####
|
| 343 |
+
for p_value, q_value in zip(p_values, q_values):
|
| 344 |
+
shannon.append(abs(p_value * math.log((p_value / q_value), 2)))
|
| 345 |
+
list_normalised.append(p_value / q_value) ####
|
| 346 |
+
shannon_values.append(sum(shannon))
|
| 347 |
+
|
| 348 |
+
outfile.write("\nKullback Leibler divergence ,")
|
| 349 |
+
for value in shannon_values:
|
| 350 |
+
outfile.write(", %s" % value)
|
| 351 |
+
outfile.close()
|
| 352 |
+
|
| 353 |
+
try:
|
| 354 |
+
mpl.rcParams["xtick.direction"] = "out"
|
| 355 |
+
mpl.rcParams["ytick.direction"] = "out"
|
| 356 |
+
mpl.rcParams["legend.fontsize"] = 10
|
| 357 |
+
mpl.rcParams["ytick.labelsize"] = 10
|
| 358 |
+
mpl.rcParams["xtick.labelsize"] = 10
|
| 359 |
+
mpl.rcParams["font.size"] = 10
|
| 360 |
+
mpl.rcParams["axes.titlesize"] = 10
|
| 361 |
+
mpl.rcParams["legend.frameon"] = 0
|
| 362 |
+
mpl.rcParams["axes.axisbelow"] = False
|
| 363 |
+
mpl.rcParams["xtick.major.pad"] = 2.0
|
| 364 |
+
mpl.rcParams["ytick.major.pad"] = 2
|
| 365 |
+
mpl.rcParams["xtick.major.size"] = 2.0
|
| 366 |
+
mpl.rcParams["ytick.major.size"] = 2
|
| 367 |
+
mpl.rcParams["axes.linewidth"] = 0.5
|
| 368 |
+
mpl.rcParams["ytick.major.width"] = 0.25
|
| 369 |
+
mpl.rcParams["xtick.major.width"] = 0.25
|
| 370 |
+
mpl.rcParams["lines.linewidth"] = 1
|
| 371 |
+
mpl.rcParams["legend.borderpad"] = 0.01
|
| 372 |
+
mpl.rcParams["legend.labelspacing"] = 0.05
|
| 373 |
+
mpl.rcParams["legend.columnspacing"] = 0.5
|
| 374 |
+
mpl.rcParams["legend.borderaxespad"] = 0.15
|
| 375 |
+
mpl.rcParams["legend.handlelength"] = 1
|
| 376 |
+
|
| 377 |
+
fig = plt.figure(figsize=(6.69, 6.0))
|
| 378 |
+
infileopen = open(
|
| 379 |
+
"%s/RUST_amino_file_%s_%s_%s"
|
| 380 |
+
% (args.Path, alignment_filename, args.offset, length_values)
|
| 381 |
+
)
|
| 382 |
+
ax1_metafootprint = fig.add_subplot(111)
|
| 383 |
+
RUST_metagene_plot(infileopen, ax1_metafootprint)
|
| 384 |
+
plt.savefig(
|
| 385 |
+
"%s/RUST_amino_metafootprint_%s_%s_%s.png"
|
| 386 |
+
% (args.Path, alignment_filename, args.offset, length_values)
|
| 387 |
+
)
|
| 388 |
+
except:
|
| 389 |
+
sys.stdout.write("Error producing images\n")
|
| 390 |
+
|
| 391 |
+
|
| 392 |
+
if __name__ == "__main__":
|
| 393 |
+
parser = argparse.ArgumentParser(
|
| 394 |
+
description="Produces RUST metagene profile of amino acids"
|
| 395 |
+
)
|
| 396 |
+
parser.add_argument("--version", action="version", version="%(prog)s 1.2")
|
| 397 |
+
|
| 398 |
+
parser.add_argument(
|
| 399 |
+
"-t",
|
| 400 |
+
"--transcriptome",
|
| 401 |
+
help="fasta file of transcripts, CDS start and end may be provided on description line using tab separation e.g. >NM_0001 10 5000, otherwise it searches for longest ORF"
|
| 402 |
+
", required=True",
|
| 403 |
+
)
|
| 404 |
+
parser.add_argument(
|
| 405 |
+
"-a",
|
| 406 |
+
"--alignment",
|
| 407 |
+
help="sorted bam file of transcriptome alignments",
|
| 408 |
+
required=True,
|
| 409 |
+
)
|
| 410 |
+
parser.add_argument("-o", "--offset", help="nucleotide offset to A-site", type=int)
|
| 411 |
+
parser.add_argument(
|
| 412 |
+
"-l",
|
| 413 |
+
"--lengths",
|
| 414 |
+
help="lengths of footprints included, for example 28:32 is 28,29,30,31,32",
|
| 415 |
+
)
|
| 416 |
+
parser.add_argument(
|
| 417 |
+
"-P", "--Path", help='path to outputfile, default is "amino"', default="amino"
|
| 418 |
+
)
|
| 419 |
+
args = parser.parse_args(None)
|
| 420 |
+
main(args)
|
falcon/lib/python3.10/site-packages/RUST/methods.py
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
This module contains methods for the RUST tool
|
| 3 |
+
These are general purpose functions that are used in the RUST tool
|
| 4 |
+
|
| 5 |
+
"""
|
| 6 |
+
import sys
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def stop_err(msg):
|
| 10 |
+
sys.stderr.write("%s\n" % msg)
|
| 11 |
+
sys.exit()
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def mean_value(input_list):
|
| 15 |
+
if len(input_list) == 0:
|
| 16 |
+
return 0
|
| 17 |
+
else:
|
| 18 |
+
return sum(map(float, input_list)) / len(input_list)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def translate_dna(sequence):
|
| 22 |
+
codontable = {
|
| 23 |
+
"ATA": "I",
|
| 24 |
+
"ATC": "I",
|
| 25 |
+
"ATT": "I",
|
| 26 |
+
"ATG": "M",
|
| 27 |
+
"ACA": "T",
|
| 28 |
+
"ACC": "T",
|
| 29 |
+
"ACG": "T",
|
| 30 |
+
"ACT": "T",
|
| 31 |
+
"AAC": "N",
|
| 32 |
+
"AAT": "N",
|
| 33 |
+
"AAA": "K",
|
| 34 |
+
"AAG": "K",
|
| 35 |
+
"AGC": "S",
|
| 36 |
+
"AGT": "S",
|
| 37 |
+
"AGA": "R",
|
| 38 |
+
"AGG": "R",
|
| 39 |
+
"CTA": "L",
|
| 40 |
+
"CTC": "L",
|
| 41 |
+
"CTG": "L",
|
| 42 |
+
"CTT": "L",
|
| 43 |
+
"CCA": "P",
|
| 44 |
+
"CCC": "P",
|
| 45 |
+
"CCG": "P",
|
| 46 |
+
"CCT": "P",
|
| 47 |
+
"CAC": "H",
|
| 48 |
+
"CAT": "H",
|
| 49 |
+
"CAA": "Q",
|
| 50 |
+
"CAG": "Q",
|
| 51 |
+
"CGA": "R",
|
| 52 |
+
"CGC": "R",
|
| 53 |
+
"CGG": "R",
|
| 54 |
+
"CGT": "R",
|
| 55 |
+
"GTA": "V",
|
| 56 |
+
"GTC": "V",
|
| 57 |
+
"GTG": "V",
|
| 58 |
+
"GTT": "V",
|
| 59 |
+
"GCA": "A",
|
| 60 |
+
"GCC": "A",
|
| 61 |
+
"GCG": "A",
|
| 62 |
+
"GCT": "A",
|
| 63 |
+
"GAC": "D",
|
| 64 |
+
"GAT": "D",
|
| 65 |
+
"GAA": "E",
|
| 66 |
+
"GAG": "E",
|
| 67 |
+
"GGA": "G",
|
| 68 |
+
"GGC": "G",
|
| 69 |
+
"GGG": "G",
|
| 70 |
+
"GGT": "G",
|
| 71 |
+
"TCA": "S",
|
| 72 |
+
"TCC": "S",
|
| 73 |
+
"TCG": "S",
|
| 74 |
+
"TCT": "S",
|
| 75 |
+
"TTC": "F",
|
| 76 |
+
"TTT": "F",
|
| 77 |
+
"TTA": "L",
|
| 78 |
+
"TTG": "L",
|
| 79 |
+
"TAC": "Y",
|
| 80 |
+
"TAT": "Y",
|
| 81 |
+
"TAA": "*",
|
| 82 |
+
"TAG": "*",
|
| 83 |
+
"TGC": "C",
|
| 84 |
+
"TGT": "C",
|
| 85 |
+
"TGA": "*",
|
| 86 |
+
"TGG": "W",
|
| 87 |
+
}
|
| 88 |
+
proteinsequence = ""
|
| 89 |
+
for n in range(0, len(sequence), 3):
|
| 90 |
+
try:
|
| 91 |
+
proteinsequence += codontable[sequence[n : n + 3]]
|
| 92 |
+
except:
|
| 93 |
+
proteinsequence += "X"
|
| 94 |
+
return proteinsequence
|
falcon/lib/python3.10/site-packages/RUST/nucleotide.py
ADDED
|
@@ -0,0 +1,416 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python
|
| 2 |
+
#####################################################################################
|
| 3 |
+
# rust_nucleotide, Produces RUST metagene profile of nucleotides
|
| 4 |
+
# Copyright (C) 2015 Patrick O'Connor
|
| 5 |
+
|
| 6 |
+
# This program is free software: you can redistribute it and/or modify
|
| 7 |
+
# it under the terms of the GNU General Public License as published by
|
| 8 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 9 |
+
# (at your option) any later version.
|
| 10 |
+
|
| 11 |
+
# This program is distributed in the hope that it will be useful,
|
| 12 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
+
# GNU General Public License for more details.
|
| 15 |
+
|
| 16 |
+
# You should have received a copy of the GNU General Public License
|
| 17 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 18 |
+
#####################################################################################
|
| 19 |
+
|
| 20 |
+
import os, re, pysam, sys, math, argparse
|
| 21 |
+
from RUST.methods import *
|
| 22 |
+
|
| 23 |
+
try:
|
| 24 |
+
import matplotlib as mpl
|
| 25 |
+
|
| 26 |
+
mpl.use("Agg")
|
| 27 |
+
import matplotlib.pyplot as plt
|
| 28 |
+
from pylab import MaxNLocator
|
| 29 |
+
except:
|
| 30 |
+
pass
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def RUST_metagene_plot(infileopen36, ax36):
|
| 34 |
+
infileopen36.seek(0)
|
| 35 |
+
infileopen36.readline()
|
| 36 |
+
while 1:
|
| 37 |
+
line = infileopen36.readline()
|
| 38 |
+
linesplit = line.split(",")
|
| 39 |
+
if len(linesplit) == 1:
|
| 40 |
+
break
|
| 41 |
+
nucleotide_type = linesplit[0]
|
| 42 |
+
coverage = list(map(float, linesplit[1:]))
|
| 43 |
+
coverage_a = coverage[0]
|
| 44 |
+
if coverage_a == 0:
|
| 45 |
+
continue
|
| 46 |
+
coverage_n = [n / coverage_a for n in coverage[1:]]
|
| 47 |
+
# ax36.plot(log2(coverage_n[:-2]),color = "gray")
|
| 48 |
+
log2_values = [math.log(n, 2) for n in coverage_n]
|
| 49 |
+
if nucleotide_type == "A":
|
| 50 |
+
ax36.plot(log2_values, color="firebrick", label=nucleotide_type)
|
| 51 |
+
elif nucleotide_type == "T":
|
| 52 |
+
ax36.plot(log2_values, color="seagreen", label=nucleotide_type)
|
| 53 |
+
elif nucleotide_type == "G":
|
| 54 |
+
ax36.plot(log2_values, color="Orange", label=nucleotide_type)
|
| 55 |
+
else:
|
| 56 |
+
ax36.plot(log2_values, color="MediumPurple", label=nucleotide_type)
|
| 57 |
+
|
| 58 |
+
line = infileopen36.readline()
|
| 59 |
+
linesplit = line.split(",")
|
| 60 |
+
if "NA" not in linesplit:
|
| 61 |
+
coverage = list(map(float, linesplit[2:]))
|
| 62 |
+
ax2 = ax36.twinx()
|
| 63 |
+
ax2.plot(coverage, color="blue")
|
| 64 |
+
for tl in ax2.get_yticklabels():
|
| 65 |
+
tl.set_color("blue")
|
| 66 |
+
tl.set_rotation(0)
|
| 67 |
+
|
| 68 |
+
ax2.yaxis.set_major_locator(MaxNLocator(3))
|
| 69 |
+
ax2.set_ylim(0, 1.0)
|
| 70 |
+
ax2.set_ylim(-2, 1.0)
|
| 71 |
+
ax2.set_yticks([0, 1], minor=False)
|
| 72 |
+
ax2.set_yticklabels(["0", "1"])
|
| 73 |
+
ax2.set_ylabel("Kullback-Leibler divergence", color="blue")
|
| 74 |
+
|
| 75 |
+
ax36.set_xticks([15, 30, 45, 60, 75, 90, 105, 120, 135, 150, 165])
|
| 76 |
+
ax36.set_xticklabels([-105, -90, -75, -60, -45, -30, -15, 0, 15, 30, 45])
|
| 77 |
+
ax36.set_xlabel("distance from A-site [codon]")
|
| 78 |
+
ax36.set_ylabel("Nucleotide RUST ratio (observed/expected), log2")
|
| 79 |
+
ax36.axvline(120, color="red")
|
| 80 |
+
ax36.legend(bbox_to_anchor=(0, 0, 0.2, 0.9))
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
def main(args):
|
| 84 |
+
|
| 85 |
+
mRNA_sequences = args.transcriptome # path to fastq file of transcripts
|
| 86 |
+
in_seq_handle = open(mRNA_sequences)
|
| 87 |
+
cds_start_dict = {}
|
| 88 |
+
cds_end_dict = {}
|
| 89 |
+
seq_dict = {}
|
| 90 |
+
for line in in_seq_handle:
|
| 91 |
+
if line[0] != ">":
|
| 92 |
+
seq_dict.setdefault(transcript, "")
|
| 93 |
+
seq_dict[transcript] += line[:-1]
|
| 94 |
+
continue
|
| 95 |
+
try:
|
| 96 |
+
transcript_split = line[:-1].split("\t")
|
| 97 |
+
transcript = transcript_split[0][1:]
|
| 98 |
+
cds_start_dict[transcript] = int(transcript_split[1])
|
| 99 |
+
cds_end_dict[transcript] = int(transcript_split[2])
|
| 100 |
+
except:
|
| 101 |
+
pass
|
| 102 |
+
in_seq_handle.close()
|
| 103 |
+
|
| 104 |
+
offset = args.offset
|
| 105 |
+
readlen_range = args.lengths
|
| 106 |
+
readlen_rangesplit = readlen_range.split(":")
|
| 107 |
+
if len(readlen_rangesplit) == 1:
|
| 108 |
+
accepted_read_lengths = [int(readlen_rangesplit[0])]
|
| 109 |
+
length_values = "%s" % int(readlen_rangesplit[0])
|
| 110 |
+
elif len(readlen_rangesplit) == 2:
|
| 111 |
+
accepted_read_lengths = [
|
| 112 |
+
readlen
|
| 113 |
+
for readlen in range(
|
| 114 |
+
int(readlen_rangesplit[0]), int(readlen_rangesplit[1]) + 1
|
| 115 |
+
)
|
| 116 |
+
]
|
| 117 |
+
length_values = "%s_%s" % (
|
| 118 |
+
int(readlen_rangesplit[0]),
|
| 119 |
+
int(readlen_rangesplit[1]),
|
| 120 |
+
)
|
| 121 |
+
else:
|
| 122 |
+
stop_err(
|
| 123 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 124 |
+
)
|
| 125 |
+
if len(accepted_read_lengths) == 0:
|
| 126 |
+
stop_err(
|
| 127 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
nts = ["A", "G", "C", "T"]
|
| 131 |
+
aligments_A1 = pysam.Samfile(args.alignment, "rb")
|
| 132 |
+
|
| 133 |
+
nucleotide_enrichment_dict = {}
|
| 134 |
+
nucleotide_enrichment_expected_dict = {}
|
| 135 |
+
for nt in nts:
|
| 136 |
+
nucleotide_enrichment_dict[nt] = {}
|
| 137 |
+
nucleotide_enrichment_expected_dict[nt] = []
|
| 138 |
+
for number in range(0, 180, 1):
|
| 139 |
+
nucleotide_enrichment_dict[nt][number] = [0.0, 0.0]
|
| 140 |
+
|
| 141 |
+
list_transcripts = seq_dict.keys()
|
| 142 |
+
number_transcripts = 0
|
| 143 |
+
list_10_percentile = []
|
| 144 |
+
for value in range(1, 10):
|
| 145 |
+
list_10_percentile.append((len(list_transcripts) * value) / 10)
|
| 146 |
+
for transcript in list_transcripts:
|
| 147 |
+
number_transcripts += 1
|
| 148 |
+
if number_transcripts in list_10_percentile:
|
| 149 |
+
sys.stdout.write(
|
| 150 |
+
"%s percent\n"
|
| 151 |
+
% ((list_10_percentile.index(number_transcripts) + 1) * 10)
|
| 152 |
+
)
|
| 153 |
+
|
| 154 |
+
try: # use supplied CDS annotation
|
| 155 |
+
cds_start = cds_start_dict[transcript]
|
| 156 |
+
cds_end = cds_end_dict[transcript]
|
| 157 |
+
if cds_end < cds_start:
|
| 158 |
+
raise Exception
|
| 159 |
+
except Exception: # find longest ORF
|
| 160 |
+
transcript_seq = seq_dict[transcript]
|
| 161 |
+
cds_start = -1
|
| 162 |
+
start_post = []
|
| 163 |
+
end_post = []
|
| 164 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("ATG"), transcript_seq):
|
| 165 |
+
start_post.append(match.start())
|
| 166 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAG"), transcript_seq):
|
| 167 |
+
end_post.append(match.start())
|
| 168 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAA"), transcript_seq):
|
| 169 |
+
end_post.append(match.start())
|
| 170 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TGA"), transcript_seq):
|
| 171 |
+
end_post.append(match.start())
|
| 172 |
+
|
| 173 |
+
end_post.sort()
|
| 174 |
+
len_max_orf = 0
|
| 175 |
+
for value in start_post:
|
| 176 |
+
for value2 in end_post:
|
| 177 |
+
if value < value2:
|
| 178 |
+
if value % 3 == value2 % 3:
|
| 179 |
+
len_orf = value2 - value
|
| 180 |
+
if len_orf > len_max_orf:
|
| 181 |
+
cds_start = value
|
| 182 |
+
cds_end = value2 + 3
|
| 183 |
+
len_max_orf = len_orf
|
| 184 |
+
break
|
| 185 |
+
if cds_start == -1:
|
| 186 |
+
# sys.stdout.write( '%s, AUG codon not found\n'%transcript )
|
| 187 |
+
continue
|
| 188 |
+
elongation_region_all = seq_dict[transcript][cds_start:cds_end]
|
| 189 |
+
elongation_region_part = elongation_region_all[
|
| 190 |
+
120:-60
|
| 191 |
+
] # first 120 and last 60 nt are not used
|
| 192 |
+
# peptide_sequence = elongation_region_all.translate()
|
| 193 |
+
|
| 194 |
+
if len(elongation_region_part) % 3 != 0:
|
| 195 |
+
# sys.stdout.write( '%s, CDS not divisible by 3\n'%transcript )
|
| 196 |
+
continue
|
| 197 |
+
profile_list = [
|
| 198 |
+
0.0 for n in range(cds_start + 120, cds_end - 60)
|
| 199 |
+
] # records ribo-seq profile
|
| 200 |
+
if len(profile_list) < 50:
|
| 201 |
+
# sys.stdout.write( '%s, ORF too short\n'%transcript )
|
| 202 |
+
continue
|
| 203 |
+
all_reads = aligments_A1.fetch(transcript)
|
| 204 |
+
|
| 205 |
+
len_elongation_region = len(profile_list)
|
| 206 |
+
for read in all_reads:
|
| 207 |
+
readlen = read.qlen
|
| 208 |
+
if readlen not in accepted_read_lengths:
|
| 209 |
+
continue # selection of read of acceptable length
|
| 210 |
+
A_site = read.pos + offset - cds_start - 120 # addition of offset
|
| 211 |
+
if len_elongation_region > A_site > -1:
|
| 212 |
+
profile_list[A_site] += 1
|
| 213 |
+
|
| 214 |
+
average_gene_density = float(sum(profile_list)) / len(profile_list)
|
| 215 |
+
|
| 216 |
+
if average_gene_density != 0:
|
| 217 |
+
num_codon = len(
|
| 218 |
+
[
|
| 219 |
+
1
|
| 220 |
+
for number88 in range(0, len(profile_list), 3)
|
| 221 |
+
if (
|
| 222 |
+
(
|
| 223 |
+
profile_list[number88]
|
| 224 |
+
+ profile_list[number88 + 1]
|
| 225 |
+
+ profile_list[number88 + 2]
|
| 226 |
+
)
|
| 227 |
+
/ 3
|
| 228 |
+
)
|
| 229 |
+
> average_gene_density
|
| 230 |
+
]
|
| 231 |
+
)
|
| 232 |
+
# number of codons that exceed average gene density
|
| 233 |
+
expected_codon_density = float(num_codon) / (len(profile_list) / 3)
|
| 234 |
+
|
| 235 |
+
codon_start = 0
|
| 236 |
+
for sliding_w_n in range(
|
| 237 |
+
0, len(elongation_region_part), 3
|
| 238 |
+
): # sliding window using increments of 3 nts
|
| 239 |
+
codon_window = str(
|
| 240 |
+
elongation_region_all[codon_start : codon_start + 180]
|
| 241 |
+
)
|
| 242 |
+
if len(set(codon_window) - set(["A", "T", "G", "C"])) != 0:
|
| 243 |
+
codon_start += 3
|
| 244 |
+
continue
|
| 245 |
+
|
| 246 |
+
if (
|
| 247 |
+
profile_list[sliding_w_n]
|
| 248 |
+
+ profile_list[sliding_w_n + 1]
|
| 249 |
+
+ profile_list[sliding_w_n + 2]
|
| 250 |
+
) / 3 > average_gene_density:
|
| 251 |
+
for number in range(0, 180):
|
| 252 |
+
nucleotide3 = codon_window[number]
|
| 253 |
+
nucleotide_enrichment_dict[nucleotide3][number][0] += 1
|
| 254 |
+
nucleotide_enrichment_dict[nucleotide3][number][1] += 1
|
| 255 |
+
else:
|
| 256 |
+
for number in range(0, 180):
|
| 257 |
+
nucleotide3 = codon_window[number]
|
| 258 |
+
nucleotide_enrichment_dict[nucleotide3][number][0] += 1
|
| 259 |
+
|
| 260 |
+
nucleotide3 = codon_window[120:121]
|
| 261 |
+
nucleotide_enrichment_expected_dict[nucleotide3].append(
|
| 262 |
+
expected_codon_density
|
| 263 |
+
)
|
| 264 |
+
nucleotide3 = codon_window[121:122]
|
| 265 |
+
nucleotide_enrichment_expected_dict[nucleotide3].append(
|
| 266 |
+
expected_codon_density
|
| 267 |
+
)
|
| 268 |
+
nucleotide3 = codon_window[122:123]
|
| 269 |
+
nucleotide_enrichment_expected_dict[nucleotide3].append(
|
| 270 |
+
expected_codon_density
|
| 271 |
+
)
|
| 272 |
+
codon_start += 3
|
| 273 |
+
|
| 274 |
+
if not os.path.exists(args.Path):
|
| 275 |
+
os.mkdir(args.Path)
|
| 276 |
+
alignment_filename = args.alignment.split("/")[-1]
|
| 277 |
+
outfile = open(
|
| 278 |
+
"%s/RUST_nucleotide_file_%s_%s_%s"
|
| 279 |
+
% (args.Path, alignment_filename, args.offset, length_values),
|
| 280 |
+
"w",
|
| 281 |
+
)
|
| 282 |
+
outfile.write("nucleotide, expected value")
|
| 283 |
+
for number106 in range(-120, 60):
|
| 284 |
+
outfile.write(", %s" % number106)
|
| 285 |
+
outfile.write("\n")
|
| 286 |
+
|
| 287 |
+
list_nucleotide2 = []
|
| 288 |
+
nucleotides = list(nucleotide_enrichment_expected_dict.keys())
|
| 289 |
+
nucleotides.sort()
|
| 290 |
+
rust_expected = []
|
| 291 |
+
rust_observed_metafootprint = []
|
| 292 |
+
for nucleotide2 in nucleotides:
|
| 293 |
+
if nucleotide2 in list_nucleotide2:
|
| 294 |
+
continue
|
| 295 |
+
list_nucleotide2.append(nucleotide2)
|
| 296 |
+
outfile.write("%s" % nucleotide2)
|
| 297 |
+
outfile.write(
|
| 298 |
+
", %s" % mean_value(nucleotide_enrichment_expected_dict[nucleotide2])
|
| 299 |
+
)
|
| 300 |
+
list_data = []
|
| 301 |
+
for number in range(0, 180):
|
| 302 |
+
if nucleotide_enrichment_dict[nucleotide2][number][0] != 0:
|
| 303 |
+
outfile.write(
|
| 304 |
+
", %s"
|
| 305 |
+
% (
|
| 306 |
+
nucleotide_enrichment_dict[nucleotide2][number][1]
|
| 307 |
+
/ nucleotide_enrichment_dict[nucleotide2][number][0]
|
| 308 |
+
)
|
| 309 |
+
)
|
| 310 |
+
list_data.append(
|
| 311 |
+
nucleotide_enrichment_dict[nucleotide2][number][1]
|
| 312 |
+
/ nucleotide_enrichment_dict[nucleotide2][number][0]
|
| 313 |
+
)
|
| 314 |
+
else:
|
| 315 |
+
outfile.write(", 0")
|
| 316 |
+
list_data.append(0)
|
| 317 |
+
rust_expected.append(
|
| 318 |
+
mean_value(nucleotide_enrichment_expected_dict[nucleotide2])
|
| 319 |
+
)
|
| 320 |
+
rust_observed_metafootprint.append(list_data)
|
| 321 |
+
outfile.write("\n")
|
| 322 |
+
|
| 323 |
+
rust_expected_sum = sum(rust_expected)
|
| 324 |
+
q_values = [n / rust_expected_sum for n in rust_expected]
|
| 325 |
+
shannon_values = []
|
| 326 |
+
for loc_i in range(180):
|
| 327 |
+
rust_observed = [n[loc_i] for n in rust_observed_metafootprint]
|
| 328 |
+
rust_observed_sum = sum(rust_observed)
|
| 329 |
+
rust_observed_min = min(rust_observed)
|
| 330 |
+
if rust_observed_min == 0:
|
| 331 |
+
shannon_values.append("NA")
|
| 332 |
+
else:
|
| 333 |
+
p_values = [n / rust_observed_sum for n in rust_observed]
|
| 334 |
+
shannon = []
|
| 335 |
+
list_normalised = [] ####
|
| 336 |
+
for p_value, q_value in zip(p_values, q_values):
|
| 337 |
+
shannon.append(abs(p_value * math.log((p_value / q_value), 2)))
|
| 338 |
+
list_normalised.append(p_value / q_value) ####
|
| 339 |
+
shannon_values.append(sum(shannon))
|
| 340 |
+
|
| 341 |
+
outfile.write("\nKullback Leibler divergence,")
|
| 342 |
+
for value in shannon_values:
|
| 343 |
+
outfile.write(", %s" % value)
|
| 344 |
+
outfile.close()
|
| 345 |
+
|
| 346 |
+
try:
|
| 347 |
+
mpl.rcParams["xtick.direction"] = "out"
|
| 348 |
+
mpl.rcParams["ytick.direction"] = "out"
|
| 349 |
+
mpl.rcParams["legend.fontsize"] = 10
|
| 350 |
+
mpl.rcParams["ytick.labelsize"] = 10
|
| 351 |
+
mpl.rcParams["xtick.labelsize"] = 10
|
| 352 |
+
mpl.rcParams["font.size"] = 10
|
| 353 |
+
mpl.rcParams["axes.titlesize"] = 10
|
| 354 |
+
mpl.rcParams["legend.frameon"] = 0
|
| 355 |
+
mpl.rcParams["axes.axisbelow"] = False
|
| 356 |
+
mpl.rcParams["xtick.major.pad"] = 2.0
|
| 357 |
+
mpl.rcParams["ytick.major.pad"] = 2
|
| 358 |
+
mpl.rcParams["xtick.major.size"] = 2.0
|
| 359 |
+
mpl.rcParams["ytick.major.size"] = 2
|
| 360 |
+
mpl.rcParams["axes.linewidth"] = 0.5
|
| 361 |
+
mpl.rcParams["ytick.major.width"] = 0.25
|
| 362 |
+
mpl.rcParams["xtick.major.width"] = 0.25
|
| 363 |
+
mpl.rcParams["lines.linewidth"] = 1
|
| 364 |
+
mpl.rcParams["legend.borderpad"] = 0.01
|
| 365 |
+
mpl.rcParams["legend.labelspacing"] = 0.05
|
| 366 |
+
mpl.rcParams["legend.columnspacing"] = 0.5
|
| 367 |
+
mpl.rcParams["legend.borderaxespad"] = 0.15
|
| 368 |
+
mpl.rcParams["legend.handlelength"] = 1
|
| 369 |
+
|
| 370 |
+
fig = plt.figure(figsize=(6.69, 6.0))
|
| 371 |
+
infileopen = open(
|
| 372 |
+
"%s/RUST_nucleotide_file_%s_%s_%s"
|
| 373 |
+
% (args.Path, alignment_filename, args.offset, length_values)
|
| 374 |
+
)
|
| 375 |
+
ax1_metafootprint = fig.add_subplot(111)
|
| 376 |
+
RUST_metagene_plot(infileopen, ax1_metafootprint)
|
| 377 |
+
plt.savefig(
|
| 378 |
+
"%s/RUST_nucleotide_metafootprint_%s_%s_%s.png"
|
| 379 |
+
% (args.Path, alignment_filename, args.offset, length_values)
|
| 380 |
+
)
|
| 381 |
+
except:
|
| 382 |
+
sys.stdout.write("Error producing images\n")
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
if __name__ == "__main__":
|
| 386 |
+
parser = argparse.ArgumentParser(
|
| 387 |
+
description="Produces RUST metagene profile of nucleotides"
|
| 388 |
+
)
|
| 389 |
+
parser.add_argument(
|
| 390 |
+
"-t",
|
| 391 |
+
"--transcriptome",
|
| 392 |
+
help="fasta file of transcripts, CDS start and end may be provided on description line using tab separation e.g. >NM_0001 10 5000, otherwise it searches for longest ORF"
|
| 393 |
+
", required=True",
|
| 394 |
+
)
|
| 395 |
+
parser.add_argument(
|
| 396 |
+
"-a",
|
| 397 |
+
"--alignment",
|
| 398 |
+
help="sorted bam file of transcriptome alignments",
|
| 399 |
+
required=True,
|
| 400 |
+
)
|
| 401 |
+
parser.add_argument("-o", "--offset", help="nucleotide offset to A-site", type=int)
|
| 402 |
+
parser.add_argument(
|
| 403 |
+
"-l",
|
| 404 |
+
"--lengths",
|
| 405 |
+
help="lengths of footprints included, for example 28:32 is 28,29,30,31,32",
|
| 406 |
+
)
|
| 407 |
+
parser.add_argument(
|
| 408 |
+
"-P",
|
| 409 |
+
"--Path",
|
| 410 |
+
help='path to outputfile, default is "nucleotide"',
|
| 411 |
+
default="nucleotide",
|
| 412 |
+
)
|
| 413 |
+
parser.add_argument("--version", action="version", version="%(prog)s 1.2")
|
| 414 |
+
args = parser.parse_args(None)
|
| 415 |
+
|
| 416 |
+
main(args)
|
falcon/lib/python3.10/site-packages/RUST/predict_profiles.py
ADDED
|
@@ -0,0 +1,356 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/python
|
| 2 |
+
#####################################################################################
|
| 3 |
+
# rust_predict_profiles, Correlation between observed and predicted profiles from CDS start + 120 to CDS stop - 60
|
| 4 |
+
# Copyright (C) 2015 Patrick O'Connor
|
| 5 |
+
|
| 6 |
+
# This program is free software: you can redistribute it and/or modify
|
| 7 |
+
# it under the terms of the GNU General Public License as published by
|
| 8 |
+
# the Free Software Foundation, either version 3 of the License, or
|
| 9 |
+
# (at your option) any later version.
|
| 10 |
+
|
| 11 |
+
# This program is distributed in the hope that it will be useful,
|
| 12 |
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
+
# GNU General Public License for more details.
|
| 15 |
+
|
| 16 |
+
# You should have received a copy of the GNU General Public License
|
| 17 |
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
| 18 |
+
#####################################################################################
|
| 19 |
+
|
| 20 |
+
import os, pysam, sys, numpy, argparse, re
|
| 21 |
+
from RUST.methods import *
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def rank(lsit1):
|
| 25 |
+
lsit2 = []
|
| 26 |
+
lsit1s = lsit1[:]
|
| 27 |
+
lsit1s.sort()
|
| 28 |
+
dict_ranks = {}
|
| 29 |
+
for value_i, value in enumerate(lsit1s):
|
| 30 |
+
dict_ranks.setdefault(value, []).append(value_i)
|
| 31 |
+
|
| 32 |
+
for value in lsit1:
|
| 33 |
+
lsit2.append(mean_value(dict_ranks[value]))
|
| 34 |
+
return lsit2
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
def main(args):
|
| 38 |
+
|
| 39 |
+
RUST_file = open(args.rustfile) # file output of RUST_script.py
|
| 40 |
+
RUST_file.readline()
|
| 41 |
+
codon_rust_dict = {}
|
| 42 |
+
for line in RUST_file:
|
| 43 |
+
linesplit = line.split(",")
|
| 44 |
+
if len(linesplit) == 1:
|
| 45 |
+
break
|
| 46 |
+
codon = linesplit[0]
|
| 47 |
+
if len(codon) != 3 or len(set(codon) - set(["A", "T", "G", "C"])) != 0:
|
| 48 |
+
stop_err("Codon metafootprint file not correct, check input file")
|
| 49 |
+
codon_rust_dict[codon] = {}
|
| 50 |
+
rust_values = list(map(float, linesplit[1:]))
|
| 51 |
+
expected = rust_values[0]
|
| 52 |
+
rust_metafootprint = [ro_value / expected for ro_value in rust_values[1:]]
|
| 53 |
+
for n in range(34, 46):
|
| 54 |
+
codon_rust_dict[codon][n - 40] = rust_metafootprint[
|
| 55 |
+
n
|
| 56 |
+
] # for 12 codons positions near A-site
|
| 57 |
+
RUST_file.close()
|
| 58 |
+
|
| 59 |
+
mRNA_sequences = args.transcriptome # path to fastq file of transcripts
|
| 60 |
+
in_seq_handle = open(mRNA_sequences)
|
| 61 |
+
cds_start_dict = {}
|
| 62 |
+
cds_end_dict = {}
|
| 63 |
+
seq_dict = {}
|
| 64 |
+
for line in in_seq_handle:
|
| 65 |
+
if line[0] != ">":
|
| 66 |
+
seq_dict.setdefault(transcript, "")
|
| 67 |
+
seq_dict[transcript] += line[:-1]
|
| 68 |
+
continue
|
| 69 |
+
try:
|
| 70 |
+
transcript_split = line[:-1].split("\t")
|
| 71 |
+
transcript = transcript_split[0][1:]
|
| 72 |
+
cds_start_dict[transcript] = int(transcript_split[1])
|
| 73 |
+
cds_end_dict[transcript] = int(transcript_split[2])
|
| 74 |
+
except:
|
| 75 |
+
pass
|
| 76 |
+
in_seq_handle.close()
|
| 77 |
+
|
| 78 |
+
offset = args.offset
|
| 79 |
+
readlen_range = args.lengths
|
| 80 |
+
readlen_rangesplit = readlen_range.split(":")
|
| 81 |
+
if len(readlen_rangesplit) == 1:
|
| 82 |
+
accepted_read_lengths = [int(readlen_rangesplit[0])]
|
| 83 |
+
length_values = "%s" % int(readlen_rangesplit[0])
|
| 84 |
+
elif len(readlen_rangesplit) == 2:
|
| 85 |
+
accepted_read_lengths = [
|
| 86 |
+
readlen
|
| 87 |
+
for readlen in range(
|
| 88 |
+
int(readlen_rangesplit[0]), int(readlen_rangesplit[1]) + 1
|
| 89 |
+
)
|
| 90 |
+
]
|
| 91 |
+
length_values = "%s_%s" % (
|
| 92 |
+
int(readlen_rangesplit[0]),
|
| 93 |
+
int(readlen_rangesplit[1]),
|
| 94 |
+
)
|
| 95 |
+
else:
|
| 96 |
+
stop_err(
|
| 97 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 98 |
+
)
|
| 99 |
+
if len(accepted_read_lengths) == 0:
|
| 100 |
+
stop_err(
|
| 101 |
+
"Lengths of footprints parameter not in correct format, it should be either colon seperated with the second value greater or equal to the first, (28:32) or a single interger (31)"
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
amino_acids = [
|
| 105 |
+
"A",
|
| 106 |
+
"C",
|
| 107 |
+
"E",
|
| 108 |
+
"D",
|
| 109 |
+
"G",
|
| 110 |
+
"F",
|
| 111 |
+
"I",
|
| 112 |
+
"H",
|
| 113 |
+
"K",
|
| 114 |
+
"M",
|
| 115 |
+
"L",
|
| 116 |
+
"N",
|
| 117 |
+
"Q",
|
| 118 |
+
"P",
|
| 119 |
+
"S",
|
| 120 |
+
"R",
|
| 121 |
+
"T",
|
| 122 |
+
"W",
|
| 123 |
+
"V",
|
| 124 |
+
"Y",
|
| 125 |
+
]
|
| 126 |
+
aligments_A1 = pysam.Samfile(args.alignment, "rb")
|
| 127 |
+
|
| 128 |
+
if not os.path.exists(args.Path):
|
| 129 |
+
os.mkdir(args.Path)
|
| 130 |
+
if args.profiles:
|
| 131 |
+
if not os.path.exists("%s/rust_profile_predictions" % args.Path):
|
| 132 |
+
os.mkdir("%s/rust_profile_predictions" % args.Path)
|
| 133 |
+
|
| 134 |
+
if "/" in args.rustfile:
|
| 135 |
+
rustfile_split = args.rustfile.split("/")[-1]
|
| 136 |
+
# elif "\\" in args.rustfile:
|
| 137 |
+
# rustfile_split= args.rustfile.split("\\")[-1]
|
| 138 |
+
else:
|
| 139 |
+
rustfile_split = args.rustfile
|
| 140 |
+
|
| 141 |
+
if "RUST_codon_file_" in rustfile_split:
|
| 142 |
+
alignment_filename = rustfile_split[16:]
|
| 143 |
+
else:
|
| 144 |
+
alignment_filename = rustfile_split
|
| 145 |
+
|
| 146 |
+
correlations_file = open(
|
| 147 |
+
"%s/predict_profiles_%s_%s_%s"
|
| 148 |
+
% (args.Path, alignment_filename, args.offset, length_values),
|
| 149 |
+
"w",
|
| 150 |
+
)
|
| 151 |
+
correlations_file.write(
|
| 152 |
+
"transcript,average read density,Spearman's coefficient,Pearson's coefficient\n"
|
| 153 |
+
)
|
| 154 |
+
|
| 155 |
+
list_transcripts = seq_dict.keys()
|
| 156 |
+
number_transcripts = 0
|
| 157 |
+
list_10_percentile = []
|
| 158 |
+
for value in range(1, 10):
|
| 159 |
+
list_10_percentile.append((len(list_transcripts) * value) / 10)
|
| 160 |
+
for transcript in list_transcripts:
|
| 161 |
+
number_transcripts += 1
|
| 162 |
+
if number_transcripts in list_10_percentile:
|
| 163 |
+
sys.stdout.write(
|
| 164 |
+
"%s percent\n"
|
| 165 |
+
% ((list_10_percentile.index(number_transcripts) + 1) * 10)
|
| 166 |
+
)
|
| 167 |
+
|
| 168 |
+
try:
|
| 169 |
+
cds_start = cds_start_dict[transcript]
|
| 170 |
+
cds_end = cds_end_dict[transcript]
|
| 171 |
+
if cds_end < cds_start:
|
| 172 |
+
raise Exception
|
| 173 |
+
except Exception:
|
| 174 |
+
transcript_seq = seq_dict[transcript]
|
| 175 |
+
cds_start = -1
|
| 176 |
+
start_post = []
|
| 177 |
+
end_post = []
|
| 178 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("ATG"), transcript_seq):
|
| 179 |
+
start_post.append(match.start())
|
| 180 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAG"), transcript_seq):
|
| 181 |
+
end_post.append(match.start())
|
| 182 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TAA"), transcript_seq):
|
| 183 |
+
end_post.append(match.start())
|
| 184 |
+
for match in re.finditer(r"(?=(%s))" % re.escape("TGA"), transcript_seq):
|
| 185 |
+
end_post.append(match.start())
|
| 186 |
+
|
| 187 |
+
end_post.sort()
|
| 188 |
+
len_max_orf = 0
|
| 189 |
+
for value in start_post:
|
| 190 |
+
for value2 in end_post:
|
| 191 |
+
if value < value2:
|
| 192 |
+
if value % 3 == value2 % 3:
|
| 193 |
+
len_orf = value2 - value
|
| 194 |
+
if len_orf > len_max_orf:
|
| 195 |
+
cds_start = value
|
| 196 |
+
cds_end = value2 + 3
|
| 197 |
+
len_max_orf = len_orf
|
| 198 |
+
break
|
| 199 |
+
if cds_start == -1:
|
| 200 |
+
# sys.stdout.write( '%s, AUG codon not found\n'%transcript )
|
| 201 |
+
continue
|
| 202 |
+
|
| 203 |
+
elongation_region_all = seq_dict[transcript][cds_start:cds_end]
|
| 204 |
+
|
| 205 |
+
if (
|
| 206 |
+
len(elongation_region_all) % 3 != 0
|
| 207 |
+
): # genes with codon region not divisible by 3 skipped
|
| 208 |
+
# sys.stdout.write( '%s, CDS not divisible by 3\n'%transcript )
|
| 209 |
+
continue
|
| 210 |
+
|
| 211 |
+
profile_expect = []
|
| 212 |
+
for n in range(
|
| 213 |
+
0, len(elongation_region_all[120:-60]), 3
|
| 214 |
+
): # predicts profile from 120 nts after start to 60 before stop
|
| 215 |
+
minus6_plus5_footprint = elongation_region_all[
|
| 216 |
+
120 + n - 18 : 120 + n + 19
|
| 217 |
+
] # contains sequence of region used to predict profile
|
| 218 |
+
value = 1.0
|
| 219 |
+
amino_loc = -6
|
| 220 |
+
for number in range(0, len(minus6_plus5_footprint) - 2, 3):
|
| 221 |
+
codon = minus6_plus5_footprint[number : number + 3]
|
| 222 |
+
if len(set(codon) - set(["A", "T", "G", "C"])) != 0 or codon in [
|
| 223 |
+
"TAG",
|
| 224 |
+
"TGA",
|
| 225 |
+
"TAA",
|
| 226 |
+
]:
|
| 227 |
+
amino_loc += 1
|
| 228 |
+
continue
|
| 229 |
+
value = value * codon_rust_dict[codon][amino_loc]
|
| 230 |
+
amino_loc += 1
|
| 231 |
+
profile_expect.append(value)
|
| 232 |
+
profile_expect_sum = sum(profile_expect)
|
| 233 |
+
profile_expect_probablility = [
|
| 234 |
+
float(value) / profile_expect_sum for value in profile_expect
|
| 235 |
+
]
|
| 236 |
+
|
| 237 |
+
profile_list = [
|
| 238 |
+
0.0 for n in range(cds_start + 120, cds_end - 60)
|
| 239 |
+
] # records ribo-seq profile
|
| 240 |
+
if len(profile_list) < 50:
|
| 241 |
+
# sys.stdout.write( '%s, ORF too short\n'%transcript )
|
| 242 |
+
continue
|
| 243 |
+
all_reads = aligments_A1.fetch(transcript)
|
| 244 |
+
|
| 245 |
+
len_elongation_region = len(profile_list)
|
| 246 |
+
for read in all_reads:
|
| 247 |
+
readlen = read.qlen
|
| 248 |
+
if readlen not in accepted_read_lengths:
|
| 249 |
+
continue # selection of read of acceptable length
|
| 250 |
+
A_site = read.pos + offset - cds_start - 120 # addition of offset
|
| 251 |
+
if len_elongation_region > A_site > -1:
|
| 252 |
+
profile_list[A_site] += 1
|
| 253 |
+
|
| 254 |
+
average_gene_density = float(sum(profile_list)) / len(
|
| 255 |
+
profile_list
|
| 256 |
+
) # average gene density calculated
|
| 257 |
+
if average_gene_density > 0:
|
| 258 |
+
profiles_control_codon = [
|
| 259 |
+
profile_list[codon_ind]
|
| 260 |
+
+ profile_list[codon_ind + 1]
|
| 261 |
+
+ profile_list[codon_ind + 2]
|
| 262 |
+
for codon_ind in range(0, len(profile_list), 3)
|
| 263 |
+
]
|
| 264 |
+
spearmanr_value = numpy.corrcoef(
|
| 265 |
+
rank(profiles_control_codon), rank(profile_expect)
|
| 266 |
+
)[0, 1]
|
| 267 |
+
pearsonr_value = numpy.corrcoef(profiles_control_codon, profile_expect)[
|
| 268 |
+
0, 1
|
| 269 |
+
]
|
| 270 |
+
correlations_file.write(
|
| 271 |
+
"%s,%s,%s,%s\n"
|
| 272 |
+
% (transcript, average_gene_density, spearmanr_value, pearsonr_value)
|
| 273 |
+
)
|
| 274 |
+
if args.profiles:
|
| 275 |
+
open_file = open(
|
| 276 |
+
"%s/rust_profile_predictions/observed_predicted_%s_%s_%s_%s.csv"
|
| 277 |
+
% (
|
| 278 |
+
args.Path,
|
| 279 |
+
transcript,
|
| 280 |
+
alignment_filename,
|
| 281 |
+
args.offset,
|
| 282 |
+
length_values,
|
| 283 |
+
),
|
| 284 |
+
"w",
|
| 285 |
+
)
|
| 286 |
+
profile_expect_probablility_index = 0
|
| 287 |
+
open_file.write("%s\n" % transcript)
|
| 288 |
+
open_file.write("codon, predicted probability, alignments\n")
|
| 289 |
+
for coordinate_index in range(
|
| 290 |
+
0, len(elongation_region_all[120:-60]), 3
|
| 291 |
+
):
|
| 292 |
+
codon = elongation_region_all[
|
| 293 |
+
120 + coordinate_index : 120 + coordinate_index + 3
|
| 294 |
+
]
|
| 295 |
+
open_file.write("%s, " % (codon))
|
| 296 |
+
open_file.write(
|
| 297 |
+
"%s, "
|
| 298 |
+
% (
|
| 299 |
+
profile_expect_probablility[
|
| 300 |
+
profile_expect_probablility_index
|
| 301 |
+
]
|
| 302 |
+
)
|
| 303 |
+
)
|
| 304 |
+
open_file.write(
|
| 305 |
+
"%s\n"
|
| 306 |
+
% (profiles_control_codon[profile_expect_probablility_index])
|
| 307 |
+
)
|
| 308 |
+
profile_expect_probablility_index += 1
|
| 309 |
+
open_file.close()
|
| 310 |
+
correlations_file.close()
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
if __name__ == "__main__":
|
| 314 |
+
parser = argparse.ArgumentParser(
|
| 315 |
+
description="Correlation between observed and predicted profiles from CDS start + 120 to CDS stop - 60"
|
| 316 |
+
)
|
| 317 |
+
parser.add_argument(
|
| 318 |
+
"-t",
|
| 319 |
+
"--transcriptome",
|
| 320 |
+
help="fasta file of transcripts, CDS start and end may be provided on description line using tab separation e.g. >NM_0001 10 5000, otherwise it searches for longest ORF"
|
| 321 |
+
", required=True",
|
| 322 |
+
)
|
| 323 |
+
parser.add_argument(
|
| 324 |
+
"-a",
|
| 325 |
+
"--alignment",
|
| 326 |
+
help="sorted bam file of transcriptome alignments",
|
| 327 |
+
required=True,
|
| 328 |
+
)
|
| 329 |
+
parser.add_argument("-o", "--offset", help="nucleotide offset to A-site", type=int)
|
| 330 |
+
parser.add_argument(
|
| 331 |
+
"-l",
|
| 332 |
+
"--lengths",
|
| 333 |
+
help="lengths of footprints included, for example 28:32 is 28,29,30,31,32",
|
| 334 |
+
)
|
| 335 |
+
parser.add_argument(
|
| 336 |
+
"-P",
|
| 337 |
+
"--Path",
|
| 338 |
+
help='path to outputfile, default is "amino"',
|
| 339 |
+
default="predict_profiles",
|
| 340 |
+
)
|
| 341 |
+
parser.add_argument("-r", "--rustfile", help="path to rust file produced by codon")
|
| 342 |
+
parser.add_argument(
|
| 343 |
+
"-o",
|
| 344 |
+
metavar="outfile directory",
|
| 345 |
+
help='path to outputfile, default is "predict_profiles"',
|
| 346 |
+
default="predict_profiles",
|
| 347 |
+
)
|
| 348 |
+
parser.add_argument(
|
| 349 |
+
"-p",
|
| 350 |
+
action="store_true",
|
| 351 |
+
help="writes all profiles in csv files, may produce >10,000 files",
|
| 352 |
+
default=False,
|
| 353 |
+
)
|
| 354 |
+
parser.add_argument("--version", action="version", version="%(prog)s 1.2")
|
| 355 |
+
args = parser.parse_args(None)
|
| 356 |
+
main(args)
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/alias.cpython-310.pyc
ADDED
|
Binary file (2.36 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/bdist_wheel.cpython-310.pyc
ADDED
|
Binary file (15.5 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/build_clib.cpython-310.pyc
ADDED
|
Binary file (2.5 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/egg_info.cpython-310.pyc
ADDED
|
Binary file (22.3 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install.cpython-310.pyc
ADDED
|
Binary file (5.42 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install_lib.cpython-310.pyc
ADDED
|
Binary file (4.52 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/install_scripts.cpython-310.pyc
ADDED
|
Binary file (2.58 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/__pycache__/rotate.cpython-310.pyc
ADDED
|
Binary file (2.63 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/setuptools/command/build_clib.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ..dist import Distribution
|
| 2 |
+
from ..modified import newer_pairwise_group
|
| 3 |
+
|
| 4 |
+
import distutils.command.build_clib as orig
|
| 5 |
+
from distutils import log
|
| 6 |
+
from distutils.errors import DistutilsSetupError
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class build_clib(orig.build_clib):
|
| 10 |
+
"""
|
| 11 |
+
Override the default build_clib behaviour to do the following:
|
| 12 |
+
|
| 13 |
+
1. Implement a rudimentary timestamp-based dependency system
|
| 14 |
+
so 'compile()' doesn't run every time.
|
| 15 |
+
2. Add more keys to the 'build_info' dictionary:
|
| 16 |
+
* obj_deps - specify dependencies for each object compiled.
|
| 17 |
+
this should be a dictionary mapping a key
|
| 18 |
+
with the source filename to a list of
|
| 19 |
+
dependencies. Use an empty string for global
|
| 20 |
+
dependencies.
|
| 21 |
+
* cflags - specify a list of additional flags to pass to
|
| 22 |
+
the compiler.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution
|
| 26 |
+
|
| 27 |
+
def build_libraries(self, libraries) -> None:
|
| 28 |
+
for lib_name, build_info in libraries:
|
| 29 |
+
sources = build_info.get('sources')
|
| 30 |
+
if sources is None or not isinstance(sources, (list, tuple)):
|
| 31 |
+
raise DistutilsSetupError(
|
| 32 |
+
f"in 'libraries' option (library '{lib_name}'), "
|
| 33 |
+
"'sources' must be present and must be "
|
| 34 |
+
"a list of source filenames"
|
| 35 |
+
)
|
| 36 |
+
sources = sorted(list(sources))
|
| 37 |
+
|
| 38 |
+
log.info("building '%s' library", lib_name)
|
| 39 |
+
|
| 40 |
+
# Make sure everything is the correct type.
|
| 41 |
+
# obj_deps should be a dictionary of keys as sources
|
| 42 |
+
# and a list/tuple of files that are its dependencies.
|
| 43 |
+
obj_deps = build_info.get('obj_deps', dict())
|
| 44 |
+
if not isinstance(obj_deps, dict):
|
| 45 |
+
raise DistutilsSetupError(
|
| 46 |
+
f"in 'libraries' option (library '{lib_name}'), "
|
| 47 |
+
"'obj_deps' must be a dictionary of "
|
| 48 |
+
"type 'source: list'"
|
| 49 |
+
)
|
| 50 |
+
dependencies = []
|
| 51 |
+
|
| 52 |
+
# Get the global dependencies that are specified by the '' key.
|
| 53 |
+
# These will go into every source's dependency list.
|
| 54 |
+
global_deps = obj_deps.get('', list())
|
| 55 |
+
if not isinstance(global_deps, (list, tuple)):
|
| 56 |
+
raise DistutilsSetupError(
|
| 57 |
+
f"in 'libraries' option (library '{lib_name}'), "
|
| 58 |
+
"'obj_deps' must be a dictionary of "
|
| 59 |
+
"type 'source: list'"
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
# Build the list to be used by newer_pairwise_group
|
| 63 |
+
# each source will be auto-added to its dependencies.
|
| 64 |
+
for source in sources:
|
| 65 |
+
src_deps = [source]
|
| 66 |
+
src_deps.extend(global_deps)
|
| 67 |
+
extra_deps = obj_deps.get(source, list())
|
| 68 |
+
if not isinstance(extra_deps, (list, tuple)):
|
| 69 |
+
raise DistutilsSetupError(
|
| 70 |
+
f"in 'libraries' option (library '{lib_name}'), "
|
| 71 |
+
"'obj_deps' must be a dictionary of "
|
| 72 |
+
"type 'source: list'"
|
| 73 |
+
)
|
| 74 |
+
src_deps.extend(extra_deps)
|
| 75 |
+
dependencies.append(src_deps)
|
| 76 |
+
|
| 77 |
+
expected_objects = self.compiler.object_filenames(
|
| 78 |
+
sources,
|
| 79 |
+
output_dir=self.build_temp,
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
if newer_pairwise_group(dependencies, expected_objects) != ([], []):
|
| 83 |
+
# First, compile the source code to object files in the library
|
| 84 |
+
# directory. (This should probably change to putting object
|
| 85 |
+
# files in a temporary build directory.)
|
| 86 |
+
macros = build_info.get('macros')
|
| 87 |
+
include_dirs = build_info.get('include_dirs')
|
| 88 |
+
cflags = build_info.get('cflags')
|
| 89 |
+
self.compiler.compile(
|
| 90 |
+
sources,
|
| 91 |
+
output_dir=self.build_temp,
|
| 92 |
+
macros=macros,
|
| 93 |
+
include_dirs=include_dirs,
|
| 94 |
+
extra_postargs=cflags,
|
| 95 |
+
debug=self.debug,
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
# Now "link" the object files together into a static library.
|
| 99 |
+
# (On Unix at least, this isn't really linking -- it just
|
| 100 |
+
# builds an archive. Whatever.)
|
| 101 |
+
self.compiler.create_static_lib(
|
| 102 |
+
expected_objects, lib_name, output_dir=self.build_clib, debug=self.debug
|
| 103 |
+
)
|
falcon/lib/python3.10/site-packages/setuptools/command/install.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import glob
|
| 4 |
+
import inspect
|
| 5 |
+
import platform
|
| 6 |
+
from collections.abc import Callable
|
| 7 |
+
from typing import TYPE_CHECKING, Any, ClassVar, cast
|
| 8 |
+
|
| 9 |
+
import setuptools
|
| 10 |
+
|
| 11 |
+
from ..dist import Distribution
|
| 12 |
+
from ..warnings import SetuptoolsDeprecationWarning, SetuptoolsWarning
|
| 13 |
+
from .bdist_egg import bdist_egg as bdist_egg_cls
|
| 14 |
+
|
| 15 |
+
import distutils.command.install as orig
|
| 16 |
+
from distutils.errors import DistutilsArgError
|
| 17 |
+
|
| 18 |
+
if TYPE_CHECKING:
|
| 19 |
+
# This is only used for a type-cast, don't import at runtime or it'll cause deprecation warnings
|
| 20 |
+
from .easy_install import easy_install as easy_install_cls
|
| 21 |
+
else:
|
| 22 |
+
easy_install_cls = None
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def __getattr__(name: str): # pragma: no cover
|
| 26 |
+
if name == "_install":
|
| 27 |
+
SetuptoolsDeprecationWarning.emit(
|
| 28 |
+
"`setuptools.command._install` was an internal implementation detail "
|
| 29 |
+
+ "that was left in for numpy<1.9 support.",
|
| 30 |
+
due_date=(2025, 5, 2), # Originally added on 2024-11-01
|
| 31 |
+
)
|
| 32 |
+
return orig.install
|
| 33 |
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class install(orig.install):
|
| 37 |
+
"""Use easy_install to install the package, w/dependencies"""
|
| 38 |
+
|
| 39 |
+
distribution: Distribution # override distutils.dist.Distribution with setuptools.dist.Distribution
|
| 40 |
+
|
| 41 |
+
user_options = orig.install.user_options + [
|
| 42 |
+
('old-and-unmanageable', None, "Try not to use this!"),
|
| 43 |
+
(
|
| 44 |
+
'single-version-externally-managed',
|
| 45 |
+
None,
|
| 46 |
+
"used by system package builders to create 'flat' eggs",
|
| 47 |
+
),
|
| 48 |
+
]
|
| 49 |
+
boolean_options = orig.install.boolean_options + [
|
| 50 |
+
'old-and-unmanageable',
|
| 51 |
+
'single-version-externally-managed',
|
| 52 |
+
]
|
| 53 |
+
# Type the same as distutils.command.install.install.sub_commands
|
| 54 |
+
# Must keep the second tuple item potentially None due to invariance
|
| 55 |
+
new_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]] = [
|
| 56 |
+
('install_egg_info', lambda self: True),
|
| 57 |
+
('install_scripts', lambda self: True),
|
| 58 |
+
]
|
| 59 |
+
_nc = dict(new_commands)
|
| 60 |
+
|
| 61 |
+
def initialize_options(self):
|
| 62 |
+
SetuptoolsDeprecationWarning.emit(
|
| 63 |
+
"setup.py install is deprecated.",
|
| 64 |
+
"""
|
| 65 |
+
Please avoid running ``setup.py`` directly.
|
| 66 |
+
Instead, use pypa/build, pypa/installer or other
|
| 67 |
+
standards-based tools.
|
| 68 |
+
""",
|
| 69 |
+
see_url="https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html",
|
| 70 |
+
# TODO: Document how to bootstrap setuptools without install
|
| 71 |
+
# (e.g. by unziping the wheel file)
|
| 72 |
+
# and then add a due_date to this warning.
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
super().initialize_options()
|
| 76 |
+
self.old_and_unmanageable = None
|
| 77 |
+
self.single_version_externally_managed = None
|
| 78 |
+
|
| 79 |
+
def finalize_options(self) -> None:
|
| 80 |
+
super().finalize_options()
|
| 81 |
+
if self.root:
|
| 82 |
+
self.single_version_externally_managed = True
|
| 83 |
+
elif self.single_version_externally_managed:
|
| 84 |
+
if not self.root and not self.record:
|
| 85 |
+
raise DistutilsArgError(
|
| 86 |
+
"You must specify --record or --root when building system packages"
|
| 87 |
+
)
|
| 88 |
+
|
| 89 |
+
def handle_extra_path(self):
|
| 90 |
+
if self.root or self.single_version_externally_managed:
|
| 91 |
+
# explicit backward-compatibility mode, allow extra_path to work
|
| 92 |
+
return orig.install.handle_extra_path(self)
|
| 93 |
+
|
| 94 |
+
# Ignore extra_path when installing an egg (or being run by another
|
| 95 |
+
# command without --root or --single-version-externally-managed
|
| 96 |
+
self.path_file = None
|
| 97 |
+
self.extra_dirs = ''
|
| 98 |
+
return None
|
| 99 |
+
|
| 100 |
+
def run(self):
|
| 101 |
+
# Explicit request for old-style install? Just do it
|
| 102 |
+
if self.old_and_unmanageable or self.single_version_externally_managed:
|
| 103 |
+
return super().run()
|
| 104 |
+
|
| 105 |
+
if not self._called_from_setup(inspect.currentframe()):
|
| 106 |
+
# Run in backward-compatibility mode to support bdist_* commands.
|
| 107 |
+
super().run()
|
| 108 |
+
else:
|
| 109 |
+
self.do_egg_install()
|
| 110 |
+
|
| 111 |
+
return None
|
| 112 |
+
|
| 113 |
+
@staticmethod
|
| 114 |
+
def _called_from_setup(run_frame):
|
| 115 |
+
"""
|
| 116 |
+
Attempt to detect whether run() was called from setup() or by another
|
| 117 |
+
command. If called by setup(), the parent caller will be the
|
| 118 |
+
'run_command' method in 'distutils.dist', and *its* caller will be
|
| 119 |
+
the 'run_commands' method. If called any other way, the
|
| 120 |
+
immediate caller *might* be 'run_command', but it won't have been
|
| 121 |
+
called by 'run_commands'. Return True in that case or if a call stack
|
| 122 |
+
is unavailable. Return False otherwise.
|
| 123 |
+
"""
|
| 124 |
+
if run_frame is None:
|
| 125 |
+
msg = "Call stack not available. bdist_* commands may fail."
|
| 126 |
+
SetuptoolsWarning.emit(msg)
|
| 127 |
+
if platform.python_implementation() == 'IronPython':
|
| 128 |
+
msg = "For best results, pass -X:Frames to enable call stack."
|
| 129 |
+
SetuptoolsWarning.emit(msg)
|
| 130 |
+
return True
|
| 131 |
+
|
| 132 |
+
frames = inspect.getouterframes(run_frame)
|
| 133 |
+
for frame in frames[2:4]:
|
| 134 |
+
(caller,) = frame[:1]
|
| 135 |
+
info = inspect.getframeinfo(caller)
|
| 136 |
+
caller_module = caller.f_globals.get('__name__', '')
|
| 137 |
+
|
| 138 |
+
if caller_module == "setuptools.dist" and info.function == "run_command":
|
| 139 |
+
# Starting from v61.0.0 setuptools overwrites dist.run_command
|
| 140 |
+
continue
|
| 141 |
+
|
| 142 |
+
return caller_module == 'distutils.dist' and info.function == 'run_commands'
|
| 143 |
+
|
| 144 |
+
return False
|
| 145 |
+
|
| 146 |
+
def do_egg_install(self) -> None:
|
| 147 |
+
easy_install = self.distribution.get_command_class('easy_install')
|
| 148 |
+
|
| 149 |
+
cmd = cast(
|
| 150 |
+
# We'd want to cast easy_install as type[easy_install_cls] but a bug in
|
| 151 |
+
# mypy makes it think easy_install() returns a Command on Python 3.12+
|
| 152 |
+
# https://github.com/python/mypy/issues/18088
|
| 153 |
+
easy_install_cls,
|
| 154 |
+
easy_install( # type: ignore[call-arg]
|
| 155 |
+
self.distribution,
|
| 156 |
+
args="x",
|
| 157 |
+
root=self.root,
|
| 158 |
+
record=self.record,
|
| 159 |
+
),
|
| 160 |
+
)
|
| 161 |
+
cmd.ensure_finalized() # finalize before bdist_egg munges install cmd
|
| 162 |
+
cmd.always_copy_from = '.' # make sure local-dir eggs get installed
|
| 163 |
+
|
| 164 |
+
# pick up setup-dir .egg files only: no .egg-info
|
| 165 |
+
cmd.package_index.scan(glob.glob('*.egg'))
|
| 166 |
+
|
| 167 |
+
self.run_command('bdist_egg')
|
| 168 |
+
bdist_egg = cast(bdist_egg_cls, self.distribution.get_command_obj('bdist_egg'))
|
| 169 |
+
args = [bdist_egg.egg_output]
|
| 170 |
+
|
| 171 |
+
if setuptools.bootstrap_install_from:
|
| 172 |
+
# Bootstrap self-installation of setuptools
|
| 173 |
+
args.insert(0, setuptools.bootstrap_install_from)
|
| 174 |
+
|
| 175 |
+
cmd.args = args
|
| 176 |
+
cmd.run(show_deprecation=False)
|
| 177 |
+
setuptools.bootstrap_install_from = None
|
| 178 |
+
|
| 179 |
+
|
| 180 |
+
# XXX Python 3.1 doesn't see _nc if this is inside the class
|
| 181 |
+
install.sub_commands = [
|
| 182 |
+
cmd for cmd in orig.install.sub_commands if cmd[0] not in install._nc
|
| 183 |
+
] + install.new_commands
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (2.93 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/animate.cpython-310.pyc
ADDED
|
Binary file (6.35 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/container.cpython-310.pyc
ADDED
|
Binary file (11.1 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/elementfactory.cpython-310.pyc
ADDED
|
Binary file (2.42 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/etree.cpython-310.pyc
ADDED
|
Binary file (987 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/filters.cpython-310.pyc
ADDED
|
Binary file (9.61 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/image.cpython-310.pyc
ADDED
|
Binary file (2.67 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/masking.cpython-310.pyc
ADDED
|
Binary file (2.06 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/mixins.cpython-310.pyc
ADDED
|
Binary file (10.9 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/params.cpython-310.pyc
ADDED
|
Binary file (2.21 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/path.cpython-310.pyc
ADDED
|
Binary file (3.15 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/pattern.cpython-310.pyc
ADDED
|
Binary file (2.02 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/utils.cpython-310.pyc
ADDED
|
Binary file (7.17 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/__pycache__/version.cpython-310.pyc
ADDED
|
Binary file (221 Bytes). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/animate.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: animate elements
|
| 5 |
+
# Created: 31.10.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
from svgwrite.base import BaseElement
|
| 10 |
+
from svgwrite.mixins import XLink
|
| 11 |
+
from svgwrite.utils import strlist, is_string
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class Set(BaseElement, XLink):
|
| 15 |
+
""" The **set** element provides a simple means of just setting the value
|
| 16 |
+
of an attribute for a specified duration. It supports all attribute types,
|
| 17 |
+
including those that cannot reasonably be interpolated, such as string
|
| 18 |
+
and boolean values. The **set** element is non-additive. The additive and
|
| 19 |
+
accumulate attributes are not allowed, and will be ignored if specified.
|
| 20 |
+
"""
|
| 21 |
+
elementname = 'set'
|
| 22 |
+
|
| 23 |
+
def __init__(self, href=None, **extra):
|
| 24 |
+
""" Set constructor.
|
| 25 |
+
|
| 26 |
+
:param href: target svg element, if **href** is not `None`; else
|
| 27 |
+
the target SVG Element is the parent SVG Element.
|
| 28 |
+
"""
|
| 29 |
+
super(Set, self).__init__(**extra)
|
| 30 |
+
if href is not None:
|
| 31 |
+
self.set_href(href)
|
| 32 |
+
|
| 33 |
+
def get_xml(self):
|
| 34 |
+
self.update_id() # if href is an object - 'id' - attribute may be changed!
|
| 35 |
+
return super(Set, self).get_xml()
|
| 36 |
+
|
| 37 |
+
def set_target(self, attributeName, attributeType=None):
|
| 38 |
+
"""
|
| 39 |
+
Set animation attributes :ref:`attributeName` and :ref:`attributeType`.
|
| 40 |
+
"""
|
| 41 |
+
self['attributeName'] = attributeName
|
| 42 |
+
if attributeType is not None:
|
| 43 |
+
self['attributeType'] = attributeType
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def set_event(self, onbegin=None, onend=None, onrepeat=None, onload=None):
|
| 47 |
+
"""
|
| 48 |
+
Set animation attributes :ref:`onbegin`, :ref:`onend`, :ref:`onrepeat`
|
| 49 |
+
and :ref:`onload`.
|
| 50 |
+
"""
|
| 51 |
+
if onbegin is not None:
|
| 52 |
+
self['onbegin'] = onbegin
|
| 53 |
+
if onend is not None:
|
| 54 |
+
self['onend'] = onend
|
| 55 |
+
if onrepeat is not None:
|
| 56 |
+
self['onrepeat'] = onrepeat
|
| 57 |
+
if onload is not None:
|
| 58 |
+
self['onload'] = onload
|
| 59 |
+
|
| 60 |
+
def set_timing(self, begin=None, end=None, dur=None, min=None, max=None,
|
| 61 |
+
restart=None, repeatCount=None, repeatDur=None):
|
| 62 |
+
"""
|
| 63 |
+
Set animation attributes :ref:`begin`, :ref:`end`, :ref:`dur`,
|
| 64 |
+
:ref:`min`, :ref:`max`, :ref:`restart`, :ref:`repeatCount` and
|
| 65 |
+
:ref:`repeatDur`.
|
| 66 |
+
"""
|
| 67 |
+
if begin is not None:
|
| 68 |
+
self['begin'] = begin
|
| 69 |
+
if end is not None:
|
| 70 |
+
self['end'] = end
|
| 71 |
+
if dur is not None:
|
| 72 |
+
self['dur'] = dur
|
| 73 |
+
if min is not None:
|
| 74 |
+
self['min'] = min
|
| 75 |
+
if max is not None:
|
| 76 |
+
self['max'] = max
|
| 77 |
+
if restart is not None:
|
| 78 |
+
self['restart'] = restart
|
| 79 |
+
if repeatCount is not None:
|
| 80 |
+
self['repeatCount'] = repeatCount
|
| 81 |
+
if repeatDur is not None:
|
| 82 |
+
self['repeatDur'] = repeatDur
|
| 83 |
+
|
| 84 |
+
def freeze(self):
|
| 85 |
+
""" Freeze the animation effect. (see also :ref:`fill <animateFill>`)
|
| 86 |
+
"""
|
| 87 |
+
self['fill'] = 'freeze'
|
| 88 |
+
|
| 89 |
+
class AnimateMotion(Set):
|
| 90 |
+
""" The **animateMotion** element causes a referenced element to move
|
| 91 |
+
along a motion path.
|
| 92 |
+
"""
|
| 93 |
+
elementname = 'animateMotion'
|
| 94 |
+
|
| 95 |
+
def __init__(self, path=None, href=None, **extra):
|
| 96 |
+
"""
|
| 97 |
+
:param path: the motion path
|
| 98 |
+
:param href: target svg element, if **href** is not `None`; else
|
| 99 |
+
the target SVG Element is the parent SVG Element.
|
| 100 |
+
"""
|
| 101 |
+
super(AnimateMotion, self).__init__(href=href, **extra)
|
| 102 |
+
if path is not None:
|
| 103 |
+
self['path'] = path
|
| 104 |
+
|
| 105 |
+
def set_value(self, path=None, calcMode=None, keyPoints=None, rotate=None):
|
| 106 |
+
"""
|
| 107 |
+
Set animation attributes `path`, `calcMode`, `keyPoints` and `rotate`.
|
| 108 |
+
"""
|
| 109 |
+
if path is not None:
|
| 110 |
+
self['path'] = path
|
| 111 |
+
if calcMode is not None:
|
| 112 |
+
self['calcMode'] = calcMode
|
| 113 |
+
if keyPoints is not None:
|
| 114 |
+
self['keyPoints'] = keyPoints
|
| 115 |
+
if rotate is not None:
|
| 116 |
+
self['rotate'] = rotate
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
class Animate(Set):
|
| 120 |
+
""" The **animate** element allows scalar attributes and properties to be
|
| 121 |
+
assigned different values over time .
|
| 122 |
+
"""
|
| 123 |
+
elementname = 'animate'
|
| 124 |
+
|
| 125 |
+
def __init__(self, attributeName=None, values=None, href=None, **extra):
|
| 126 |
+
"""
|
| 127 |
+
:param attributeName: name of the SVG Attribute to animate
|
| 128 |
+
:param values: interpolation values, `string` as `<semicolon-list>` or a python `list`
|
| 129 |
+
:param href: target svg element, if **href** is not `None`; else
|
| 130 |
+
the target SVG Element is the parent SVG Element.
|
| 131 |
+
"""
|
| 132 |
+
super(Animate, self).__init__(href=href, **extra)
|
| 133 |
+
if values is not None:
|
| 134 |
+
self.set_value(values)
|
| 135 |
+
if attributeName is not None:
|
| 136 |
+
self.set_target(attributeName)
|
| 137 |
+
|
| 138 |
+
def set_value(self, values, calcMode=None, keyTimes=None, keySplines=None,
|
| 139 |
+
from_=None, to=None, by=None):
|
| 140 |
+
"""
|
| 141 |
+
Set animation attributes :ref:`values`, :ref:`calcMode`, :ref:`keyTimes`,
|
| 142 |
+
:ref:`keySplines`, :ref:`from`, :ref:`to` and :ref:`by`.
|
| 143 |
+
"""
|
| 144 |
+
if values is not None:
|
| 145 |
+
if not is_string(values):
|
| 146 |
+
values = strlist(values, ';')
|
| 147 |
+
self['values'] = values
|
| 148 |
+
|
| 149 |
+
if calcMode is not None:
|
| 150 |
+
self['calcMode'] = calcMode
|
| 151 |
+
if keyTimes is not None:
|
| 152 |
+
self['keyTimes'] = keyTimes
|
| 153 |
+
if keySplines is not None:
|
| 154 |
+
self['keySplines'] = keySplines
|
| 155 |
+
if from_ is not None:
|
| 156 |
+
self['from'] = from_
|
| 157 |
+
if to is not None:
|
| 158 |
+
self['to'] = to
|
| 159 |
+
if by is not None:
|
| 160 |
+
self['by'] = by
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
class AnimateColor(Animate):
|
| 164 |
+
""" The **animateColor** element specifies a color transformation over
|
| 165 |
+
time.
|
| 166 |
+
"""
|
| 167 |
+
elementname = 'animateColor'
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
class AnimateTransform(Animate):
|
| 171 |
+
""" The **animateTransform** element animates a transformation attribute
|
| 172 |
+
on a target element, thereby allowing animations to control translation,
|
| 173 |
+
scaling, rotation and/or skewing.
|
| 174 |
+
"""
|
| 175 |
+
elementname = 'animateTransform'
|
| 176 |
+
def __init__(self, transform, element=None, **extra):
|
| 177 |
+
"""
|
| 178 |
+
:param element: target svg element, if element is not `None`; else
|
| 179 |
+
the target svg element is the parent svg element.
|
| 180 |
+
:param string transform: ``'translate | scale | rotate | skewX | skewY'``
|
| 181 |
+
"""
|
| 182 |
+
super(AnimateTransform, self).__init__(element, **extra)
|
| 183 |
+
self['type'] = transform
|
falcon/lib/python3.10/site-packages/svgwrite/base.py
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman
|
| 4 |
+
# Purpose: svg base element
|
| 5 |
+
# Created: 08.09.2010
|
| 6 |
+
# Copyright (c) 2010-2020, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
"""
|
| 9 |
+
The **BaseElement** is the root for all SVG elements.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from svgwrite.etree import etree
|
| 13 |
+
|
| 14 |
+
import copy
|
| 15 |
+
|
| 16 |
+
from svgwrite.params import Parameter
|
| 17 |
+
from svgwrite.utils import AutoID
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class BaseElement(object):
|
| 21 |
+
"""
|
| 22 |
+
The **BaseElement** is the root for all SVG elements. The SVG attributes
|
| 23 |
+
are stored in **attribs**, and the SVG subelements are stored in
|
| 24 |
+
**elements**.
|
| 25 |
+
|
| 26 |
+
"""
|
| 27 |
+
elementname = 'baseElement'
|
| 28 |
+
|
| 29 |
+
def __init__(self, **extra):
|
| 30 |
+
"""
|
| 31 |
+
:param extra: extra SVG attributes (keyword arguments)
|
| 32 |
+
|
| 33 |
+
* add trailing '_' to reserved keywords: ``'class_'``, ``'from_'``
|
| 34 |
+
* replace inner '-' by '_': ``'stroke_width'``
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
SVG attribute names will be checked, if **debug** is `True`.
|
| 38 |
+
|
| 39 |
+
workaround for removed **attribs** parameter in Version 0.2.2::
|
| 40 |
+
|
| 41 |
+
# replace
|
| 42 |
+
element = BaseElement(attribs=adict)
|
| 43 |
+
|
| 44 |
+
#by
|
| 45 |
+
element = BaseElement()
|
| 46 |
+
element.update(adict)
|
| 47 |
+
|
| 48 |
+
"""
|
| 49 |
+
# the keyword 'factory' specifies the object creator
|
| 50 |
+
factory = extra.pop('factory', None)
|
| 51 |
+
if factory is not None:
|
| 52 |
+
# take parameter from 'factory'
|
| 53 |
+
self._parameter = factory._parameter
|
| 54 |
+
else:
|
| 55 |
+
# default parameter debug=True profile='full'
|
| 56 |
+
self._parameter = Parameter()
|
| 57 |
+
|
| 58 |
+
# override debug setting
|
| 59 |
+
debug = extra.pop('debug', None)
|
| 60 |
+
if debug is not None:
|
| 61 |
+
self._parameter.debug = debug
|
| 62 |
+
|
| 63 |
+
# override profile setting
|
| 64 |
+
profile = extra.pop('profile', None)
|
| 65 |
+
if profile is not None:
|
| 66 |
+
self._parameter.profile = profile
|
| 67 |
+
|
| 68 |
+
self.attribs = dict()
|
| 69 |
+
self.update(extra)
|
| 70 |
+
self.elements = list()
|
| 71 |
+
|
| 72 |
+
def update(self, attribs):
|
| 73 |
+
""" Update SVG Attributes from `dict` attribs.
|
| 74 |
+
|
| 75 |
+
Rules for keys:
|
| 76 |
+
|
| 77 |
+
1. trailing '_' will be removed (``'class_'`` -> ``'class'``)
|
| 78 |
+
2. inner '_' will be replaced by '-' (``'stroke_width'`` -> ``'stroke-width'``)
|
| 79 |
+
|
| 80 |
+
"""
|
| 81 |
+
for key, value in attribs.items():
|
| 82 |
+
# remove trailing underscores
|
| 83 |
+
# and replace inner underscores
|
| 84 |
+
key = key.rstrip('_').replace('_', '-')
|
| 85 |
+
self.__setitem__(key, value)
|
| 86 |
+
|
| 87 |
+
def copy(self):
|
| 88 |
+
newobj = copy.copy(self) # shallow copy of object
|
| 89 |
+
newobj.attribs = copy.copy(self.attribs) # shallow copy of attributes
|
| 90 |
+
newobj.elements = copy.copy(self.elements) # shallow copy of subelements
|
| 91 |
+
if 'id' in newobj.attribs: # create a new 'id'
|
| 92 |
+
newobj['id'] = newobj.next_id()
|
| 93 |
+
return newobj
|
| 94 |
+
|
| 95 |
+
@property
|
| 96 |
+
def debug(self):
|
| 97 |
+
return self._parameter.debug
|
| 98 |
+
|
| 99 |
+
@property
|
| 100 |
+
def profile(self):
|
| 101 |
+
return self._parameter.profile
|
| 102 |
+
|
| 103 |
+
@property
|
| 104 |
+
def validator(self):
|
| 105 |
+
return self._parameter.validator
|
| 106 |
+
|
| 107 |
+
@validator.setter
|
| 108 |
+
def validator(self, value):
|
| 109 |
+
self._parameter.validator = value
|
| 110 |
+
|
| 111 |
+
@property
|
| 112 |
+
def version(self):
|
| 113 |
+
return self._parameter.get_version()
|
| 114 |
+
|
| 115 |
+
def set_parameter(self, parameter):
|
| 116 |
+
self._parameter = parameter
|
| 117 |
+
|
| 118 |
+
def next_id(self, value=None):
|
| 119 |
+
return AutoID.next_id(value)
|
| 120 |
+
|
| 121 |
+
def get_id(self):
|
| 122 |
+
""" Get the object `id` string, if the object does not have an `id`,
|
| 123 |
+
a new `id` will be created.
|
| 124 |
+
|
| 125 |
+
:returns: `string`
|
| 126 |
+
"""
|
| 127 |
+
if 'id' not in self.attribs:
|
| 128 |
+
self.attribs['id'] = self.next_id()
|
| 129 |
+
return self.attribs['id']
|
| 130 |
+
|
| 131 |
+
def get_iri(self):
|
| 132 |
+
"""
|
| 133 |
+
Get the `IRI` reference string of the object. (i.e., ``'#id'``).
|
| 134 |
+
|
| 135 |
+
:returns: `string`
|
| 136 |
+
"""
|
| 137 |
+
return "#%s" % self.get_id()
|
| 138 |
+
|
| 139 |
+
def get_funciri(self):
|
| 140 |
+
"""
|
| 141 |
+
Get the `FuncIRI` reference string of the object. (i.e. ``'url(#id)'``).
|
| 142 |
+
|
| 143 |
+
:returns: `string`
|
| 144 |
+
"""
|
| 145 |
+
return "url(%s)" % self.get_iri()
|
| 146 |
+
|
| 147 |
+
def __getitem__(self, key):
|
| 148 |
+
""" Get SVG attribute by `key`.
|
| 149 |
+
|
| 150 |
+
:param string key: SVG attribute name
|
| 151 |
+
:return: SVG attribute value
|
| 152 |
+
|
| 153 |
+
"""
|
| 154 |
+
return self.attribs[key]
|
| 155 |
+
|
| 156 |
+
def __setitem__(self, key, value):
|
| 157 |
+
""" Set SVG attribute by `key` to `value`.
|
| 158 |
+
|
| 159 |
+
:param string key: SVG attribute name
|
| 160 |
+
:param object value: SVG attribute value
|
| 161 |
+
|
| 162 |
+
"""
|
| 163 |
+
# Attribute checking is only done by using the __setitem__() method or
|
| 164 |
+
# by self['attribute'] = value
|
| 165 |
+
if self.debug:
|
| 166 |
+
self.validator.check_svg_attribute_value(self.elementname, key, value)
|
| 167 |
+
self.attribs[key] = value
|
| 168 |
+
|
| 169 |
+
def add(self, element):
|
| 170 |
+
""" Add an SVG element as subelement.
|
| 171 |
+
|
| 172 |
+
:param element: append this SVG element
|
| 173 |
+
:returns: the added element
|
| 174 |
+
|
| 175 |
+
"""
|
| 176 |
+
if self.debug:
|
| 177 |
+
self.validator.check_valid_children(self.elementname, element.elementname)
|
| 178 |
+
self.elements.append(element)
|
| 179 |
+
return element
|
| 180 |
+
|
| 181 |
+
def tostring(self):
|
| 182 |
+
""" Get the XML representation as unicode `string`.
|
| 183 |
+
|
| 184 |
+
:return: unicode XML string of this object and all its subelements
|
| 185 |
+
|
| 186 |
+
"""
|
| 187 |
+
xml = self.get_xml()
|
| 188 |
+
# required for Python 2 support
|
| 189 |
+
xml_utf8_str = etree.tostring(xml, encoding='utf-8')
|
| 190 |
+
return xml_utf8_str.decode('utf-8')
|
| 191 |
+
# just Python 3: return etree.tostring(xml, encoding='unicode')
|
| 192 |
+
|
| 193 |
+
def _repr_svg_(self):
|
| 194 |
+
""" Show SVG in IPython, Jupyter Notebook, and Jupyter Lab
|
| 195 |
+
|
| 196 |
+
:return: unicode XML string of this object and all its subelements
|
| 197 |
+
|
| 198 |
+
"""
|
| 199 |
+
return self.tostring()
|
| 200 |
+
|
| 201 |
+
def get_xml(self):
|
| 202 |
+
""" Get the XML representation as `ElementTree` object.
|
| 203 |
+
|
| 204 |
+
:return: XML `ElementTree` of this object and all its subelements
|
| 205 |
+
|
| 206 |
+
"""
|
| 207 |
+
xml = etree.Element(self.elementname)
|
| 208 |
+
if self.debug:
|
| 209 |
+
self.validator.check_all_svg_attribute_values(self.elementname, self.attribs)
|
| 210 |
+
for attribute, value in sorted(self.attribs.items()):
|
| 211 |
+
# filter 'None' values
|
| 212 |
+
if value is not None:
|
| 213 |
+
value = self.value_to_string(value)
|
| 214 |
+
if value: # just add not empty attributes
|
| 215 |
+
xml.set(attribute, value)
|
| 216 |
+
|
| 217 |
+
for element in self.elements:
|
| 218 |
+
xml.append(element.get_xml())
|
| 219 |
+
return xml
|
| 220 |
+
|
| 221 |
+
def value_to_string(self, value):
|
| 222 |
+
"""
|
| 223 |
+
Converts *value* into a <string> includes a value check, depending
|
| 224 |
+
on :attr:`self.debug` and :attr:`self.profile`.
|
| 225 |
+
|
| 226 |
+
"""
|
| 227 |
+
if isinstance(value, (int, float)):
|
| 228 |
+
if self.debug:
|
| 229 |
+
self.validator.check_svg_type(value, 'number')
|
| 230 |
+
if isinstance(value, float) and self.profile == 'tiny':
|
| 231 |
+
value = round(value, 4)
|
| 232 |
+
return str(value)
|
| 233 |
+
|
| 234 |
+
def set_desc(self, title=None, desc=None):
|
| 235 |
+
""" Insert a **title** and/or a **desc** element as first subelement.
|
| 236 |
+
"""
|
| 237 |
+
if desc is not None:
|
| 238 |
+
self.elements.insert(0, Desc(desc))
|
| 239 |
+
if title is not None:
|
| 240 |
+
self.elements.insert(0, Title(title))
|
| 241 |
+
|
| 242 |
+
def set_metadata(self, xmldata):
|
| 243 |
+
"""
|
| 244 |
+
:param xmldata: an xml.etree.ElementTree - Element() object.
|
| 245 |
+
"""
|
| 246 |
+
metadata = Metadata(xmldata)
|
| 247 |
+
if len(self.elements) == 0:
|
| 248 |
+
self.elements.append(metadata)
|
| 249 |
+
else:
|
| 250 |
+
pos = 0
|
| 251 |
+
while self.elements[pos].elementname in ('title', 'desc'):
|
| 252 |
+
pos += 1
|
| 253 |
+
if pos == len(self.elements):
|
| 254 |
+
self.elements.append(metadata)
|
| 255 |
+
return
|
| 256 |
+
if self.elements[pos].elementname == 'metadata':
|
| 257 |
+
self.elements[pos].xml.append(xmldata)
|
| 258 |
+
else:
|
| 259 |
+
self.elements.insert(pos, metadata)
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
class Title(object):
|
| 263 |
+
elementname = 'title'
|
| 264 |
+
|
| 265 |
+
def __init__(self, text):
|
| 266 |
+
self.xml = etree.Element(self.elementname)
|
| 267 |
+
self.xml.text = str(text)
|
| 268 |
+
|
| 269 |
+
def get_xml(self):
|
| 270 |
+
return self.xml
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
class Desc(Title):
|
| 274 |
+
elementname = 'desc'
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
class Metadata(Title):
|
| 278 |
+
elementname = 'metadata'
|
| 279 |
+
|
| 280 |
+
def __init__(self, xmldata):
|
| 281 |
+
"""
|
| 282 |
+
:param xmldata: an xml.etree.ElementTree - Element() object.
|
| 283 |
+
"""
|
| 284 |
+
self.xml = etree.Element('metadata')
|
| 285 |
+
self.xml.append(xmldata)
|
falcon/lib/python3.10/site-packages/svgwrite/container.py
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#coding:utf-8
|
| 2 |
+
# Author: mozman
|
| 3 |
+
# Purpose: svg container classes
|
| 4 |
+
# Created: 15.09.2010
|
| 5 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 6 |
+
# License: MIT License
|
| 7 |
+
"""
|
| 8 |
+
The **container** module provides following structural objects:
|
| 9 |
+
|
| 10 |
+
* :class:`svgwrite.Group`
|
| 11 |
+
* :class:`svgwrite.SVG`
|
| 12 |
+
* :class:`svgwrite.Defs`
|
| 13 |
+
* :class:`svgwrite.Symbol`
|
| 14 |
+
* :class:`svgwrite.Marker`
|
| 15 |
+
* :class:`svgwrite.Use`
|
| 16 |
+
* :class:`svgwrite.Hyperlink`
|
| 17 |
+
* :class:`svgwrite.Script`
|
| 18 |
+
* :class:`svgwrite.Style`
|
| 19 |
+
|
| 20 |
+
set/get SVG attributes::
|
| 21 |
+
|
| 22 |
+
element['attribute'] = value
|
| 23 |
+
value = element['attribute']
|
| 24 |
+
|
| 25 |
+
"""
|
| 26 |
+
from urllib.request import urlopen
|
| 27 |
+
from svgwrite.utils import font_mimetype, base64_data, find_first_url
|
| 28 |
+
from svgwrite.base import BaseElement
|
| 29 |
+
from svgwrite.mixins import ViewBox, Transform, XLink
|
| 30 |
+
from svgwrite.mixins import Presentation, Clipping
|
| 31 |
+
from svgwrite.etree import CDATA
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
class Group(BaseElement, Transform, Presentation):
|
| 35 |
+
""" The **Group** (SVG **g**) element is a container element for grouping
|
| 36 |
+
together related graphics elements.
|
| 37 |
+
|
| 38 |
+
Grouping constructs, when used in conjunction with the **desc** and **title**
|
| 39 |
+
elements, provide information about document structure and semantics.
|
| 40 |
+
Documents that are rich in structure may be rendered graphically, as speech,
|
| 41 |
+
or as braille, and thus promote accessibility.
|
| 42 |
+
|
| 43 |
+
A group of elements, as well as individual objects, can be given a name using
|
| 44 |
+
the **id** attribute. Named groups are needed for several purposes such as
|
| 45 |
+
animation and re-usable objects.
|
| 46 |
+
|
| 47 |
+
"""
|
| 48 |
+
elementname = 'g'
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class Defs(Group):
|
| 52 |
+
""" The **defs** element is a container element for referenced elements. For
|
| 53 |
+
understandability and accessibility reasons, it is recommended that, whenever
|
| 54 |
+
possible, referenced elements be defined inside of a **defs**.
|
| 55 |
+
"""
|
| 56 |
+
elementname = 'defs'
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class Symbol(BaseElement, ViewBox, Presentation, Clipping):
|
| 60 |
+
""" The **symbol** element is used to define graphical template objects which
|
| 61 |
+
can be instantiated by a **use** element. The use of **symbol** elements for
|
| 62 |
+
graphics that are used multiple times in the same document adds structure and
|
| 63 |
+
semantics. Documents that are rich in structure may be rendered graphically,
|
| 64 |
+
as speech, or as braille, and thus promote accessibility.
|
| 65 |
+
"""
|
| 66 |
+
# ITransform interface is not valid for Symbol -> do not inherit from Group
|
| 67 |
+
elementname = 'symbol'
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class Marker(BaseElement, ViewBox, Presentation):
|
| 71 |
+
""" The **marker** element defines the graphics that is to be used for
|
| 72 |
+
drawing arrowheads or polymarkers on a given **path**, **line**, **polyline**
|
| 73 |
+
or **polygon** element.
|
| 74 |
+
|
| 75 |
+
Add Marker definitions to a **defs** section, preferred to the **defs** section
|
| 76 |
+
of the **main drawing**.
|
| 77 |
+
|
| 78 |
+
"""
|
| 79 |
+
elementname = 'marker'
|
| 80 |
+
|
| 81 |
+
def __init__(self, insert=None, size=None, orient=None, **extra):
|
| 82 |
+
"""
|
| 83 |
+
:param 2-tuple insert: reference point (**refX**, **refY**)
|
| 84 |
+
:param 2-tuple size: (**markerWidth**, **markerHeight**)
|
| 85 |
+
:param orient: ``'auto'`` | `angle`
|
| 86 |
+
:param extra: additional SVG attributes as keyword-arguments
|
| 87 |
+
"""
|
| 88 |
+
super(Marker, self).__init__(**extra)
|
| 89 |
+
if insert is not None:
|
| 90 |
+
self['refX'] = insert[0]
|
| 91 |
+
self['refY'] = insert[1]
|
| 92 |
+
if size is not None:
|
| 93 |
+
self['markerWidth'] = size[0]
|
| 94 |
+
self['markerHeight'] = size[1]
|
| 95 |
+
if orient is not None:
|
| 96 |
+
self['orient'] = orient
|
| 97 |
+
if 'id' not in self.attribs: # an 'id' is necessary
|
| 98 |
+
self['id'] = self.next_id()
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
FONT_TEMPLATE = """@font-face{{
|
| 102 |
+
font-family: "{name}";
|
| 103 |
+
src: url("{data}");
|
| 104 |
+
}}
|
| 105 |
+
"""
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
class SVG(Symbol):
|
| 109 |
+
""" A SVG document fragment consists of any number of SVG elements contained
|
| 110 |
+
within an **svg** element.
|
| 111 |
+
|
| 112 |
+
An SVG document fragment can range from an empty fragment (i.e., no content
|
| 113 |
+
inside of the **svg** element), to a very simple SVG document fragment containing
|
| 114 |
+
a single SVG graphics element such as a **rect**, to a complex, deeply nested
|
| 115 |
+
collection of container elements and graphics elements.
|
| 116 |
+
"""
|
| 117 |
+
elementname = 'svg'
|
| 118 |
+
|
| 119 |
+
def __init__(self, insert=None, size=None, **extra):
|
| 120 |
+
"""
|
| 121 |
+
:param 2-tuple insert: insert position (**x**, **y**)
|
| 122 |
+
:param 2-tuple size: (**width**, **height**)
|
| 123 |
+
:param extra: additional SVG attributes as keyword-arguments
|
| 124 |
+
"""
|
| 125 |
+
super(SVG, self).__init__(**extra)
|
| 126 |
+
if insert is not None:
|
| 127 |
+
self['x'] = insert[0]
|
| 128 |
+
self['y'] = insert[1]
|
| 129 |
+
if size is not None:
|
| 130 |
+
self['width'] = size[0]
|
| 131 |
+
self['height'] = size[1]
|
| 132 |
+
|
| 133 |
+
self.defs = Defs(factory=self) # defs container
|
| 134 |
+
self.add(self.defs) # add defs as first element
|
| 135 |
+
|
| 136 |
+
def embed_stylesheet(self, content):
|
| 137 |
+
""" Add <style> tag to the defs section.
|
| 138 |
+
|
| 139 |
+
:param content: style sheet content as string
|
| 140 |
+
:return: :class:`~svgwrite.container.Style` object
|
| 141 |
+
"""
|
| 142 |
+
return self.defs.add(Style(content))
|
| 143 |
+
|
| 144 |
+
def embed_font(self, name, filename):
|
| 145 |
+
""" Embed font as base64 encoded data from font file.
|
| 146 |
+
|
| 147 |
+
:param name: font name
|
| 148 |
+
:param filename: file name of local stored font
|
| 149 |
+
"""
|
| 150 |
+
data = open(filename, 'rb').read()
|
| 151 |
+
self._embed_font_data(name, data, font_mimetype(filename))
|
| 152 |
+
|
| 153 |
+
def embed_google_web_font(self, name, uri):
|
| 154 |
+
""" Embed font as base64 encoded data acquired from google fonts.
|
| 155 |
+
|
| 156 |
+
:param name: font name
|
| 157 |
+
:param uri: google fonts request uri like 'http://fonts.googleapis.com/css?family=Indie+Flower'
|
| 158 |
+
"""
|
| 159 |
+
font_info = urlopen(uri).read()
|
| 160 |
+
font_url = find_first_url(font_info.decode())
|
| 161 |
+
if font_url is None:
|
| 162 |
+
raise ValueError("Got no font data from uri: '{}'".format(uri))
|
| 163 |
+
else:
|
| 164 |
+
data = urlopen(font_url).read()
|
| 165 |
+
self._embed_font_data(name, data, font_mimetype(font_url))
|
| 166 |
+
|
| 167 |
+
def _embed_font_data(self, name, data, mimetype):
|
| 168 |
+
content = FONT_TEMPLATE.format(name=name, data=base64_data(data, mimetype))
|
| 169 |
+
self.embed_stylesheet(content)
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
class Use(BaseElement, Transform, XLink, Presentation):
|
| 173 |
+
""" The **use** element references another element and indicates that the graphical
|
| 174 |
+
contents of that element is included/drawn at that given point in the document.
|
| 175 |
+
|
| 176 |
+
Link to objects by href = ``'#object-id'`` or use the object itself as
|
| 177 |
+
href-argument, if the given element has no **id** attribute it gets an
|
| 178 |
+
automatic generated id.
|
| 179 |
+
|
| 180 |
+
"""
|
| 181 |
+
elementname = 'use'
|
| 182 |
+
|
| 183 |
+
def __init__(self, href, insert=None, size=None, **extra):
|
| 184 |
+
"""
|
| 185 |
+
:param string href: object link (id-string) or an object with an id-attribute
|
| 186 |
+
:param 2-tuple insert: insert point (**x**, **y**)
|
| 187 |
+
:param 2-tuple size: (**width**, **height**)
|
| 188 |
+
:param extra: additional SVG attributes as keyword-arguments
|
| 189 |
+
"""
|
| 190 |
+
super(Use, self).__init__(**extra)
|
| 191 |
+
self.set_href(href)
|
| 192 |
+
if insert is not None:
|
| 193 |
+
self['x'] = insert[0]
|
| 194 |
+
self['y'] = insert[1]
|
| 195 |
+
if size is not None:
|
| 196 |
+
self['width'] = size[0]
|
| 197 |
+
self['height'] = size[1]
|
| 198 |
+
|
| 199 |
+
def get_xml(self):
|
| 200 |
+
self.update_id() # if href is an object - 'id' - attribute may be changed!
|
| 201 |
+
return super(Use, self).get_xml()
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
class Hyperlink(BaseElement, Transform, Presentation):
|
| 205 |
+
""" The **a** element indicate links (also known as Hyperlinks or Web links).
|
| 206 |
+
|
| 207 |
+
The remote resource (the destination for the link) is defined by a `<URI>`
|
| 208 |
+
specified by the XLink **xlink:href** attribute. The remote resource may be
|
| 209 |
+
any Web resource (e.g., an image, a video clip, a sound bite, a program,
|
| 210 |
+
another SVG document, an HTML document, an element within the current
|
| 211 |
+
document, an element within a different document, etc.). By activating
|
| 212 |
+
these links (by clicking with the mouse, through keyboard input, voice
|
| 213 |
+
commands, etc.), users may visit these resources.
|
| 214 |
+
|
| 215 |
+
A **Hyperlink** is defined for each separate rendered element
|
| 216 |
+
contained within the **Hyperlink** class; add sublements as usual with
|
| 217 |
+
the `add` method.
|
| 218 |
+
|
| 219 |
+
"""
|
| 220 |
+
elementname = 'a'
|
| 221 |
+
|
| 222 |
+
def __init__(self, href, target='_blank', **extra):
|
| 223 |
+
"""
|
| 224 |
+
:param string href: hyperlink to the target resource
|
| 225 |
+
:param string target: ``'_blank|_replace|_self|_parent|_top|<XML-name>'``
|
| 226 |
+
:param extra: additional SVG attributes as keyword-arguments
|
| 227 |
+
"""
|
| 228 |
+
super(Hyperlink, self).__init__(**extra)
|
| 229 |
+
self['xlink:href'] = href
|
| 230 |
+
if target is not None:
|
| 231 |
+
self['target'] = target
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
class Script(BaseElement):
|
| 235 |
+
""" The **script** element indicate links to a client-side language. This
|
| 236 |
+
is normally a (also known as Hyperlinks or Web links).
|
| 237 |
+
|
| 238 |
+
The remote resource (the source of the script) is defined by a `<URI>`
|
| 239 |
+
specified by the XLink **xlink:href** attribute. The remote resource must
|
| 240 |
+
be a text-file that contains the script contents. This script can be used
|
| 241 |
+
within the SVG file by catching events or adding the mouseover/mousedown/
|
| 242 |
+
mouseup elements to the markup.
|
| 243 |
+
|
| 244 |
+
"""
|
| 245 |
+
elementname = 'script'
|
| 246 |
+
|
| 247 |
+
def __init__(self, href=None, content="", **extra):
|
| 248 |
+
"""
|
| 249 |
+
:param string href: hyperlink to the target resource or *None* if using *content*
|
| 250 |
+
:param string content: script content
|
| 251 |
+
:param extra: additional attributes as keyword-arguments
|
| 252 |
+
|
| 253 |
+
Use *href* **or** *content*, but not both at the same time.
|
| 254 |
+
|
| 255 |
+
"""
|
| 256 |
+
# removed type parameter, default is "application/ecmascript"
|
| 257 |
+
super(Script, self).__init__(**extra)
|
| 258 |
+
if href is not None:
|
| 259 |
+
self['xlink:href'] = href
|
| 260 |
+
self._content = content
|
| 261 |
+
|
| 262 |
+
def get_xml(self):
|
| 263 |
+
xml = super(Script, self).get_xml()
|
| 264 |
+
if self._content:
|
| 265 |
+
xml.append(CDATA(self._content))
|
| 266 |
+
return xml
|
| 267 |
+
|
| 268 |
+
def append(self, content):
|
| 269 |
+
""" Append content to the existing element-content. """
|
| 270 |
+
self._content += content
|
| 271 |
+
|
| 272 |
+
|
| 273 |
+
class Style(Script):
|
| 274 |
+
""" The *style* element allows style sheets to be embedded directly within
|
| 275 |
+
SVG content. SVG's *style* element has the same attributes as the
|
| 276 |
+
corresponding element in HTML.
|
| 277 |
+
|
| 278 |
+
"""
|
| 279 |
+
elementname = 'style'
|
| 280 |
+
|
| 281 |
+
def __init__(self, content="", **extra):
|
| 282 |
+
"""
|
| 283 |
+
:param string content: stylesheet content
|
| 284 |
+
"""
|
| 285 |
+
super(Style, self).__init__(content=content, **extra)
|
| 286 |
+
self['type'] = "text/css"
|
| 287 |
+
|
falcon/lib/python3.10/site-packages/svgwrite/data/__init__.py
ADDED
|
File without changes
|
falcon/lib/python3.10/site-packages/svgwrite/data/__pycache__/svgparser.cpython-310.pyc
ADDED
|
Binary file (4.53 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/data/__pycache__/typechecker.cpython-310.pyc
ADDED
|
Binary file (10.1 kB). View file
|
|
|
falcon/lib/python3.10/site-packages/svgwrite/data/colors.py
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: colornames
|
| 5 |
+
# Created: 06.10.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
colornames = frozenset([
|
| 10 |
+
'aliceblue',
|
| 11 |
+
'antiquewhite',
|
| 12 |
+
'aqua',
|
| 13 |
+
'aquamarine',
|
| 14 |
+
'azure',
|
| 15 |
+
'beige',
|
| 16 |
+
'bisque',
|
| 17 |
+
'black',
|
| 18 |
+
'blanchedalmond',
|
| 19 |
+
'blue',
|
| 20 |
+
'blueviolet',
|
| 21 |
+
'brown',
|
| 22 |
+
'burlywood',
|
| 23 |
+
'cadetblue',
|
| 24 |
+
'chartreuse',
|
| 25 |
+
'chocolate',
|
| 26 |
+
'coral',
|
| 27 |
+
'cornflowerblue',
|
| 28 |
+
'cornsilk',
|
| 29 |
+
'crimson',
|
| 30 |
+
'cyan',
|
| 31 |
+
'darkblue',
|
| 32 |
+
'darkcyan',
|
| 33 |
+
'darkgoldenrod',
|
| 34 |
+
'darkgray',
|
| 35 |
+
'darkgreen',
|
| 36 |
+
'darkgrey',
|
| 37 |
+
'darkkhaki',
|
| 38 |
+
'darkmagenta',
|
| 39 |
+
'darkolivegreen',
|
| 40 |
+
'darkorange',
|
| 41 |
+
'darkorchid',
|
| 42 |
+
'darkred',
|
| 43 |
+
'darksalmon',
|
| 44 |
+
'darkseagreen',
|
| 45 |
+
'darkslateblue',
|
| 46 |
+
'darkslategray',
|
| 47 |
+
'darkslategrey',
|
| 48 |
+
'darkturquoise',
|
| 49 |
+
'darkviolet',
|
| 50 |
+
'deeppink',
|
| 51 |
+
'deepskyblue',
|
| 52 |
+
'dimgray',
|
| 53 |
+
'dimgrey',
|
| 54 |
+
'dodgerblue',
|
| 55 |
+
'firebrick',
|
| 56 |
+
'floralwhite',
|
| 57 |
+
'forestgreen',
|
| 58 |
+
'fuchsia',
|
| 59 |
+
'gainsboro',
|
| 60 |
+
'ghostwhite',
|
| 61 |
+
'gold',
|
| 62 |
+
'goldenrod',
|
| 63 |
+
'gray',
|
| 64 |
+
'green',
|
| 65 |
+
'greenyellow',
|
| 66 |
+
'grey',
|
| 67 |
+
'honeydew',
|
| 68 |
+
'hotpink',
|
| 69 |
+
'indianred',
|
| 70 |
+
'indigo',
|
| 71 |
+
'ivory',
|
| 72 |
+
'khaki',
|
| 73 |
+
'lavender',
|
| 74 |
+
'lavenderblush',
|
| 75 |
+
'lawngreen',
|
| 76 |
+
'lemonchiffon',
|
| 77 |
+
'lightblue',
|
| 78 |
+
'lightcoral',
|
| 79 |
+
'lightcyan',
|
| 80 |
+
'lightgoldenrodyellow',
|
| 81 |
+
'lightgray',
|
| 82 |
+
'lightgreen',
|
| 83 |
+
'lightgrey',
|
| 84 |
+
'lightpink',
|
| 85 |
+
'lightsalmon',
|
| 86 |
+
'lightseagreen',
|
| 87 |
+
'lightskyblue',
|
| 88 |
+
'lightslategray',
|
| 89 |
+
'lightslategrey',
|
| 90 |
+
'lightsteelblue',
|
| 91 |
+
'lightyellow',
|
| 92 |
+
'lime',
|
| 93 |
+
'limegreen',
|
| 94 |
+
'linen',
|
| 95 |
+
'magenta',
|
| 96 |
+
'maroon',
|
| 97 |
+
'mediumaquamarine',
|
| 98 |
+
'mediumblue',
|
| 99 |
+
'mediumorchid',
|
| 100 |
+
'mediumpurple',
|
| 101 |
+
'mediumseagreen',
|
| 102 |
+
'mediumslateblue',
|
| 103 |
+
'mediumspringgreen',
|
| 104 |
+
'mediumturquoise',
|
| 105 |
+
'mediumvioletred',
|
| 106 |
+
'midnightblue',
|
| 107 |
+
'mintcream',
|
| 108 |
+
'mistyrose',
|
| 109 |
+
'moccasin',
|
| 110 |
+
'navajowhite',
|
| 111 |
+
'navy',
|
| 112 |
+
'oldlace',
|
| 113 |
+
'olive',
|
| 114 |
+
'olivedrab',
|
| 115 |
+
'orange',
|
| 116 |
+
'orangered',
|
| 117 |
+
'orchid',
|
| 118 |
+
'palegoldenrod',
|
| 119 |
+
'palegreen',
|
| 120 |
+
'paleturquoise',
|
| 121 |
+
'palevioletred',
|
| 122 |
+
'papayawhip',
|
| 123 |
+
'peachpuff',
|
| 124 |
+
'peru',
|
| 125 |
+
'pink',
|
| 126 |
+
'plum',
|
| 127 |
+
'powderblue',
|
| 128 |
+
'purple',
|
| 129 |
+
'red',
|
| 130 |
+
'rosybrown',
|
| 131 |
+
'royalblue',
|
| 132 |
+
'saddlebrown',
|
| 133 |
+
'salmon',
|
| 134 |
+
'sandybrown',
|
| 135 |
+
'seagreen',
|
| 136 |
+
'seashell',
|
| 137 |
+
'sienna',
|
| 138 |
+
'silver',
|
| 139 |
+
'skyblue',
|
| 140 |
+
'slateblue',
|
| 141 |
+
'slategray',
|
| 142 |
+
'slategrey',
|
| 143 |
+
'snow',
|
| 144 |
+
'springgreen',
|
| 145 |
+
'steelblue',
|
| 146 |
+
'tan',
|
| 147 |
+
'teal',
|
| 148 |
+
'thistle',
|
| 149 |
+
'tomato',
|
| 150 |
+
'turquoise',
|
| 151 |
+
'violet',
|
| 152 |
+
'wheat',
|
| 153 |
+
'white',
|
| 154 |
+
'whitesmoke',
|
| 155 |
+
'yellow',
|
| 156 |
+
'yellowgreen',])
|
falcon/lib/python3.10/site-packages/svgwrite/data/full11.py
ADDED
|
@@ -0,0 +1,1405 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: full11 data
|
| 5 |
+
# Created: 15.10.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
from svgwrite.data.types import SVGAttribute, SVGMultiAttribute
|
| 10 |
+
from svgwrite.data.types import SVGElement
|
| 11 |
+
from svgwrite.data.typechecker import Full11TypeChecker as TypeChecker
|
| 12 |
+
|
| 13 |
+
empty_list = []
|
| 14 |
+
|
| 15 |
+
attributes = {
|
| 16 |
+
'accent-height': SVGAttribute('accent-height', anim=False,
|
| 17 |
+
types=frozenset(['number']),
|
| 18 |
+
const=empty_list),
|
| 19 |
+
'accumulate': SVGAttribute('accumulate', anim=False,
|
| 20 |
+
types=empty_list,
|
| 21 |
+
const=frozenset(['none', 'sum'])),
|
| 22 |
+
'additive': SVGAttribute('additive', anim=False,
|
| 23 |
+
types=empty_list,
|
| 24 |
+
const=frozenset(['sum', 'replace'])),
|
| 25 |
+
'alignment-baseline': SVGAttribute('alignment-baseline', anim=True,
|
| 26 |
+
types=empty_list,
|
| 27 |
+
const=frozenset(['mathematical', 'before-edge', 'central', 'baseline',
|
| 28 |
+
'auto', 'hanging', 'ideographic', 'inherit', 'middle',
|
| 29 |
+
'alphabetic', 'text-before-edge', 'text-after-edge',
|
| 30 |
+
'after-edge'])),
|
| 31 |
+
'alphabetic': SVGAttribute('alphabetic', anim=False,
|
| 32 |
+
types=frozenset(['number']),
|
| 33 |
+
const=empty_list),
|
| 34 |
+
'amplitude': SVGAttribute('amplitude', anim=True,
|
| 35 |
+
types=frozenset(['number']),
|
| 36 |
+
const=empty_list),
|
| 37 |
+
'arabic-form': SVGAttribute('arabic-form', anim=False,
|
| 38 |
+
types=empty_list,
|
| 39 |
+
const=frozenset(['terminal', 'initial', 'isolated', 'medial'])),
|
| 40 |
+
'ascent': SVGAttribute('ascent', anim=False,
|
| 41 |
+
types=frozenset(['number']),
|
| 42 |
+
const=empty_list),
|
| 43 |
+
'attributeName': SVGAttribute('attributeName', anim=False,
|
| 44 |
+
types=frozenset(['name']),
|
| 45 |
+
const=empty_list),
|
| 46 |
+
'attributeType': SVGAttribute('attributeType', anim=False,
|
| 47 |
+
types=empty_list,
|
| 48 |
+
const=frozenset(['XML', 'auto', 'CSS'])),
|
| 49 |
+
'azimuth': SVGAttribute('azimuth', anim=True,
|
| 50 |
+
types=frozenset(['number']),
|
| 51 |
+
const=empty_list),
|
| 52 |
+
'baseFrequency': SVGAttribute('baseFrequency', anim=True,
|
| 53 |
+
types=frozenset(['number-optional-number']),
|
| 54 |
+
const=empty_list),
|
| 55 |
+
'baseline-shift': SVGAttribute('baseline-shift', anim=True,
|
| 56 |
+
types=frozenset(['percentage', 'length']),
|
| 57 |
+
const=frozenset(['super', 'baseline', 'inherit', 'sub'])),
|
| 58 |
+
'baseProfile': SVGAttribute('baseProfile', anim=False,
|
| 59 |
+
types=empty_list,
|
| 60 |
+
const=frozenset(['full', 'tiny', 'basic', 'none'])),
|
| 61 |
+
'bbox': SVGAttribute('bbox', anim=False,
|
| 62 |
+
types=frozenset(['string']),
|
| 63 |
+
const=empty_list),
|
| 64 |
+
'begin': SVGAttribute('begin', anim=True,
|
| 65 |
+
types=frozenset(['timing-value-list']),
|
| 66 |
+
const=frozenset(['indefinite'])),
|
| 67 |
+
'bias': SVGAttribute('bias', anim=True,
|
| 68 |
+
types=frozenset(['number']),
|
| 69 |
+
const=empty_list),
|
| 70 |
+
'by': SVGAttribute('by', anim=False,
|
| 71 |
+
types=frozenset(['string']),
|
| 72 |
+
const=empty_list),
|
| 73 |
+
'calcMode': SVGAttribute('calcMode', anim=False,
|
| 74 |
+
types=empty_list,
|
| 75 |
+
const=frozenset(['discrete', 'linear', 'paced', 'spline'])),
|
| 76 |
+
'cap-height': SVGAttribute('cap-height', anim=False,
|
| 77 |
+
types=frozenset(['number']),
|
| 78 |
+
const=empty_list),
|
| 79 |
+
'class': SVGAttribute('class', anim=True,
|
| 80 |
+
types=frozenset(['list-of-name']),
|
| 81 |
+
const=empty_list),
|
| 82 |
+
'clip': SVGAttribute('clip', anim=True,
|
| 83 |
+
types=frozenset(['shape']),
|
| 84 |
+
const=frozenset(['auto', 'inherit'])),
|
| 85 |
+
'clip-path': SVGAttribute('clip-path', anim=True,
|
| 86 |
+
types=frozenset(['IRI']),
|
| 87 |
+
const=frozenset(['none', 'inherit'])),
|
| 88 |
+
'clip-rule': SVGAttribute('clip-rule', anim=True,
|
| 89 |
+
types=empty_list,
|
| 90 |
+
const=frozenset(['nonzero', 'evenodd', 'inherit'])),
|
| 91 |
+
'clipPathUnits': SVGAttribute('clipPathUnits', anim=True,
|
| 92 |
+
types=empty_list,
|
| 93 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 94 |
+
'color': SVGAttribute('color', anim=True,
|
| 95 |
+
types=frozenset(['color']),
|
| 96 |
+
const=frozenset(['inherit'])),
|
| 97 |
+
'color-interpolation': SVGAttribute('color-interpolation', anim=True,
|
| 98 |
+
types=empty_list,
|
| 99 |
+
const=frozenset(['auto', 'sRGB', 'inherit', 'linearRGB'])),
|
| 100 |
+
'color-interpolation-filters': SVGAttribute('color-interpolation-filters', anim=True,
|
| 101 |
+
types=empty_list,
|
| 102 |
+
const=frozenset(['auto', 'sRGB', 'inherit', 'linearRGB'])),
|
| 103 |
+
'color-profile': SVGAttribute('color-profile', anim=True,
|
| 104 |
+
types=frozenset(['FuncIRI', 'name']),
|
| 105 |
+
const=frozenset(['auto', 'sRGB', 'inherit'])),
|
| 106 |
+
'color-rendering': SVGAttribute('color-rendering', anim=True,
|
| 107 |
+
types=empty_list,
|
| 108 |
+
const=frozenset(['auto', 'optimizeQuality', 'optimizeSpeed', 'inherit'])),
|
| 109 |
+
'contentScriptType': SVGAttribute('contentScriptType', anim=True,
|
| 110 |
+
types=frozenset(['string']),
|
| 111 |
+
const=empty_list),
|
| 112 |
+
'contentStyleType': SVGAttribute('contentStyleType', anim=True,
|
| 113 |
+
types=frozenset(['string']),
|
| 114 |
+
const=empty_list),
|
| 115 |
+
'cursor': SVGAttribute('cursor', anim=True,
|
| 116 |
+
types=frozenset(['list-of-FuncIRI']),
|
| 117 |
+
const=frozenset(['sw-resize', 'n-resize', 'help', 'text', 'move', 'auto',
|
| 118 |
+
'w-resize', 'pointer', 'wait', 's-resize', 'e-resize',
|
| 119 |
+
'default', 'inherit', 'nw-resize', 'ne-resize',
|
| 120 |
+
'crosshair', 'se-resize'])),
|
| 121 |
+
'cx': SVGAttribute('cx', anim=True,
|
| 122 |
+
types=frozenset(['coordinate']),
|
| 123 |
+
const=empty_list),
|
| 124 |
+
'cy': SVGAttribute('cy', anim=True,
|
| 125 |
+
types=frozenset(['coordinate']),
|
| 126 |
+
const=empty_list),
|
| 127 |
+
'd': SVGMultiAttribute({
|
| 128 |
+
'* path': SVGAttribute( # '*' means default attribute
|
| 129 |
+
'd', anim=True,
|
| 130 |
+
types=frozenset(['path-data']),
|
| 131 |
+
const=empty_list
|
| 132 |
+
),
|
| 133 |
+
'glyph missing-glyph': SVGAttribute(
|
| 134 |
+
'd', anim=False,
|
| 135 |
+
types=frozenset(['path-data']),
|
| 136 |
+
const=empty_list
|
| 137 |
+
),
|
| 138 |
+
}),
|
| 139 |
+
'descent': SVGAttribute('descent', anim=False,
|
| 140 |
+
types=frozenset(['number']),
|
| 141 |
+
const=empty_list),
|
| 142 |
+
'diffuseConstant': SVGAttribute('diffuseConstant', anim=True,
|
| 143 |
+
types=frozenset(['number']),
|
| 144 |
+
const=empty_list),
|
| 145 |
+
'direction': SVGAttribute('direction', anim=False,
|
| 146 |
+
types=empty_list,
|
| 147 |
+
const=frozenset(['ltr', 'inherit', 'rtl'])),
|
| 148 |
+
'display': SVGAttribute('display', anim=True,
|
| 149 |
+
types=empty_list,
|
| 150 |
+
const=frozenset(['inline-table', 'table-header-group', 'table-footer-group',
|
| 151 |
+
'none', 'table-row', 'table-caption', 'table-column',
|
| 152 |
+
'marker', 'table', 'compact', 'table-row-group', 'run-in',
|
| 153 |
+
'inherit', 'list-item', 'table-cell', 'inline',
|
| 154 |
+
'block', 'table-column-group'])),
|
| 155 |
+
'divisor': SVGAttribute('divisor', anim=True,
|
| 156 |
+
types=frozenset(['number']),
|
| 157 |
+
const=empty_list),
|
| 158 |
+
'dominant-baseline': SVGAttribute('dominant-baseline', anim=True,
|
| 159 |
+
types=empty_list,
|
| 160 |
+
const=frozenset(['mathematical', 'use-script', 'ideographic', 'central',
|
| 161 |
+
'reset-size', 'auto', 'hanging', 'inherit', 'middle',
|
| 162 |
+
'alphabetic', 'text-before-edge', 'text-after-edge',
|
| 163 |
+
'no-change'])),
|
| 164 |
+
'dur': SVGAttribute('dur', anim=True,
|
| 165 |
+
types=frozenset(['time']),
|
| 166 |
+
const=frozenset(['media', 'indefinite'])),
|
| 167 |
+
'dx': SVGMultiAttribute({
|
| 168 |
+
'* altGlyph text tref tspan': SVGAttribute(
|
| 169 |
+
'dx', anim=True,
|
| 170 |
+
types=frozenset(['list-of-length']),
|
| 171 |
+
const=empty_list),
|
| 172 |
+
'feOffset': SVGAttribute(
|
| 173 |
+
'dx', anim=True,
|
| 174 |
+
types=frozenset(['number']),
|
| 175 |
+
const=empty_list),
|
| 176 |
+
'glyphRef': SVGAttribute(
|
| 177 |
+
'dx', anim=False,
|
| 178 |
+
types=frozenset(['number']),
|
| 179 |
+
const=empty_list),
|
| 180 |
+
}),
|
| 181 |
+
'dy': SVGMultiAttribute({
|
| 182 |
+
'* altGlyph text tref tspan': SVGAttribute(
|
| 183 |
+
'dy', anim=True,
|
| 184 |
+
types=frozenset(['list-of-length']),
|
| 185 |
+
const=empty_list),
|
| 186 |
+
'feOffset': SVGAttribute(
|
| 187 |
+
'dy', anim=True,
|
| 188 |
+
types=frozenset(['number']),
|
| 189 |
+
const=empty_list),
|
| 190 |
+
'glyphRef': SVGAttribute(
|
| 191 |
+
'dy', anim=False,
|
| 192 |
+
types=frozenset(['number']),
|
| 193 |
+
const=empty_list),
|
| 194 |
+
}),
|
| 195 |
+
'edgeMode': SVGAttribute('edgeMode', anim=True,
|
| 196 |
+
types=empty_list,
|
| 197 |
+
const=frozenset(['wrap', 'duplicate', 'none'])),
|
| 198 |
+
'elevation': SVGAttribute('elevation', anim=True,
|
| 199 |
+
types=frozenset(['number']),
|
| 200 |
+
const=empty_list),
|
| 201 |
+
'enable-background': SVGAttribute('enable-background', anim=True,
|
| 202 |
+
types=frozenset(['string']),
|
| 203 |
+
const=frozenset(['accummulate', 'new', 'inherit'])),
|
| 204 |
+
'end': SVGAttribute('end', anim=False,
|
| 205 |
+
types=frozenset(['timing-value-list']),
|
| 206 |
+
const=frozenset(['indefinite'])),
|
| 207 |
+
'exponent': SVGAttribute('exponent', anim=True,
|
| 208 |
+
types=frozenset(['number']),
|
| 209 |
+
const=empty_list),
|
| 210 |
+
'externalResourcesRequired': SVGAttribute('externalResourcesRequired', anim=True,
|
| 211 |
+
types=empty_list,
|
| 212 |
+
const=frozenset(['true', 'false'])),
|
| 213 |
+
'fill': SVGMultiAttribute({
|
| 214 |
+
'*': SVGAttribute(
|
| 215 |
+
'fill', anim=True,
|
| 216 |
+
types=frozenset(['paint']),
|
| 217 |
+
const=empty_list),
|
| 218 |
+
'set animateMotion animate animateColor animateTransform': SVGAttribute(
|
| 219 |
+
'fill', anim=False,
|
| 220 |
+
types=empty_list,
|
| 221 |
+
const=frozenset(['freeze', 'remove']))
|
| 222 |
+
}),
|
| 223 |
+
'fill-opacity': SVGAttribute('fill-opacity', anim=True,
|
| 224 |
+
types=frozenset(['number']),
|
| 225 |
+
const=frozenset(['inherit'])),
|
| 226 |
+
'fill-rule': SVGAttribute('fill-rule', anim=True,
|
| 227 |
+
types=empty_list,
|
| 228 |
+
const=frozenset(['nonzero', 'evenodd', 'inherit'])),
|
| 229 |
+
'filter': SVGAttribute('filter', anim=True,
|
| 230 |
+
types=frozenset(['FuncIRI']),
|
| 231 |
+
const=frozenset(['none', 'inherit'])),
|
| 232 |
+
'filterRes': SVGAttribute('filterRes', anim=True,
|
| 233 |
+
types=frozenset(['number-optional-number']),
|
| 234 |
+
const=empty_list),
|
| 235 |
+
'filterUnits': SVGAttribute('filterUnits', anim=True,
|
| 236 |
+
types=empty_list,
|
| 237 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 238 |
+
'flood-color': SVGAttribute('flood-color', anim=True,
|
| 239 |
+
types=frozenset(['color', 'icccolor']),
|
| 240 |
+
const=frozenset(['currentColor', 'inherit'])),
|
| 241 |
+
'flood-opacity': SVGAttribute('flood-opacity', anim=True,
|
| 242 |
+
types=frozenset(['number']),
|
| 243 |
+
const=frozenset(['inherit'])),
|
| 244 |
+
'font': SVGAttribute('font', anim=True,
|
| 245 |
+
types=frozenset(['string']),
|
| 246 |
+
const=empty_list),
|
| 247 |
+
'font-family': SVGAttribute('font-family', anim=False,
|
| 248 |
+
types=frozenset(['string']),
|
| 249 |
+
const=empty_list),
|
| 250 |
+
'font-size': SVGAttribute('font-size', anim=False,
|
| 251 |
+
types=frozenset(['length']),
|
| 252 |
+
const=frozenset(['inherit'])),
|
| 253 |
+
'font-size-adjust': SVGAttribute('font-size-adjust', anim=True,
|
| 254 |
+
types=frozenset(['number']),
|
| 255 |
+
const=frozenset(['none', 'inherit'])),
|
| 256 |
+
'font-stretch': SVGAttribute('font-stretch', anim=False,
|
| 257 |
+
types=empty_list,
|
| 258 |
+
const=frozenset(['condensed', 'normal', 'ultra-condensed', 'expanded',
|
| 259 |
+
'narrower', 'inherit', 'semi-condensed', 'extra-condensed',
|
| 260 |
+
'ultra-expanded', 'wider', 'semi-expanded', 'extra-expanded'])),
|
| 261 |
+
'font-style': SVGAttribute('font-style', anim=False,
|
| 262 |
+
types=empty_list,
|
| 263 |
+
const=frozenset(['oblique', 'inherit', 'italic', 'normal'])),
|
| 264 |
+
'font-variant': SVGAttribute('font-variant', anim=False,
|
| 265 |
+
types=empty_list,
|
| 266 |
+
const=frozenset(['small-caps', 'inherit', 'normal'])),
|
| 267 |
+
'font-weight': SVGAttribute('font-weight', anim=False,
|
| 268 |
+
types=empty_list,
|
| 269 |
+
const=frozenset(['200', '900', 'bold', 'bolder', 'normal', '300', '700',
|
| 270 |
+
'inherit', 'lighter', '400', '100', '800', '500', '600'])),
|
| 271 |
+
'format': SVGAttribute('format', anim=False,
|
| 272 |
+
types=frozenset(['string']),
|
| 273 |
+
const=empty_list),
|
| 274 |
+
'from': SVGAttribute('from', anim=False,
|
| 275 |
+
types=frozenset(['string']),
|
| 276 |
+
const=empty_list),
|
| 277 |
+
'fx': SVGAttribute('fx', anim=True,
|
| 278 |
+
types=frozenset(['coordinate']),
|
| 279 |
+
const=empty_list),
|
| 280 |
+
'fy': SVGAttribute('fy', anim=True,
|
| 281 |
+
types=frozenset(['coordinate']),
|
| 282 |
+
const=empty_list),
|
| 283 |
+
'g1': SVGAttribute('g1', anim=False,
|
| 284 |
+
types=frozenset(['list-of-name']),
|
| 285 |
+
const=empty_list),
|
| 286 |
+
'g2': SVGAttribute('g2', anim=False,
|
| 287 |
+
types=frozenset(['list-of-name']),
|
| 288 |
+
const=empty_list),
|
| 289 |
+
'glyph-name': SVGAttribute('glyph-name', anim=False,
|
| 290 |
+
types=frozenset(['list-of-name']),
|
| 291 |
+
const=empty_list),
|
| 292 |
+
'glyph-orientation-horizontal': SVGAttribute('glyph-orientation-horizontal', anim=True,
|
| 293 |
+
types=frozenset(['angle']),
|
| 294 |
+
const=frozenset(['inherit'])),
|
| 295 |
+
'glyph-orientation-vertical': SVGAttribute('glyph-orientation-vertical', anim=True,
|
| 296 |
+
types=frozenset(['angle']),
|
| 297 |
+
const=frozenset(['auto', 'inherit'])),
|
| 298 |
+
'glyphRef': SVGAttribute('glyphRef', anim=False,
|
| 299 |
+
types=frozenset(['string']),
|
| 300 |
+
const=empty_list),
|
| 301 |
+
'gradientTransform': SVGAttribute('gradientTransform', anim=True,
|
| 302 |
+
types=frozenset(['transform-list']),
|
| 303 |
+
const=empty_list),
|
| 304 |
+
'gradientUnits': SVGAttribute('gradientUnits', anim=True,
|
| 305 |
+
types=empty_list,
|
| 306 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 307 |
+
'hanging': SVGAttribute('hanging', anim=False,
|
| 308 |
+
types=frozenset(['number']),
|
| 309 |
+
const=empty_list),
|
| 310 |
+
'height': SVGAttribute('height', anim=True,
|
| 311 |
+
types=frozenset(['length']),
|
| 312 |
+
const=empty_list),
|
| 313 |
+
'horiz-adv-x': SVGAttribute('horiz-adv-x', anim=False,
|
| 314 |
+
types=frozenset(['number']),
|
| 315 |
+
const=empty_list),
|
| 316 |
+
'horiz-origin-x': SVGAttribute('horiz-origin-x', anim=False,
|
| 317 |
+
types=frozenset(['number']),
|
| 318 |
+
const=empty_list),
|
| 319 |
+
'horiz-origin-y': SVGAttribute('horiz-origin-y', anim=False,
|
| 320 |
+
types=frozenset(['number']),
|
| 321 |
+
const=empty_list),
|
| 322 |
+
'id': SVGAttribute('id', anim=False,
|
| 323 |
+
types=frozenset(['name']),
|
| 324 |
+
const=empty_list),
|
| 325 |
+
'ideographic': SVGAttribute('ideographic', anim=False,
|
| 326 |
+
types=frozenset(['number']),
|
| 327 |
+
const=empty_list),
|
| 328 |
+
'image-rendering': SVGAttribute('image-rendering', anim=True,
|
| 329 |
+
types=empty_list,
|
| 330 |
+
const=frozenset(['auto', 'optimizeQuality', 'optimizeSpeed', 'inherit'])),
|
| 331 |
+
'in': SVGAttribute('in', anim=True,
|
| 332 |
+
types=frozenset(['name']),
|
| 333 |
+
const=frozenset(['SourceAlpha', 'SourceGraphic', 'BackgroundAlpha',
|
| 334 |
+
'BackgroundImage', 'StrokePaint', 'FillPaint'])),
|
| 335 |
+
'in2': SVGAttribute('in2', anim=True,
|
| 336 |
+
types=frozenset(['name']),
|
| 337 |
+
const=frozenset(['SourceAlpha', 'SourceGraphic', 'BackgroundAlpha',
|
| 338 |
+
'BackgroundImage', 'StrokePaint', 'FillPaint'])),
|
| 339 |
+
'intercept': SVGAttribute('intercept', anim=True,
|
| 340 |
+
types=frozenset(['number']),
|
| 341 |
+
const=empty_list),
|
| 342 |
+
'k': SVGAttribute('k', anim=False,
|
| 343 |
+
types=frozenset(['number']),
|
| 344 |
+
const=empty_list),
|
| 345 |
+
'k1': SVGAttribute('k1', anim=True,
|
| 346 |
+
types=frozenset(['number']),
|
| 347 |
+
const=empty_list),
|
| 348 |
+
'k2': SVGAttribute('k2', anim=True,
|
| 349 |
+
types=frozenset(['number']),
|
| 350 |
+
const=empty_list),
|
| 351 |
+
'k3': SVGAttribute('k3', anim=True,
|
| 352 |
+
types=frozenset(['number']),
|
| 353 |
+
const=empty_list),
|
| 354 |
+
'k4': SVGAttribute('k4', anim=True,
|
| 355 |
+
types=frozenset(['number']),
|
| 356 |
+
const=empty_list),
|
| 357 |
+
'kernelMatrix': SVGAttribute('kernelMatrix', anim=True,
|
| 358 |
+
types=frozenset(['list-of-number']),
|
| 359 |
+
const=empty_list),
|
| 360 |
+
'kernelUnitLength': SVGAttribute('kernelUnitLength', anim=True,
|
| 361 |
+
types=frozenset(['number-optional-number']),
|
| 362 |
+
const=empty_list),
|
| 363 |
+
'kerning': SVGAttribute('kerning', anim=True,
|
| 364 |
+
types=frozenset(['length']),
|
| 365 |
+
const=frozenset(['auto', 'inherit'])),
|
| 366 |
+
'keyPoints': SVGAttribute('keyPoints', anim=False,
|
| 367 |
+
types=frozenset(['semicolon-list']),
|
| 368 |
+
const=empty_list),
|
| 369 |
+
'keySplines': SVGAttribute('keySplines', anim=False,
|
| 370 |
+
types=frozenset(['semicolon-list']),
|
| 371 |
+
const=empty_list),
|
| 372 |
+
'keyTimes': SVGAttribute('keyTimes', anim=False,
|
| 373 |
+
types=frozenset(['semicolon-list']),
|
| 374 |
+
const=empty_list),
|
| 375 |
+
'lang': SVGAttribute('lang', anim=False,
|
| 376 |
+
types=frozenset(['name']),
|
| 377 |
+
const=empty_list),
|
| 378 |
+
'lengthAdjust': SVGAttribute('lengthAdjust', anim=True,
|
| 379 |
+
types=empty_list,
|
| 380 |
+
const=frozenset(['spacingAndGlyphs', 'spacing'])),
|
| 381 |
+
'letter-spacing': SVGAttribute('letter-spacing', anim=True,
|
| 382 |
+
types=frozenset(['length']),
|
| 383 |
+
const=frozenset(['inherit', 'normal'])),
|
| 384 |
+
'lighting-color': SVGAttribute('lighting-color', anim=True,
|
| 385 |
+
types=frozenset(['color', 'icccolor']),
|
| 386 |
+
const=frozenset(['currentColor', 'inherit'])),
|
| 387 |
+
'limitingConeAngle': SVGAttribute('limitingConeAngle', anim=True,
|
| 388 |
+
types=frozenset(['number']),
|
| 389 |
+
const=empty_list),
|
| 390 |
+
'local': SVGAttribute('local', anim=True,
|
| 391 |
+
types=frozenset(['string']),
|
| 392 |
+
const=empty_list),
|
| 393 |
+
'marker': SVGAttribute('marker', anim=True,
|
| 394 |
+
types=frozenset(['FuncIRI']),
|
| 395 |
+
const=frozenset(['none', 'inherit'])),
|
| 396 |
+
'marker-end': SVGAttribute('marker-end', anim=True,
|
| 397 |
+
types=frozenset(['FuncIRI']),
|
| 398 |
+
const=frozenset(['none', 'inherit'])),
|
| 399 |
+
'marker-mid': SVGAttribute('marker-mid', anim=True,
|
| 400 |
+
types=frozenset(['FuncIRI']),
|
| 401 |
+
const=frozenset(['none', 'inherit'])),
|
| 402 |
+
'marker-start': SVGAttribute('marker-start', anim=True,
|
| 403 |
+
types=frozenset(['FuncIRI']),
|
| 404 |
+
const=frozenset(['none', 'inherit'])),
|
| 405 |
+
'markerHeight': SVGAttribute('markerHeight', anim=True,
|
| 406 |
+
types=frozenset(['length']),
|
| 407 |
+
const=empty_list),
|
| 408 |
+
'markerUnits': SVGAttribute('markerUnits', anim=True,
|
| 409 |
+
types=empty_list,
|
| 410 |
+
const=frozenset(['userSpaceOnUse', 'strokeWidth'])),
|
| 411 |
+
'markerWidth': SVGAttribute('markerWidth', anim=True,
|
| 412 |
+
types=frozenset(['length']),
|
| 413 |
+
const=empty_list),
|
| 414 |
+
'mask': SVGAttribute('mask', anim=True,
|
| 415 |
+
types=frozenset(['FuncIRI']),
|
| 416 |
+
const=frozenset(['none', 'inherit'])),
|
| 417 |
+
'maskContentUnits': SVGAttribute('maskContentUnits', anim=True,
|
| 418 |
+
types=empty_list,
|
| 419 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 420 |
+
'maskUnits': SVGAttribute('maskUnits', anim=True,
|
| 421 |
+
types=empty_list,
|
| 422 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 423 |
+
'mathematical': SVGAttribute('mathematical', anim=False,
|
| 424 |
+
types=frozenset(['number']),
|
| 425 |
+
const=empty_list),
|
| 426 |
+
'max': SVGAttribute('max', anim=False,
|
| 427 |
+
types=frozenset(['time']),
|
| 428 |
+
const=frozenset(['media'])),
|
| 429 |
+
'media': SVGAttribute('media', anim=False,
|
| 430 |
+
types=empty_list,
|
| 431 |
+
const=frozenset(['all', 'aureal', 'braille', 'embossed', 'handheld', 'print',
|
| 432 |
+
'projection', 'screen', 'tty', 'tv'])),
|
| 433 |
+
'method': SVGAttribute('method', anim=True,
|
| 434 |
+
types=empty_list,
|
| 435 |
+
const=frozenset(['stretch', 'align'])),
|
| 436 |
+
'min': SVGAttribute('min', anim=False,
|
| 437 |
+
types=frozenset(['time']),
|
| 438 |
+
const=frozenset(['media'])),
|
| 439 |
+
'mode': SVGAttribute('mode', anim=True,
|
| 440 |
+
types=empty_list,
|
| 441 |
+
const=frozenset(['multiply', 'screen', 'darken', 'lighten', 'normal'])),
|
| 442 |
+
'name': SVGMultiAttribute({
|
| 443 |
+
'* font-face-name': SVGAttribute(
|
| 444 |
+
'name', anim=False,
|
| 445 |
+
types=frozenset(['anything']),
|
| 446 |
+
const=empty_list),
|
| 447 |
+
'color-profile': SVGAttribute(
|
| 448 |
+
'name', anim=False,
|
| 449 |
+
types=frozenset(['name']),
|
| 450 |
+
const=empty_list),
|
| 451 |
+
}),
|
| 452 |
+
'numOctaves': SVGAttribute('numOctaves', anim=True,
|
| 453 |
+
types=frozenset(['integer']),
|
| 454 |
+
const=empty_list),
|
| 455 |
+
'offset': SVGMultiAttribute({
|
| 456 |
+
'*': SVGAttribute(
|
| 457 |
+
'offset', anim=True,
|
| 458 |
+
types=frozenset(['number']),
|
| 459 |
+
const=empty_list),
|
| 460 |
+
'stop': SVGAttribute(
|
| 461 |
+
'offset', anim=True,
|
| 462 |
+
types=frozenset(['number', 'percentage']),
|
| 463 |
+
const=empty_list),
|
| 464 |
+
}),
|
| 465 |
+
'onabort': SVGAttribute('onabort', anim=False,
|
| 466 |
+
types=frozenset(['anything']),
|
| 467 |
+
const=empty_list),
|
| 468 |
+
'onactivate': SVGAttribute('onactivate', anim=False,
|
| 469 |
+
types=frozenset(['anything']),
|
| 470 |
+
const=empty_list),
|
| 471 |
+
'onbegin': SVGAttribute('onbegin', anim=False,
|
| 472 |
+
types=frozenset(['anything']),
|
| 473 |
+
const=empty_list),
|
| 474 |
+
'onclick': SVGAttribute('onclick', anim=False,
|
| 475 |
+
types=frozenset(['anything']),
|
| 476 |
+
const=empty_list),
|
| 477 |
+
'onend': SVGAttribute('onend', anim=True,
|
| 478 |
+
types=frozenset(['anything']),
|
| 479 |
+
const=empty_list),
|
| 480 |
+
'onerror': SVGAttribute('onerror', anim=False,
|
| 481 |
+
types=frozenset(['anything']),
|
| 482 |
+
const=empty_list),
|
| 483 |
+
'onfocusin': SVGAttribute('onfocusin', anim=False,
|
| 484 |
+
types=frozenset(['anything']),
|
| 485 |
+
const=empty_list),
|
| 486 |
+
'onfocusout': SVGAttribute('onfocusout', anim=False,
|
| 487 |
+
types=frozenset(['anything']),
|
| 488 |
+
const=empty_list),
|
| 489 |
+
'onload': SVGAttribute('onload', anim=False,
|
| 490 |
+
types=frozenset(['anything']),
|
| 491 |
+
const=empty_list),
|
| 492 |
+
'onmousedown': SVGAttribute('onmousedown', anim=False,
|
| 493 |
+
types=frozenset(['anything']),
|
| 494 |
+
const=empty_list),
|
| 495 |
+
'onmousemove': SVGAttribute('onmousemove', anim=False,
|
| 496 |
+
types=frozenset(['anything']),
|
| 497 |
+
const=empty_list),
|
| 498 |
+
'onmouseout': SVGAttribute('onmouseout', anim=False,
|
| 499 |
+
types=frozenset(['anything']),
|
| 500 |
+
const=empty_list),
|
| 501 |
+
'onmouseover': SVGAttribute('onmouseover', anim=False,
|
| 502 |
+
types=frozenset(['anything']),
|
| 503 |
+
const=empty_list),
|
| 504 |
+
'onmouseup': SVGAttribute('onmouseup', anim=False,
|
| 505 |
+
types=frozenset(['anything']),
|
| 506 |
+
const=empty_list),
|
| 507 |
+
'onrepeat': SVGAttribute('onrepeat', anim=False,
|
| 508 |
+
types=frozenset(['anything']),
|
| 509 |
+
const=empty_list),
|
| 510 |
+
'onresize': SVGAttribute('onresize', anim=False,
|
| 511 |
+
types=frozenset(['anything']),
|
| 512 |
+
const=empty_list),
|
| 513 |
+
'onscroll': SVGAttribute('onscroll', anim=False,
|
| 514 |
+
types=frozenset(['anything']),
|
| 515 |
+
const=empty_list),
|
| 516 |
+
'onunload': SVGAttribute('onunload', anim=False,
|
| 517 |
+
types=frozenset(['anything']),
|
| 518 |
+
const=empty_list),
|
| 519 |
+
'onzoom': SVGAttribute('onzoom', anim=False,
|
| 520 |
+
types=frozenset(['anything']),
|
| 521 |
+
const=empty_list),
|
| 522 |
+
'opacity': SVGAttribute('opacity', anim=True,
|
| 523 |
+
types=frozenset(['number']),
|
| 524 |
+
const=frozenset(['inherit'])),
|
| 525 |
+
'operator': SVGMultiAttribute({
|
| 526 |
+
'* feComposite': SVGAttribute(
|
| 527 |
+
'operator', anim=True,
|
| 528 |
+
types=empty_list,
|
| 529 |
+
const=frozenset(['xor', 'in', 'over', 'atop', 'arithmetic', 'out'])),
|
| 530 |
+
'feMorphology': SVGAttribute(
|
| 531 |
+
'operator', anim=True,
|
| 532 |
+
types=empty_list,
|
| 533 |
+
const=frozenset(['erode', 'dilate'])),
|
| 534 |
+
}),
|
| 535 |
+
'order': SVGAttribute('order', anim=True,
|
| 536 |
+
types=frozenset(['number-optional-number']),
|
| 537 |
+
const=empty_list),
|
| 538 |
+
'orient': SVGAttribute('orient', anim=True,
|
| 539 |
+
types=frozenset(['angle']),
|
| 540 |
+
const=frozenset(['auto'])),
|
| 541 |
+
'orientation': SVGAttribute('orientation', anim=False,
|
| 542 |
+
types=empty_list,
|
| 543 |
+
const=frozenset(['h', 'v'])),
|
| 544 |
+
'origin': SVGAttribute('origin', anim=False,
|
| 545 |
+
types=empty_list,
|
| 546 |
+
const=frozenset(['default'])),
|
| 547 |
+
'overflow': SVGAttribute('overflow', anim=True,
|
| 548 |
+
types=empty_list,
|
| 549 |
+
const=frozenset(['visible', 'hidden', 'scroll', 'inherit', 'auto'])),
|
| 550 |
+
'overline-position': SVGAttribute('overline-position', anim=False,
|
| 551 |
+
types=frozenset(['number']),
|
| 552 |
+
const=empty_list),
|
| 553 |
+
'overline-thickness': SVGAttribute('overline-thickness', anim=False,
|
| 554 |
+
types=frozenset(['number']),
|
| 555 |
+
const=empty_list),
|
| 556 |
+
'panose-1': SVGAttribute('panose-1', anim=False,
|
| 557 |
+
types=frozenset(['list-of-integer']),
|
| 558 |
+
const=empty_list),
|
| 559 |
+
'path': SVGAttribute('path', anim=False,
|
| 560 |
+
types=frozenset(['path-data']),
|
| 561 |
+
const=empty_list),
|
| 562 |
+
'pathLength': SVGAttribute('pathLength', anim=True,
|
| 563 |
+
types=frozenset(['number']),
|
| 564 |
+
const=empty_list),
|
| 565 |
+
'patternContentUnits': SVGAttribute('patternContentUnits', anim=True,
|
| 566 |
+
types=empty_list,
|
| 567 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 568 |
+
'patternTransform': SVGAttribute('patternTransform', anim=True,
|
| 569 |
+
types=frozenset(['transform-list']),
|
| 570 |
+
const=empty_list),
|
| 571 |
+
'patternUnits': SVGAttribute('patternUnits', anim=True,
|
| 572 |
+
types=empty_list,
|
| 573 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 574 |
+
'pointer-events': SVGAttribute('pointer-events', anim=True,
|
| 575 |
+
types=empty_list,
|
| 576 |
+
const=frozenset(['all', 'visibleStroke', 'painted', 'none', 'visibleFill',
|
| 577 |
+
'visible', 'stroke', 'inherit', 'visiblePainted', 'fill'])),
|
| 578 |
+
'points': SVGAttribute('points', anim=True,
|
| 579 |
+
types=frozenset(['list-of-points']),
|
| 580 |
+
const=empty_list),
|
| 581 |
+
'pointsAtX': SVGAttribute('pointsAtX', anim=True,
|
| 582 |
+
types=frozenset(['number']),
|
| 583 |
+
const=empty_list),
|
| 584 |
+
'pointsAtY': SVGAttribute('pointsAtY', anim=True,
|
| 585 |
+
types=frozenset(['number']),
|
| 586 |
+
const=empty_list),
|
| 587 |
+
'pointsAtZ': SVGAttribute('pointsAtZ', anim=True,
|
| 588 |
+
types=frozenset(['number']),
|
| 589 |
+
const=empty_list),
|
| 590 |
+
'preserveAlpha': SVGAttribute('preserveAlpha', anim=True,
|
| 591 |
+
types=empty_list,
|
| 592 |
+
const=frozenset(['true', 'false'])),
|
| 593 |
+
'preserveAspectRatio': SVGAttribute('preserveAspectRatio', anim=True,
|
| 594 |
+
types=frozenset('string'),
|
| 595 |
+
const=empty_list),
|
| 596 |
+
'primitiveUnits': SVGAttribute('primitiveUnits', anim=True,
|
| 597 |
+
types=empty_list,
|
| 598 |
+
const=frozenset(['userSpaceOnUse', 'objectBoundingBox'])),
|
| 599 |
+
'r': SVGAttribute('r', anim=True,
|
| 600 |
+
types=frozenset(['length']),
|
| 601 |
+
const=empty_list),
|
| 602 |
+
'radius': SVGAttribute('radius', anim=True,
|
| 603 |
+
types=frozenset(['number-optional-number']),
|
| 604 |
+
const=empty_list),
|
| 605 |
+
'refX': SVGAttribute('refX', anim=True,
|
| 606 |
+
types=frozenset(['coordinate']),
|
| 607 |
+
const=empty_list),
|
| 608 |
+
'refY': SVGAttribute('refY', anim=True,
|
| 609 |
+
types=frozenset(['coordinate']),
|
| 610 |
+
const=empty_list),
|
| 611 |
+
'rendering-intent': SVGAttribute('rendering-intent', anim=False,
|
| 612 |
+
types=empty_list,
|
| 613 |
+
const=frozenset(['auto', 'saturation', 'perceptual', 'relative-colorimetric',
|
| 614 |
+
'absolute-colorimetric'])),
|
| 615 |
+
'repeatCount': SVGAttribute('repeatCount', anim=False,
|
| 616 |
+
types=frozenset(['number']),
|
| 617 |
+
const=frozenset(['indefinite'])),
|
| 618 |
+
'repeatDur': SVGAttribute('repeatDur', anim=False,
|
| 619 |
+
types=frozenset(['time']),
|
| 620 |
+
const=frozenset(['indefinite'])),
|
| 621 |
+
'requiredExtensions': SVGAttribute('requiredExtensions', anim=False,
|
| 622 |
+
types=frozenset(['string']),
|
| 623 |
+
const=empty_list),
|
| 624 |
+
'requiredFeatures': SVGAttribute('requiredFeatures', anim=False,
|
| 625 |
+
types=frozenset(['string']),
|
| 626 |
+
const=empty_list),
|
| 627 |
+
'restart': SVGAttribute('restart', anim=False,
|
| 628 |
+
types=empty_list,
|
| 629 |
+
const=frozenset(['always', 'never', 'whenNotActive'])),
|
| 630 |
+
'result': SVGAttribute('result', anim=True,
|
| 631 |
+
types=frozenset(['list-of-name']),
|
| 632 |
+
const=empty_list),
|
| 633 |
+
'rotate': SVGMultiAttribute({
|
| 634 |
+
'* altGlyph text tref tspan': SVGAttribute(
|
| 635 |
+
'rotate', anim=True,
|
| 636 |
+
types=frozenset(['list-of-number']),
|
| 637 |
+
const=empty_list),
|
| 638 |
+
'animateMotion': SVGAttribute(
|
| 639 |
+
'rotate', anim=False,
|
| 640 |
+
types=frozenset(['number']),
|
| 641 |
+
const=frozenset(['auto', 'auto-reverse'])),
|
| 642 |
+
}),
|
| 643 |
+
'rx': SVGAttribute('rx', anim=True,
|
| 644 |
+
types=frozenset(['length']),
|
| 645 |
+
const=empty_list),
|
| 646 |
+
'ry': SVGAttribute('ry', anim=True,
|
| 647 |
+
types=frozenset(['length']),
|
| 648 |
+
const=empty_list),
|
| 649 |
+
'scale': SVGAttribute('scale', anim=True,
|
| 650 |
+
types=frozenset(['number']),
|
| 651 |
+
const=empty_list),
|
| 652 |
+
'seed': SVGAttribute('seed', anim=True,
|
| 653 |
+
types=frozenset(['number']),
|
| 654 |
+
const=empty_list),
|
| 655 |
+
'shape-rendering': SVGAttribute('shape-rendering', anim=True,
|
| 656 |
+
types=empty_list,
|
| 657 |
+
const=frozenset(['auto', 'optimizeSpeed', 'inherit', 'geometricPrecision',
|
| 658 |
+
'crispEdges'])),
|
| 659 |
+
'slope': SVGMultiAttribute({
|
| 660 |
+
'*': SVGAttribute(
|
| 661 |
+
'slope', anim=True,
|
| 662 |
+
types=frozenset(['number']),
|
| 663 |
+
const=empty_list),
|
| 664 |
+
'font-face': SVGAttribute(
|
| 665 |
+
'slope', anim=False,
|
| 666 |
+
types=frozenset(['number']),
|
| 667 |
+
const=empty_list),
|
| 668 |
+
}),
|
| 669 |
+
'spacing': SVGAttribute('spacing', anim=True,
|
| 670 |
+
types=empty_list,
|
| 671 |
+
const=frozenset(['auto', 'exact'])),
|
| 672 |
+
'specularConstant': SVGAttribute('specularConstant', anim=True,
|
| 673 |
+
types=frozenset(['number']),
|
| 674 |
+
const=empty_list),
|
| 675 |
+
'specularExponent': SVGAttribute('specularExponent', anim=True,
|
| 676 |
+
types=frozenset(['number']),
|
| 677 |
+
const=empty_list),
|
| 678 |
+
'spreadMethod': SVGAttribute('spreadMethod', anim=True,
|
| 679 |
+
types=empty_list,
|
| 680 |
+
const=frozenset(['reflect', 'repeat', 'pad'])),
|
| 681 |
+
'startOffset': SVGAttribute('startOffset', anim=True,
|
| 682 |
+
types=frozenset(['length']),
|
| 683 |
+
const=empty_list),
|
| 684 |
+
'stdDeviation': SVGAttribute('stdDeviation', anim=True,
|
| 685 |
+
types=frozenset(['number-optional-number']),
|
| 686 |
+
const=empty_list),
|
| 687 |
+
'stemh': SVGAttribute('stemh', anim=False,
|
| 688 |
+
types=frozenset(['number']),
|
| 689 |
+
const=empty_list),
|
| 690 |
+
'stemv': SVGAttribute('stemv', anim=False,
|
| 691 |
+
types=frozenset(['number']),
|
| 692 |
+
const=empty_list),
|
| 693 |
+
'stitchTiles': SVGAttribute('stitchTiles', anim=True,
|
| 694 |
+
types=empty_list,
|
| 695 |
+
const=frozenset(['noStitch', 'stitch'])),
|
| 696 |
+
'stop-color': SVGAttribute('stop-color', anim=True,
|
| 697 |
+
types=frozenset(['color', 'icccolor']),
|
| 698 |
+
const=frozenset(['currentColor', 'inherit'])),
|
| 699 |
+
'stop-opacity': SVGAttribute('stop-opacity', anim=True,
|
| 700 |
+
types=frozenset(['number']),
|
| 701 |
+
const=frozenset(['inherit'])),
|
| 702 |
+
'strikethrough-position': SVGAttribute('strikethrough-position', anim=False,
|
| 703 |
+
types=frozenset(['number']),
|
| 704 |
+
const=empty_list),
|
| 705 |
+
'strikethrough-thickness': SVGAttribute('strikethrough-thickness', anim=False,
|
| 706 |
+
types=frozenset(['number']),
|
| 707 |
+
const=empty_list),
|
| 708 |
+
'string': SVGAttribute('string', anim=False,
|
| 709 |
+
types=frozenset('anything'),
|
| 710 |
+
const=empty_list),
|
| 711 |
+
'stroke': SVGAttribute('stroke', anim=True,
|
| 712 |
+
types=frozenset(['paint']),
|
| 713 |
+
const=empty_list),
|
| 714 |
+
'stroke-dasharray': SVGAttribute('stroke-dasharray', anim=True,
|
| 715 |
+
types=frozenset(['list-of-length']),
|
| 716 |
+
const=frozenset(['none', 'inherit'])),
|
| 717 |
+
'stroke-dashoffset': SVGAttribute('stroke-dashoffset', anim=True,
|
| 718 |
+
types=frozenset(['length']),
|
| 719 |
+
const=frozenset(['inherit'])),
|
| 720 |
+
'stroke-linecap': SVGAttribute('stroke-linecap', anim=True,
|
| 721 |
+
types=empty_list,
|
| 722 |
+
const=frozenset(['square', 'round', 'inherit', 'butt'])),
|
| 723 |
+
'stroke-linejoin': SVGAttribute('stroke-linejoin', anim=True,
|
| 724 |
+
types=empty_list,
|
| 725 |
+
const=frozenset(['bevel', 'miter', 'round', 'inherit'])),
|
| 726 |
+
'stroke-miterlimit': SVGAttribute('stroke-miterlimit', anim=True,
|
| 727 |
+
types=frozenset(['number']),
|
| 728 |
+
const=frozenset(['inherit'])),
|
| 729 |
+
'stroke-opacity': SVGAttribute('stroke-opacity', anim=True,
|
| 730 |
+
types=frozenset(['number']),
|
| 731 |
+
const=frozenset(['inherit'])),
|
| 732 |
+
'stroke-width': SVGAttribute('stroke-width', anim=True,
|
| 733 |
+
types=frozenset(['length']),
|
| 734 |
+
const=frozenset(['inherit'])),
|
| 735 |
+
'style': SVGAttribute('style', anim=False,
|
| 736 |
+
types=frozenset('anything'),
|
| 737 |
+
const=empty_list),
|
| 738 |
+
'surfaceScale': SVGAttribute('surfaceScale', anim=True,
|
| 739 |
+
types=frozenset(['number']),
|
| 740 |
+
const=empty_list),
|
| 741 |
+
'systemLanguage': SVGAttribute('systemLanguage', anim=False,
|
| 742 |
+
types=frozenset(['string']),
|
| 743 |
+
const=empty_list),
|
| 744 |
+
'tableValues': SVGAttribute('tableValues', anim=True,
|
| 745 |
+
types=frozenset(['list-of-number']),
|
| 746 |
+
const=empty_list),
|
| 747 |
+
'target': SVGAttribute('target', anim=True,
|
| 748 |
+
types=frozenset(['XML-Name']),
|
| 749 |
+
const=frozenset(['_replace', '_self', '_parent', '_top', '_blank'])),
|
| 750 |
+
'targetX': SVGAttribute('targetX', anim=True,
|
| 751 |
+
types=frozenset(['integer']),
|
| 752 |
+
const=empty_list),
|
| 753 |
+
'targetY': SVGAttribute('targetY', anim=True,
|
| 754 |
+
types=frozenset(['integer']),
|
| 755 |
+
const=empty_list),
|
| 756 |
+
'text-anchor': SVGAttribute('text-anchor', anim=True,
|
| 757 |
+
types=empty_list,
|
| 758 |
+
const=frozenset(['start', 'end', 'inherit', 'middle'])),
|
| 759 |
+
'text-decoration': SVGAttribute('text-decoration', anim=True,
|
| 760 |
+
types=frozenset(['list-of-text-decoration-style']),
|
| 761 |
+
const=frozenset(['', 'none', 'inherit'])),
|
| 762 |
+
'text-rendering': SVGAttribute('text-rendering', anim=True,
|
| 763 |
+
types=empty_list,
|
| 764 |
+
const=frozenset(['auto', 'optimizeSpeed', 'optimizeLegibility',
|
| 765 |
+
'geometricPrecision', 'inherit'])),
|
| 766 |
+
'textLength': SVGAttribute('textLength', anim=True,
|
| 767 |
+
types=frozenset(['length']),
|
| 768 |
+
const=empty_list),
|
| 769 |
+
'title': SVGAttribute('title', anim=False,
|
| 770 |
+
types=frozenset(['string']),
|
| 771 |
+
const=empty_list),
|
| 772 |
+
'to': SVGAttribute('to', anim=False,
|
| 773 |
+
types=frozenset(['string']),
|
| 774 |
+
const=empty_list),
|
| 775 |
+
'transform': SVGAttribute('transform', anim=True,
|
| 776 |
+
types=frozenset(['transform-list']),
|
| 777 |
+
const=empty_list),
|
| 778 |
+
'type': SVGMultiAttribute({
|
| 779 |
+
'* feColorMatrix': SVGAttribute(
|
| 780 |
+
'type', anim=True,
|
| 781 |
+
types=empty_list,
|
| 782 |
+
const=frozenset(['matrix', 'saturate', 'hueRotate', 'luminanceToAlpha'])),
|
| 783 |
+
'feTurbulence': SVGAttribute(
|
| 784 |
+
'type', anim=True,
|
| 785 |
+
types=empty_list,
|
| 786 |
+
const=frozenset(['fractalNoise', 'turbulence'])),
|
| 787 |
+
'feFuncR feFuncG feFuncB feFuncA': SVGAttribute(
|
| 788 |
+
'type', anim=True,
|
| 789 |
+
types=empty_list,
|
| 790 |
+
const=frozenset(['identity', 'table', 'discrete', 'linear', 'gamma'])),
|
| 791 |
+
'script style': SVGAttribute(
|
| 792 |
+
'type', anim=False,
|
| 793 |
+
types=frozenset(['content-type']),
|
| 794 |
+
const=empty_list),
|
| 795 |
+
'animateTransform': SVGAttribute(
|
| 796 |
+
'type', anim=False,
|
| 797 |
+
types=empty_list,
|
| 798 |
+
const=frozenset(['translate', 'scale', 'rotate', 'skewX', 'skewY'])),
|
| 799 |
+
}),
|
| 800 |
+
'u1': SVGAttribute('u1', anim=False,
|
| 801 |
+
types=frozenset(['string']),
|
| 802 |
+
const=empty_list),
|
| 803 |
+
'u2': SVGAttribute('u2', anim=False,
|
| 804 |
+
types=frozenset(['string']),
|
| 805 |
+
const=empty_list),
|
| 806 |
+
'underline-position': SVGAttribute('underline-position', anim=False,
|
| 807 |
+
types=frozenset(['number']),
|
| 808 |
+
const=empty_list),
|
| 809 |
+
'underline-thickness': SVGAttribute('underline-thickness', anim=False,
|
| 810 |
+
types=frozenset(['number']),
|
| 811 |
+
const=empty_list),
|
| 812 |
+
'unicode': SVGAttribute('unicode', anim=False,
|
| 813 |
+
types=frozenset(['string']),
|
| 814 |
+
const=empty_list),
|
| 815 |
+
'unicode-bidi': SVGAttribute('unicode-bidi', anim=False,
|
| 816 |
+
types=empty_list,
|
| 817 |
+
const=frozenset(['embed', 'inherit', 'bidi-override', 'normal'])),
|
| 818 |
+
'unicode-range': SVGAttribute('unicode-range', anim=False,
|
| 819 |
+
types=frozenset(['string']),
|
| 820 |
+
const=empty_list),
|
| 821 |
+
'units-per-em': SVGAttribute('units-per-em', anim=False,
|
| 822 |
+
types=frozenset(['number']),
|
| 823 |
+
const=empty_list),
|
| 824 |
+
'v-alphabetic': SVGAttribute('v-alphabetic', anim=False,
|
| 825 |
+
types=frozenset(['number']),
|
| 826 |
+
const=empty_list),
|
| 827 |
+
'v-hanging': SVGAttribute('v-hanging', anim=False,
|
| 828 |
+
types=frozenset(['number']),
|
| 829 |
+
const=empty_list),
|
| 830 |
+
'v-ideographic': SVGAttribute('v-ideographic', anim=False,
|
| 831 |
+
types=frozenset(['number']),
|
| 832 |
+
const=empty_list),
|
| 833 |
+
'v-mathematical': SVGAttribute('v-mathematical', anim=False,
|
| 834 |
+
types=frozenset(['number']),
|
| 835 |
+
const=empty_list),
|
| 836 |
+
'values': SVGMultiAttribute({
|
| 837 |
+
'*': SVGAttribute(
|
| 838 |
+
'values', anim=False,
|
| 839 |
+
types=frozenset(['semicolon-list']),
|
| 840 |
+
const=empty_list),
|
| 841 |
+
'feColorMatrix': SVGAttribute(
|
| 842 |
+
'values', anim=True,
|
| 843 |
+
types=frozenset(['list-of-number']),
|
| 844 |
+
const=empty_list),
|
| 845 |
+
}),
|
| 846 |
+
'version': SVGAttribute('version', anim=False,
|
| 847 |
+
types=empty_list,
|
| 848 |
+
const=frozenset(['1.1', '1.2'])),
|
| 849 |
+
'vert-adv-y': SVGAttribute('vert-adv-y', anim=False,
|
| 850 |
+
types=frozenset(['number']),
|
| 851 |
+
const=empty_list),
|
| 852 |
+
'vert-origin-x': SVGAttribute('vert-origin-x', anim=False,
|
| 853 |
+
types=frozenset(['number']),
|
| 854 |
+
const=empty_list),
|
| 855 |
+
'vert-origin-y': SVGAttribute('vert-origin-y', anim=False,
|
| 856 |
+
types=frozenset(['number']),
|
| 857 |
+
const=empty_list),
|
| 858 |
+
'viewBox': SVGAttribute('viewBox', anim=True,
|
| 859 |
+
types=frozenset(['four-numbers']),
|
| 860 |
+
const=empty_list),
|
| 861 |
+
'viewTarget': SVGAttribute('viewTarget', anim=False,
|
| 862 |
+
types=frozenset(['list-of-XML-Name']),
|
| 863 |
+
const=empty_list),
|
| 864 |
+
'visibility': SVGAttribute('visibility', anim=True,
|
| 865 |
+
types=empty_list,
|
| 866 |
+
const=frozenset(['visible', 'hidden', 'collapse', 'inherit'])),
|
| 867 |
+
'width': SVGAttribute('width', anim=True,
|
| 868 |
+
types=frozenset(['length']),
|
| 869 |
+
const=empty_list),
|
| 870 |
+
'widths': SVGAttribute('widths', anim=False,
|
| 871 |
+
types=frozenset(['string']),
|
| 872 |
+
const=empty_list),
|
| 873 |
+
'word-spacing': SVGAttribute('word-spacing', anim=True,
|
| 874 |
+
types=frozenset(['length']),
|
| 875 |
+
const=frozenset(['inherit', 'normal'])),
|
| 876 |
+
'writing-mode': SVGAttribute('writing-mode', anim=False,
|
| 877 |
+
types=empty_list,
|
| 878 |
+
const=frozenset(['rl-tb', 'lr', 'rl', 'tb-rl', 'lr-tb', 'inherit', 'tb'])),
|
| 879 |
+
'x': SVGMultiAttribute({
|
| 880 |
+
'*': SVGAttribute(
|
| 881 |
+
'x', anim=True,
|
| 882 |
+
types=frozenset(['coordinate']),
|
| 883 |
+
const=empty_list),
|
| 884 |
+
'altGlyph text tref tspan': SVGAttribute(
|
| 885 |
+
'x', anim=True,
|
| 886 |
+
types=frozenset(['list-of-coordinate']),
|
| 887 |
+
const=empty_list),
|
| 888 |
+
'fePointLight feSpotLight glyphRef': SVGAttribute(
|
| 889 |
+
'x', anim=True,
|
| 890 |
+
types=frozenset(['number']),
|
| 891 |
+
const=empty_list),
|
| 892 |
+
}),
|
| 893 |
+
'x-height': SVGAttribute('x-height', anim=False,
|
| 894 |
+
types=frozenset(['number']),
|
| 895 |
+
const=empty_list),
|
| 896 |
+
'x1': SVGAttribute('x1', anim=True,
|
| 897 |
+
types=frozenset(['list-of-coordinate']),
|
| 898 |
+
const=empty_list),
|
| 899 |
+
'x2': SVGAttribute('x2', anim=True,
|
| 900 |
+
types=frozenset(['list-of-coordinate']),
|
| 901 |
+
const=empty_list),
|
| 902 |
+
'xChannelSelector': SVGAttribute('xChannelSelector', anim=True,
|
| 903 |
+
types=empty_list,
|
| 904 |
+
const=frozenset(['A', 'B', 'R', 'G'])),
|
| 905 |
+
'xlink:actuate': SVGMultiAttribute({
|
| 906 |
+
'*': SVGAttribute(
|
| 907 |
+
'xlink:actuate', anim=False,
|
| 908 |
+
types=empty_list,
|
| 909 |
+
const=frozenset(['onLoad'])),
|
| 910 |
+
'a': SVGAttribute(
|
| 911 |
+
'xlink:actuate', anim=False,
|
| 912 |
+
types=empty_list,
|
| 913 |
+
const=frozenset(['onRequest'])),
|
| 914 |
+
}),
|
| 915 |
+
'xlink:arcrole': SVGAttribute('xlink:arcrole', anim=False,
|
| 916 |
+
types=frozenset(['IRI']),
|
| 917 |
+
const=empty_list),
|
| 918 |
+
'xlink:href': SVGAttribute('xlink:href', anim=False,
|
| 919 |
+
types=frozenset(['IRI']),
|
| 920 |
+
const=empty_list),
|
| 921 |
+
'xlink:role': SVGAttribute('xlink:role', anim=False,
|
| 922 |
+
types=frozenset(['IRI']),
|
| 923 |
+
const=empty_list),
|
| 924 |
+
'xlink:show': SVGMultiAttribute({
|
| 925 |
+
'*': SVGAttribute(
|
| 926 |
+
'xlink:show', anim=False,
|
| 927 |
+
types=empty_list,
|
| 928 |
+
const=frozenset(['other', 'new', 'replace', 'none', 'embed'])),
|
| 929 |
+
'a': SVGAttribute(
|
| 930 |
+
'xlink:show', anim=False,
|
| 931 |
+
types=empty_list,
|
| 932 |
+
const=frozenset(['new', 'replace'])),
|
| 933 |
+
}),
|
| 934 |
+
'xlink:title': SVGAttribute('xlink:title', anim=False,
|
| 935 |
+
types=frozenset(['string']),
|
| 936 |
+
const=empty_list),
|
| 937 |
+
'xlink:type': SVGAttribute('xlink:type', anim=False,
|
| 938 |
+
types=empty_list,
|
| 939 |
+
const=frozenset(['simple'])),
|
| 940 |
+
'xmlns': SVGAttribute('xmlns', anim=False,
|
| 941 |
+
types=frozenset(['IRI']),
|
| 942 |
+
const=empty_list),
|
| 943 |
+
'xmlns:xlink': SVGAttribute('xmlns:xlink', anim=False,
|
| 944 |
+
types=frozenset(['IRI']),
|
| 945 |
+
const=empty_list),
|
| 946 |
+
'xmlns:ev': SVGAttribute('xmlns:ev', anim=False,
|
| 947 |
+
types=frozenset(['IRI']),
|
| 948 |
+
const=empty_list),
|
| 949 |
+
'xml:base': SVGAttribute('xml:base', anim=False,
|
| 950 |
+
types=frozenset(['IRI']),
|
| 951 |
+
const=empty_list),
|
| 952 |
+
'xml:lang': SVGAttribute('xml:lang', anim=False,
|
| 953 |
+
types=frozenset(['name']),
|
| 954 |
+
const=empty_list),
|
| 955 |
+
'xml:space': SVGAttribute('xml:space', anim=False,
|
| 956 |
+
types=empty_list,
|
| 957 |
+
const=frozenset(['default', 'preserve'])),
|
| 958 |
+
'y': SVGMultiAttribute({
|
| 959 |
+
'*': SVGAttribute(
|
| 960 |
+
'y', anim=True,
|
| 961 |
+
types=frozenset(['coordinate']),
|
| 962 |
+
const=empty_list),
|
| 963 |
+
'altGlyph text tref tspan': SVGAttribute(
|
| 964 |
+
'y', anim=True,
|
| 965 |
+
types=frozenset(['list-of-coordinate']),
|
| 966 |
+
const=empty_list),
|
| 967 |
+
'fePointLight feSpotLight glyphRef': SVGAttribute(
|
| 968 |
+
'y', anim=True,
|
| 969 |
+
types=frozenset(['number']),
|
| 970 |
+
const=empty_list),
|
| 971 |
+
}),
|
| 972 |
+
'y1': SVGAttribute('y1', anim=True,
|
| 973 |
+
types=frozenset(['list-of-coordinate']),
|
| 974 |
+
const=empty_list),
|
| 975 |
+
'y2': SVGAttribute('y2', anim=True,
|
| 976 |
+
types=frozenset(['list-of-coordinate']),
|
| 977 |
+
const=empty_list),
|
| 978 |
+
'yChannelSelector': SVGAttribute('yChannelSelector', anim=True,
|
| 979 |
+
types=empty_list,
|
| 980 |
+
const=frozenset(['A', 'B', 'R', 'G'])),
|
| 981 |
+
'z': SVGAttribute('z', anim=True,
|
| 982 |
+
types=frozenset(['number']),
|
| 983 |
+
const=empty_list),
|
| 984 |
+
'zoomAndPan': SVGAttribute('zoomAndPan', anim=False,
|
| 985 |
+
types=empty_list,
|
| 986 |
+
const=frozenset(['disable', 'magnify'])),
|
| 987 |
+
}
|
| 988 |
+
|
| 989 |
+
presentation_attributes = frozenset([ "alignment-baseline", "baseline-shift",
|
| 990 |
+
"clip", "clip-path", "clip-rule", "color", "color-interpolation",
|
| 991 |
+
"color-interpolation-filters", "color-profile", "color-rendering", "cursor",
|
| 992 |
+
"direction", "display", "dominant-baseline", "enable-background",
|
| 993 |
+
"fill", "fill-opacity", "fill-rule", "filter", "flood-color",
|
| 994 |
+
"flood-opacity", "font-family", "font-size", "font-size-adjust",
|
| 995 |
+
"font-stretch", "font-style", "font-variant", "font-weight",
|
| 996 |
+
"glyph-orientation-horizontal", "glyph-orientation-vertical",
|
| 997 |
+
"image-rendering", "kerning", "letter-spacing", "lighting-color", "marker",
|
| 998 |
+
"marker-end", "marker-mid", "marker-start", "mask", "opacity",
|
| 999 |
+
"overflow", "pointer-events", "shape-rendering", "stop-color",
|
| 1000 |
+
"stop-opacity", "stroke", "stroke-dasharray", "stroke-dashoffset",
|
| 1001 |
+
"stroke-linecap", "stroke-linejoin", "stroke-miterlimit",
|
| 1002 |
+
"stroke-opacity", "stroke-width", "text-anchor", "text-decoration",
|
| 1003 |
+
"text-rendering", "unicode-bidi", "visibility", "word-spacing",
|
| 1004 |
+
"writing-mode"])
|
| 1005 |
+
|
| 1006 |
+
elements = {
|
| 1007 |
+
'a': SVGElement('a',
|
| 1008 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'onload', 'style', 'xlink:show', 'target', 'onactivate', 'onmousedown', 'transform', 'class', 'xlink:role', 'requiredFeatures', 'xml:lang', 'onmousemove', 'xmlns:xlink', 'onclick', 'xlink:arcrole', 'onfocusin']),
|
| 1009 |
+
properties=presentation_attributes,
|
| 1010 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1011 |
+
|
| 1012 |
+
'altGlyph': SVGElement('altGlyph',
|
| 1013 |
+
attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'id', 'onload', 'style', 'onmousedown', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'format', 'xlink:title', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'glyphRef', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'rotate']),
|
| 1014 |
+
properties=presentation_attributes,
|
| 1015 |
+
children=empty_list),
|
| 1016 |
+
|
| 1017 |
+
'altGlyphDef': SVGElement('altGlyphDef',
|
| 1018 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']),
|
| 1019 |
+
properties=empty_list,
|
| 1020 |
+
children=frozenset(['*'])),
|
| 1021 |
+
|
| 1022 |
+
'altGlyphItem': SVGElement('altGlyphItem',
|
| 1023 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']),
|
| 1024 |
+
properties=empty_list,
|
| 1025 |
+
children=frozenset(['*'])),
|
| 1026 |
+
|
| 1027 |
+
'animate': SVGElement('animate',
|
| 1028 |
+
attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']),
|
| 1029 |
+
properties=empty_list,
|
| 1030 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1031 |
+
|
| 1032 |
+
'animateColor': SVGElement('animateColor',
|
| 1033 |
+
attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']),
|
| 1034 |
+
properties=empty_list,
|
| 1035 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1036 |
+
|
| 1037 |
+
'animateMotion': SVGElement('animateMotion',
|
| 1038 |
+
attributes=frozenset(['origin', 'requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'onend', 'begin', 'xlink:title', 'xml:base', 'max', 'end', 'keyPoints', 'onbegin', 'systemLanguage', 'accumulate', 'path', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat', 'rotate']),
|
| 1039 |
+
properties=empty_list,
|
| 1040 |
+
children=frozenset(['desc', 'metadata', 'mpath', 'title'])),
|
| 1041 |
+
|
| 1042 |
+
'animateTransform': SVGElement('animateTransform',
|
| 1043 |
+
attributes=frozenset(['requiredExtensions', 'from', 'repeatCount', 'xml:space', 'xlink:href', 'xlink:type', 'attributeType', 'repeatDur', 'id', 'fill', 'onload', 'additive', 'calcMode', 'min', 'keySplines', 'to', 'dur', 'xlink:arcrole', 'type', 'onend', 'begin', 'xml:base', 'max', 'xlink:title', 'attributeName', 'onbegin', 'systemLanguage', 'accumulate', 'end', 'externalResourcesRequired', 'by', 'restart', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'values', 'keyTimes', 'onrepeat']),
|
| 1044 |
+
properties=empty_list,
|
| 1045 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1046 |
+
|
| 1047 |
+
'circle': SVGElement('circle',
|
| 1048 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'cy', 'cx', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'class', 'requiredFeatures', 'r', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin', 'systemLanguage']),
|
| 1049 |
+
properties=presentation_attributes,
|
| 1050 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'metadata', 'desc'])),
|
| 1051 |
+
|
| 1052 |
+
'clipPath': SVGElement('clipPath',
|
| 1053 |
+
attributes=frozenset(['clipPathUnits', 'style', 'xml:base', 'requiredExtensions', 'xml:space', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'externalResourcesRequired', 'class', 'systemLanguage']),
|
| 1054 |
+
properties=presentation_attributes,
|
| 1055 |
+
children=frozenset(['set', 'animate', 'text', 'use', 'animateColor', 'polyline', 'path', 'line', 'ellipse', 'rect', 'desc', 'animateMotion', 'polygon', 'title', 'animateTransform', 'circle', 'metadata'])),
|
| 1056 |
+
|
| 1057 |
+
'color-profile': SVGElement('color-profile',
|
| 1058 |
+
attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'name', 'rendering-intent', 'xml:space', 'xlink:href', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'local', 'id']),
|
| 1059 |
+
properties=empty_list,
|
| 1060 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1061 |
+
|
| 1062 |
+
'cursor': SVGElement('cursor',
|
| 1063 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'requiredExtensions', 'xml:space', 'xlink:href', 'systemLanguage', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'xlink:show', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'xlink:arcrole']),
|
| 1064 |
+
properties=empty_list,
|
| 1065 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1066 |
+
|
| 1067 |
+
'defs': SVGElement('defs',
|
| 1068 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']),
|
| 1069 |
+
properties=presentation_attributes,
|
| 1070 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1071 |
+
|
| 1072 |
+
'desc': SVGElement('desc',
|
| 1073 |
+
attributes=frozenset(['style', 'xml:lang', 'xml:base', 'xml:space', 'class', 'id']),
|
| 1074 |
+
properties=empty_list,
|
| 1075 |
+
children=frozenset(['*'])),
|
| 1076 |
+
|
| 1077 |
+
'ellipse': SVGElement('ellipse',
|
| 1078 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'ry', 'cy', 'cx', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'onmousedown', 'rx', 'transform', 'class', 'requiredFeatures', 'systemLanguage', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']),
|
| 1079 |
+
properties=presentation_attributes,
|
| 1080 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1081 |
+
|
| 1082 |
+
'feBlend': SVGElement('feBlend',
|
| 1083 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'in2', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class', 'mode']),
|
| 1084 |
+
properties=presentation_attributes,
|
| 1085 |
+
children=frozenset(['animate', 'set'])),
|
| 1086 |
+
|
| 1087 |
+
'feColorMatrix': SVGElement('feColorMatrix',
|
| 1088 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'id', 'height', 'width', 'xml:lang', 'values', 'result', 'in', 'y', 'x', 'type', 'class']),
|
| 1089 |
+
properties=presentation_attributes,
|
| 1090 |
+
children=frozenset(['animate', 'set'])),
|
| 1091 |
+
|
| 1092 |
+
'feComponentTransfer': SVGElement('feComponentTransfer',
|
| 1093 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class']),
|
| 1094 |
+
properties=presentation_attributes,
|
| 1095 |
+
children=frozenset(['feFuncA', 'feFuncR', 'feFuncB', 'feFuncG'])),
|
| 1096 |
+
|
| 1097 |
+
'feComposite': SVGElement('feComposite',
|
| 1098 |
+
attributes=frozenset(['xml:base', 'xml:space', 'in2', 'height', 'result', 'in', 'operator', 'class', 'style', 'width', 'id', 'k3', 'k2', 'k1', 'xml:lang', 'k4', 'y', 'x']),
|
| 1099 |
+
properties=presentation_attributes,
|
| 1100 |
+
children=frozenset(['animate', 'set'])),
|
| 1101 |
+
|
| 1102 |
+
'feConvolveMatrix': SVGElement('feConvolveMatrix',
|
| 1103 |
+
attributes=frozenset(['xml:base', 'xml:space', 'kernelUnitLength', 'edgeMode', 'height', 'bias', 'result', 'in', 'preserveAlpha', 'id', 'style', 'divisor', 'kernelMatrix', 'width', 'xml:lang', 'targetX', 'targetY', 'y', 'x', 'class2', 'order']),
|
| 1104 |
+
properties=presentation_attributes,
|
| 1105 |
+
children=frozenset(['animate', 'set'])),
|
| 1106 |
+
|
| 1107 |
+
'feDiffuseLighting': SVGElement('feDiffuseLighting',
|
| 1108 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'diffuseConstant', 'height', 'kernelUnitLength', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class', 'surfaceScale']),
|
| 1109 |
+
properties=presentation_attributes,
|
| 1110 |
+
children=frozenset(['fePointLight', 'feSpotLight', 'title', 'metadata', 'feDistantLight', 'desc'])),
|
| 1111 |
+
|
| 1112 |
+
'feDisplacementMap': SVGElement('feDisplacementMap',
|
| 1113 |
+
attributes=frozenset(['xml:base', 'xml:space', 'yChannelSelector', 'in2', 'height', 'result', 'in', 'class', 'style', 'scale', 'id', 'width', 'xml:lang', 'xChannelSelector', 'y', 'x']),
|
| 1114 |
+
properties=presentation_attributes,
|
| 1115 |
+
children=frozenset(['animate', 'set'])),
|
| 1116 |
+
|
| 1117 |
+
'feDistantLight': SVGElement('feDistantLight',
|
| 1118 |
+
attributes=frozenset(['xml:lang', 'elevation', 'azimuth', 'xml:base', 'xml:space', 'id']),
|
| 1119 |
+
properties=empty_list,
|
| 1120 |
+
children=frozenset(['animate', 'set'])),
|
| 1121 |
+
|
| 1122 |
+
'feFlood': SVGElement('feFlood',
|
| 1123 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'y', 'x', 'class']),
|
| 1124 |
+
properties=presentation_attributes,
|
| 1125 |
+
children=frozenset(['animate', 'set', 'animateColor'])),
|
| 1126 |
+
|
| 1127 |
+
'feFuncA': SVGElement('feFuncA',
|
| 1128 |
+
attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']),
|
| 1129 |
+
properties=empty_list,
|
| 1130 |
+
children=frozenset(['animate', 'set'])),
|
| 1131 |
+
|
| 1132 |
+
'feFuncB': SVGElement('feFuncB',
|
| 1133 |
+
attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']),
|
| 1134 |
+
properties=empty_list,
|
| 1135 |
+
children=frozenset(['animate', 'set'])),
|
| 1136 |
+
|
| 1137 |
+
'feFuncG': SVGElement('feFuncG',
|
| 1138 |
+
attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']),
|
| 1139 |
+
properties=empty_list,
|
| 1140 |
+
children=frozenset(['animate', 'set'])),
|
| 1141 |
+
|
| 1142 |
+
'feFuncR': SVGElement('feFuncR',
|
| 1143 |
+
attributes=frozenset(['slope', 'xml:base', 'tableValues', 'xml:space', 'xml:lang', 'intercept', 'amplitude', 'offset', 'type', 'id', 'exponent']),
|
| 1144 |
+
properties=empty_list,
|
| 1145 |
+
children=frozenset(['animate', 'set'])),
|
| 1146 |
+
|
| 1147 |
+
'feGaussianBlur': SVGElement('feGaussianBlur',
|
| 1148 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'stdDeviation', 'class']),
|
| 1149 |
+
properties=presentation_attributes,
|
| 1150 |
+
children=frozenset(['animate', 'set'])),
|
| 1151 |
+
|
| 1152 |
+
'feImage': SVGElement('feImage',
|
| 1153 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'height', 'result', 'xlink:type', 'externalResourcesRequired', 'preserveAsectRatio', 'class', 'xlink:actuate', 'style', 'xlink:show', 'id', 'xlink:role', 'width', 'xml:lang', 'y', 'x', 'xlink:arcrole']),
|
| 1154 |
+
properties=presentation_attributes,
|
| 1155 |
+
children=frozenset(['animate', 'set', 'animateColor'])),
|
| 1156 |
+
|
| 1157 |
+
'feMerge': SVGElement('feMerge',
|
| 1158 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'y', 'x', 'class']),
|
| 1159 |
+
properties=presentation_attributes,
|
| 1160 |
+
children=frozenset(['animate', 'set', 'feMergeNode'])),
|
| 1161 |
+
|
| 1162 |
+
'feMergeNode': SVGElement('feMergeNode',
|
| 1163 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id', 'in']),
|
| 1164 |
+
properties=empty_list,
|
| 1165 |
+
children=frozenset(['animate', 'set'])),
|
| 1166 |
+
|
| 1167 |
+
'feMorphology': SVGElement('feMorphology',
|
| 1168 |
+
attributes=frozenset(['style', 'xml:base', 'y', 'xml:space', 'id', 'height', 'width', 'xml:lang', 'radius', 'result', 'in', 'operator', 'x', 'class']),
|
| 1169 |
+
properties=presentation_attributes,
|
| 1170 |
+
children=frozenset(['animate', 'set'])),
|
| 1171 |
+
|
| 1172 |
+
'feOffset': SVGElement('feOffset',
|
| 1173 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'in', 'height', 'width', 'xml:lang', 'id', 'result', 'dx', 'dy', 'y', 'x', 'class']),
|
| 1174 |
+
properties=presentation_attributes,
|
| 1175 |
+
children=frozenset(['animate', 'set'])),
|
| 1176 |
+
|
| 1177 |
+
'fePointLight': SVGElement('fePointLight',
|
| 1178 |
+
attributes=frozenset(['xml:lang', 'xml:base', 'y', 'x', 'xml:space', 'z', 'id']),
|
| 1179 |
+
properties=empty_list,
|
| 1180 |
+
children=frozenset(['animate', 'set'])),
|
| 1181 |
+
|
| 1182 |
+
'feSpecularLighting': SVGElement('feSpecularLighting',
|
| 1183 |
+
attributes=frozenset(['specularConstant', 'xml:base', 'xml:space', 'kernelUnitLength', 'height', 'result', 'in', 'class', 'style', 'id', 'width', 'xml:lang', 'specularExponent', 'y', 'x', 'surfaceScale']),
|
| 1184 |
+
properties=presentation_attributes,
|
| 1185 |
+
children=frozenset(['fePointLight', 'feSpotLight', 'title', 'metadata', 'feDistantLight', 'desc'])),
|
| 1186 |
+
|
| 1187 |
+
'feSpotLight': SVGElement('feSpotLight',
|
| 1188 |
+
attributes=frozenset(['pointsAtX', 'xml:base', 'xml:space', 'limitingConeAngle', 'xml:lang', 'specularExponent', 'pointsAtZ', 'y', 'x', 'pointsAtY', 'z', 'id']),
|
| 1189 |
+
properties=empty_list,
|
| 1190 |
+
children=frozenset(['animate', 'set'])),
|
| 1191 |
+
|
| 1192 |
+
'feTile': SVGElement('feTile',
|
| 1193 |
+
attributes=frozenset(['style', 'xml:base', 'xml:space', 'height', 'width', 'xml:lang', 'id', 'result', 'in', 'y', 'x', 'class']),
|
| 1194 |
+
properties=presentation_attributes,
|
| 1195 |
+
children=frozenset(['animate', 'set'])),
|
| 1196 |
+
|
| 1197 |
+
'feTurbulence': SVGElement('feTurbulence',
|
| 1198 |
+
attributes=frozenset(['xml:base', 'baseFrequency', 'xml:space', 'stitchTiles', 'height', 'width', 'xml:lang', 'id', 'result', 'x', 'y', 'numOctaves', 'type', 'seed']),
|
| 1199 |
+
properties=presentation_attributes,
|
| 1200 |
+
children=empty_list),
|
| 1201 |
+
|
| 1202 |
+
'filter': SVGElement('filter',
|
| 1203 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'height', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'style', 'xlink:show', 'filterRes', 'primitiveUnits', 'id', 'xlink:role', 'width', 'xml:lang', 'y', 'x', 'xlink:arcrole', 'filterUnits']),
|
| 1204 |
+
properties=presentation_attributes,
|
| 1205 |
+
children=frozenset(['set', 'animate', 'metadata', 'desc', 'feBlend', 'feColorMatrix', 'feComponentTransfer',
|
| 1206 |
+
'feComposite', 'feConvolveMatrix', 'feDiffuseLighting',
|
| 1207 |
+
'feDisplacementMap', 'feFlood', 'feGaussianBlur',
|
| 1208 |
+
'feImage', 'feMerge', 'feMorphology', 'feOffset',
|
| 1209 |
+
'feSpecularLighting', 'feTile', 'feTurbulence'])),
|
| 1210 |
+
'font': SVGElement('font',
|
| 1211 |
+
attributes=frozenset(['xml:space', 'id', 'xml:lang', 'xml:base', 'class', 'style', 'externalResourcesRequired', 'horiz-origin-x', 'horiz-origin-y', 'horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y']),
|
| 1212 |
+
properties=presentation_attributes,
|
| 1213 |
+
children=frozenset(['title', 'metadata', 'missing-glyph', 'font-face', 'vkern', 'hkern', 'glyph', 'desc'])),
|
| 1214 |
+
|
| 1215 |
+
'font-face': SVGElement('font-face',
|
| 1216 |
+
attributes=frozenset(['mathematical', 'slope', 'font-size', 'xml:space', 'v-hanging', 'hanging', 'overline-thickness', 'ascent', 'id', 'strikethrough-position', 'underline-position', 'descent', 'cap-height', 'units-per-em', 'font-style', 'unicode-range', 'font-stretch', 'font-variant', 'x-height', 'font-weight', 'xml:base', 'panose-1', 'strikethrough-thickness', 'stemh', 'v-alphabetic', 'stemv', 'bbox', 'underline-thickness', 'font-family', 'v-mathematical', 'v-ideographic', 'ideographic', 'overline-position', 'widths', 'xml:lang', 'accent-height', 'alphabetic']),
|
| 1217 |
+
properties=empty_list,
|
| 1218 |
+
children=frozenset(['desc', 'metadata', 'font-face-src', 'title'])),
|
| 1219 |
+
|
| 1220 |
+
'font-face-format': SVGElement('font-face-format',
|
| 1221 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']),
|
| 1222 |
+
properties=empty_list,
|
| 1223 |
+
children=empty_list),
|
| 1224 |
+
|
| 1225 |
+
'font-face-name': SVGElement('font-face-name',
|
| 1226 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id', 'name']),
|
| 1227 |
+
properties=empty_list,
|
| 1228 |
+
children=empty_list),
|
| 1229 |
+
|
| 1230 |
+
'font-face-uri': SVGElement('font-face-uri',
|
| 1231 |
+
attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'id']),
|
| 1232 |
+
properties=empty_list,
|
| 1233 |
+
children=frozenset(['font-face-format'])),
|
| 1234 |
+
|
| 1235 |
+
'foreignObject': SVGElement('foreignObject',
|
| 1236 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'height', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'class', 'width', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']),
|
| 1237 |
+
properties=presentation_attributes,
|
| 1238 |
+
children=frozenset(['*'])),
|
| 1239 |
+
|
| 1240 |
+
'g': SVGElement('g',
|
| 1241 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']),
|
| 1242 |
+
properties=presentation_attributes,
|
| 1243 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1244 |
+
|
| 1245 |
+
'glyph': SVGElement('glyph',
|
| 1246 |
+
attributes=frozenset(['xml:base', 'xml:space', 'id', 'xml:lang', 'class', 'style','d','horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y', 'unicode', 'glyph-name', 'orientation', 'arabic-form', 'lang']),
|
| 1247 |
+
properties=presentation_attributes,
|
| 1248 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1249 |
+
|
| 1250 |
+
'glyphRef': SVGElement('glyphRef',
|
| 1251 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'format', 'xml:space', 'xlink:href', 'dx', 'dy', 'xlink:type', 'class', 'xlink:actuate', 'style', 'xlink:show', 'id', 'xlink:role', 'xml:lang', 'y', 'x', 'xlink:arcrole', 'glyphRef']),
|
| 1252 |
+
properties=presentation_attributes,
|
| 1253 |
+
children=empty_list),
|
| 1254 |
+
|
| 1255 |
+
'hkern': SVGElement('hkern',
|
| 1256 |
+
attributes=frozenset(['xml:base', 'g2', 'g1', 'xml:space', 'u1', 'u2', 'xml:lang', 'id', 'k']),
|
| 1257 |
+
properties=empty_list,
|
| 1258 |
+
children=empty_list),
|
| 1259 |
+
|
| 1260 |
+
'image': SVGElement('image',
|
| 1261 |
+
attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'height', 'id', 'onload', 'style', 'onmousedown', 'transform', 'width', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'preserveAspectRatio']),
|
| 1262 |
+
properties=presentation_attributes,
|
| 1263 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1264 |
+
|
| 1265 |
+
'line': SVGElement('line',
|
| 1266 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'x2', 'systemLanguage', 'onmouseover', 'y1', 'externalResourcesRequired', 'y2', 'id', 'onload', 'style', 'x1', 'onactivate', 'onmousedown', 'transform', 'class', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']),
|
| 1267 |
+
properties=presentation_attributes,
|
| 1268 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1269 |
+
|
| 1270 |
+
'linearGradient': SVGElement('linearGradient',
|
| 1271 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'xml:space', 'xlink:href', 'x2', 'y1', 'externalResourcesRequired', 'y2', 'class', 'xlink:actuate', 'xlink:role', 'style', 'xlink:show', 'spreadMethod', 'id', 'gradientUnits', 'xml:lang', 'gradientTransform', 'xlink:type', 'xlink:arcrole', 'x1']),
|
| 1272 |
+
properties=presentation_attributes,
|
| 1273 |
+
children=frozenset(['set', 'title', 'animate', 'animateTransform', 'stop', 'metadata', 'desc'])),
|
| 1274 |
+
|
| 1275 |
+
'marker': SVGElement('marker',
|
| 1276 |
+
attributes=frozenset(['xml:space', 'id', 'xml:lang', 'xml:base', 'class', 'style', 'externalResourcesRequired', 'viewBox', 'preserveAspectRatio', 'refX', 'refY', 'markerUnits', 'markerWidth', 'markerHeight', 'orient']),
|
| 1277 |
+
properties=presentation_attributes,
|
| 1278 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1279 |
+
|
| 1280 |
+
'mask': SVGElement('mask',
|
| 1281 |
+
attributes=frozenset(['xml:base', 'requiredExtensions', 'xml:space', 'height', 'systemLanguage', 'externalResourcesRequired', 'maskContentUnits', 'class', 'style', 'id', 'width', 'requiredFeatures', 'xml:lang', 'y', 'x', 'maskUnits']),
|
| 1282 |
+
properties=presentation_attributes,
|
| 1283 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1284 |
+
|
| 1285 |
+
'metadata': SVGElement('metadata',
|
| 1286 |
+
attributes=frozenset(['xml:space', 'xml:lang', 'xml:base', 'id']),
|
| 1287 |
+
properties=empty_list,
|
| 1288 |
+
children=frozenset(['*'])),
|
| 1289 |
+
|
| 1290 |
+
'missing-glyph': SVGElement('missing-glyph',
|
| 1291 |
+
attributes=frozenset(['xml:base', 'xml:space', 'id', 'xml:lang', 'class', 'style', 'd', 'horiz-adv-x', 'vert-origin-x', 'vert-origin-y', 'vert-adv-y']),
|
| 1292 |
+
properties=presentation_attributes,
|
| 1293 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1294 |
+
|
| 1295 |
+
'mpath': SVGElement('mpath',
|
| 1296 |
+
attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'id', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'externalResourcesRequired']),
|
| 1297 |
+
properties=empty_list,
|
| 1298 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1299 |
+
|
| 1300 |
+
'path': SVGElement('path',
|
| 1301 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'pathLength', 'externalResourcesRequired', 'id', 'onload', 'style', 'd', 'onactivate', 'onmousedown', 'transform', 'class', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']),
|
| 1302 |
+
properties=presentation_attributes,
|
| 1303 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1304 |
+
|
| 1305 |
+
'pattern': SVGElement('pattern',
|
| 1306 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'requiredExtensions', 'xml:space', 'xlink:href', 'height', 'class', 'systemLanguage', 'patternContentUnits', 'xlink:type', 'externalResourcesRequired', 'id', 'xlink:actuate', 'style', 'xlink:show', 'viewBox', 'xlink:role', 'width', 'requiredFeatures', 'patternUnits', 'patternTransform', 'y', 'x', 'preserveAspectRatio', 'xlink:arcrole', 'xml:lang']),
|
| 1307 |
+
properties=presentation_attributes,
|
| 1308 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1309 |
+
|
| 1310 |
+
'polygon': SVGElement('polygon',
|
| 1311 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'class', 'requiredFeatures', 'points', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']),
|
| 1312 |
+
properties=presentation_attributes,
|
| 1313 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1314 |
+
|
| 1315 |
+
'polyline': SVGElement('polyline',
|
| 1316 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'class', 'requiredFeatures', 'points', 'onmousemove', 'onclick', 'xml:lang', 'onfocusin']),
|
| 1317 |
+
properties=presentation_attributes,
|
| 1318 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1319 |
+
|
| 1320 |
+
'radialGradient': SVGElement('radialGradient',
|
| 1321 |
+
attributes=frozenset(['xlink:title', 'xml:base', 'fx', 'fy', 'xml:space', 'xlink:href', 'cy', 'cx', 'xlink:type', 'externalResourcesRequired', 'r', 'id', 'xlink:actuate', 'gradientUnits', 'style', 'xlink:show', 'spreadMethod', 'class', 'xlink:role', 'xml:lang', 'gradientTransform', 'xlink:arcrole']),
|
| 1322 |
+
properties=presentation_attributes,
|
| 1323 |
+
children=frozenset(['set', 'title', 'animate', 'animateTransform', 'stop', 'metadata', 'desc'])),
|
| 1324 |
+
|
| 1325 |
+
'rect': SVGElement('rect',
|
| 1326 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'height', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'id', 'onload', 'style', 'ry', 'onactivate', 'onmousedown', 'rx', 'transform', 'class', 'width', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']),
|
| 1327 |
+
properties=presentation_attributes,
|
| 1328 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'metadata', 'desc'])),
|
| 1329 |
+
|
| 1330 |
+
'script': SVGElement('script',
|
| 1331 |
+
attributes=frozenset(['xlink:actuate', 'xlink:show', 'xml:base', 'xml:space', 'xlink:href', 'id', 'xlink:role', 'xml:lang', 'xlink:type', 'xlink:title', 'xlink:arcrole', 'type', 'externalResourcesRequired']),
|
| 1332 |
+
properties=empty_list,
|
| 1333 |
+
children=empty_list),
|
| 1334 |
+
|
| 1335 |
+
'set': SVGElement('set',
|
| 1336 |
+
attributes=frozenset(['begin', 'xlink:title', 'xml:base', 'requiredExtensions', 'repeatCount', 'xml:space', 'xlink:href', 'attributeName', 'onbegin', 'systemLanguage', 'attributeType', 'xlink:type', 'externalResourcesRequired', 'id', 'restart', 'fill', 'xlink:actuate', 'onload', 'xlink:show', 'end', 'min', 'repeatDur', 'xlink:role', 'to', 'requiredFeatures', 'xml:lang', 'max', 'dur', 'xlink:arcrole', 'onrepeat', 'onend']),
|
| 1337 |
+
properties=empty_list,
|
| 1338 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1339 |
+
|
| 1340 |
+
'stop': SVGElement('stop',
|
| 1341 |
+
attributes=frozenset(['xml:base', 'xml:space', 'xml:lang', 'offset', 'style', 'class']),
|
| 1342 |
+
properties=presentation_attributes,
|
| 1343 |
+
children=frozenset(['animate', 'set', 'animateColor'])),
|
| 1344 |
+
|
| 1345 |
+
'style': SVGElement('style',
|
| 1346 |
+
attributes=frozenset(['xml:lang', 'xml:base', 'title', 'media', 'xml:space', 'type', 'id']),
|
| 1347 |
+
properties=empty_list,
|
| 1348 |
+
children=frozenset(['*'])),
|
| 1349 |
+
|
| 1350 |
+
'svg': SVGElement('svg',
|
| 1351 |
+
attributes=frozenset(['requiredExtensions', 'onerror', 'onfocusout', 'xml:space', 'height', 'onscroll', 'baseProfile', 'contentStyleType', 'id', 'onabort', 'onload', 'style', 'onmousedown', 'onzoom', 'onresize', 'width', 'version', 'onmousemove', 'onmouseup', 'xmlns:xlink', 'xmlns:ev', 'onfocusin', 'xml:base', 'onclick', 'onmouseout', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'zoomAndPan', 'class', 'onunload', 'xmlns', 'onactivate', 'viewBox', 'requiredFeatures', 'xml:lang', 'y', 'x', 'preserveAspectRatio', 'contentScriptType']),
|
| 1352 |
+
properties=presentation_attributes,
|
| 1353 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1354 |
+
|
| 1355 |
+
'switch': SVGElement('switch',
|
| 1356 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'systemLanguage', 'onmouseover', 'externalResourcesRequired', 'class', 'onload', 'style', 'onactivate', 'onmousedown', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'onfocusin']),
|
| 1357 |
+
properties=presentation_attributes,
|
| 1358 |
+
children=frozenset(['set', 'text', 'image', 'line', 'use', 'animateColor', 'polyline', 'path', 'animate', 'ellipse', 'rect', 'desc', 'a', 'animateMotion', 'polygon', 'g', 'title', 'svg', 'switch', 'animateTransform', 'foreignObject', 'circle', 'metadata'])),
|
| 1359 |
+
|
| 1360 |
+
'symbol': SVGElement('symbol',
|
| 1361 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'onfocusout', 'xml:space', 'onmouseover', 'id', 'externalResourcesRequired', 'viewBox', 'onload', 'style', 'onactivate', 'onmousedown', 'class', 'xml:lang', 'onmousemove', 'onclick', 'preserveAspectRatio', 'onfocusin']),
|
| 1362 |
+
properties=presentation_attributes,
|
| 1363 |
+
children=frozenset(['set', 'text', 'image', 'font-face', 'polyline', 'marker', 'animate', 'font', 'color-profile', 'ellipse', 'cursor', 'style', 'polygon', 'title', 'pattern', 'circle', 'radialGradient', 'metadata', 'defs', 'symbol', 'use', 'animateMotion', 'animateColor', 'path', 'line', 'rect', 'desc', 'a', 'g', 'svg', 'script', 'mask', 'altGlyphDef', 'filter', 'switch', 'animateTransform', 'linearGradient', 'clipPath', 'foreignObject', 'view'])),
|
| 1364 |
+
|
| 1365 |
+
'text': SVGElement('text',
|
| 1366 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'class', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'externalResourcesRequired', 'lengthAdjust', 'onload', 'style', 'rotate', 'onactivate', 'onmousedown', 'textLength', 'transform', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']),
|
| 1367 |
+
properties=presentation_attributes,
|
| 1368 |
+
children=frozenset(['a', 'animateMotion', 'set', 'title', 'textPath', 'tspan', 'animateColor', 'tref', 'animateTransform', 'altGlyph', 'animate', 'desc', 'metadata'])),
|
| 1369 |
+
|
| 1370 |
+
'textPath': SVGElement('textPath',
|
| 1371 |
+
attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'startOffset', 'id', 'onload', 'style', 'onmousedown', 'lengthAdjust', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'spacing', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'textLength', 'method', 'xlink:role', 'requiredFeatures', 'xml:lang']),
|
| 1372 |
+
properties=presentation_attributes,
|
| 1373 |
+
children=frozenset(['a', 'set', 'title', 'tspan', 'animateColor', 'tref', 'altGlyph', 'animate', 'metadata', 'desc'])),
|
| 1374 |
+
|
| 1375 |
+
'title': SVGElement('title',
|
| 1376 |
+
attributes=frozenset(['style', 'xml:lang', 'xml:base', 'xml:space', 'class', 'id']),
|
| 1377 |
+
properties=empty_list,
|
| 1378 |
+
children=frozenset(['*'])),
|
| 1379 |
+
|
| 1380 |
+
'tref': SVGElement('tref',
|
| 1381 |
+
attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'id', 'onload', 'style', 'onmousedown', 'lengthAdjust', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'textLength', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x', 'rotate']),
|
| 1382 |
+
properties=presentation_attributes,
|
| 1383 |
+
children=frozenset(['set', 'title', 'animate', 'metadata', 'animateColor', 'desc'])),
|
| 1384 |
+
|
| 1385 |
+
'tspan': SVGElement('tspan',
|
| 1386 |
+
attributes=frozenset(['xml:base', 'onmouseup', 'onmouseout', 'requiredExtensions', 'onfocusout', 'xml:space', 'class', 'systemLanguage', 'onmouseover', 'dx', 'dy', 'externalResourcesRequired', 'lengthAdjust', 'onload', 'style', 'rotate', 'onactivate', 'onmousedown', 'textLength', 'id', 'requiredFeatures', 'xml:lang', 'onmousemove', 'onclick', 'y', 'x', 'onfocusin']),
|
| 1387 |
+
properties=presentation_attributes,
|
| 1388 |
+
children=frozenset(['a', 'set', 'title', 'tspan', 'animateColor', 'tref', 'altGlyph', 'animate', 'metadata', 'desc'])),
|
| 1389 |
+
|
| 1390 |
+
'use': SVGElement('use',
|
| 1391 |
+
attributes=frozenset(['requiredExtensions', 'onfocusout', 'xml:space', 'xlink:href', 'height', 'id', 'onload', 'style', 'onmousedown', 'transform', 'width', 'onmousemove', 'onclick', 'xlink:arcrole', 'onfocusin', 'xml:base', 'onmouseup', 'onmouseout', 'xlink:title', 'systemLanguage', 'onmouseover', 'xlink:type', 'externalResourcesRequired', 'class', 'xlink:actuate', 'xlink:show', 'onactivate', 'xlink:role', 'requiredFeatures', 'xml:lang', 'y', 'x']),
|
| 1392 |
+
properties=presentation_attributes,
|
| 1393 |
+
children=frozenset(['animateMotion', 'set', 'title', 'animateColor', 'animateTransform', 'animate', 'desc', 'metadata'])),
|
| 1394 |
+
|
| 1395 |
+
'view': SVGElement('view',
|
| 1396 |
+
attributes=frozenset(['xml:base', 'viewTarget', 'xml:space', 'viewBox', 'xml:lang', 'preserveAspectRatio', 'externalResourcesRequired', 'zoomAndPan', 'id']),
|
| 1397 |
+
properties=empty_list,
|
| 1398 |
+
children=frozenset(['desc', 'metadata', 'title'])),
|
| 1399 |
+
|
| 1400 |
+
'vkern': SVGElement('vkern',
|
| 1401 |
+
attributes=frozenset(['xml:base', 'g2', 'g1', 'xml:space', 'u1', 'u2', 'xml:lang', 'id', 'k']),
|
| 1402 |
+
properties=empty_list,
|
| 1403 |
+
children=empty_list),
|
| 1404 |
+
|
| 1405 |
+
}
|
falcon/lib/python3.10/site-packages/svgwrite/data/pattern.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: pattern module
|
| 5 |
+
# Created: 27.09.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
import re
|
| 10 |
+
|
| 11 |
+
#coordinate ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
|
| 12 |
+
coordinate = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)(cm|em|ex|in|mm|pc|pt|px|%)?$")
|
| 13 |
+
|
| 14 |
+
#length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
|
| 15 |
+
length = coordinate
|
| 16 |
+
|
| 17 |
+
#angle ::= number (~"deg" | ~"grad" | ~"rad")?
|
| 18 |
+
angle = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)(deg|rad|grad)?$")
|
| 19 |
+
|
| 20 |
+
# numbers without units
|
| 21 |
+
number = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)$")
|
| 22 |
+
|
| 23 |
+
# number as percentage value '###%'
|
| 24 |
+
percentage = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)%$")
|
| 25 |
+
|
| 26 |
+
#frequency ::= number (~"Hz" | ~"kHz")
|
| 27 |
+
frequency = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)(Hz|kHz)?$")
|
| 28 |
+
|
| 29 |
+
#time ::= number (~"s" | ~"ms")
|
| 30 |
+
time = re.compile(r"(^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?)(s|ms)?$")
|
falcon/lib/python3.10/site-packages/svgwrite/data/typechecker.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: typechecker
|
| 5 |
+
# Created: 15.10.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
import re
|
| 10 |
+
|
| 11 |
+
from svgwrite.data import pattern
|
| 12 |
+
from svgwrite.data.colors import colornames
|
| 13 |
+
from svgwrite.data.svgparser import is_valid_transferlist, is_valid_pathdata, is_valid_animation_timing
|
| 14 |
+
from svgwrite.utils import is_string
|
| 15 |
+
|
| 16 |
+
def iterflatlist(values):
|
| 17 |
+
""" Flatten nested *values*, returns an *iterator*. """
|
| 18 |
+
for element in values:
|
| 19 |
+
if hasattr(element, "__iter__") and not is_string(element):
|
| 20 |
+
for item in iterflatlist(element):
|
| 21 |
+
yield item
|
| 22 |
+
else:
|
| 23 |
+
yield element
|
| 24 |
+
|
| 25 |
+
INVALID_NAME_CHARS = frozenset([' ', '\t', '\r', '\n', ',', '(', ')'])
|
| 26 |
+
WHITESPACE = frozenset([' ', '\t', '\r', '\n'])
|
| 27 |
+
SHAPE_PATTERN = re.compile(r"^rect\((.*),(.*),(.*),(.*)\)$")
|
| 28 |
+
FUNCIRI_PATTERN = re.compile(r"^url\((.*)\)$")
|
| 29 |
+
ICCCOLOR_PATTERN = re.compile(r"^icc-color\((.*)\)$")
|
| 30 |
+
COLOR_HEXDIGIT_PATTERN = re.compile(r"^#[a-fA-F0-9]{3}([a-fA-F0-9]{3})?$")
|
| 31 |
+
COLOR_RGB_INTEGER_PATTERN = re.compile(r"^rgb\( *\d+ *, *\d+ *, *\d+ *\)$")
|
| 32 |
+
COLOR_RGB_PERCENTAGE_PATTERN = re.compile(r"^rgb\( *\d+(\.\d*)?% *, *\d+(\.\d*)?% *, *\d+(\.\d*)?% *\)$")
|
| 33 |
+
NMTOKEN_PATTERN = re.compile(r"^[a-zA-Z_:][\w\-\.:]*$")
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class Full11TypeChecker(object):
|
| 37 |
+
def get_version(self):
|
| 38 |
+
return '1.1', 'full'
|
| 39 |
+
|
| 40 |
+
def is_angle(self, value):
|
| 41 |
+
#angle ::= number (~"deg" | ~"grad" | ~"rad")?
|
| 42 |
+
if self.is_number(value):
|
| 43 |
+
return True
|
| 44 |
+
elif is_string(value):
|
| 45 |
+
return pattern.angle.match(value.strip()) is not None
|
| 46 |
+
return False
|
| 47 |
+
|
| 48 |
+
def is_anything(self, value):
|
| 49 |
+
#anything ::= Char*
|
| 50 |
+
return bool(str(value).strip())
|
| 51 |
+
is_string = is_anything
|
| 52 |
+
is_content_type = is_anything
|
| 53 |
+
|
| 54 |
+
def is_color(self, value):
|
| 55 |
+
#color ::= "#" hexdigit hexdigit hexdigit (hexdigit hexdigit hexdigit)?
|
| 56 |
+
# | "rgb(" wsp* integer comma integer comma integer wsp* ")"
|
| 57 |
+
# | "rgb(" wsp* number "%" comma number "%" comma number "%" wsp* ")"
|
| 58 |
+
# | color-keyword
|
| 59 |
+
#hexdigit ::= [0-9A-Fa-f]
|
| 60 |
+
#comma ::= wsp* "," wsp*
|
| 61 |
+
value = str(value).strip()
|
| 62 |
+
if value.startswith('#'):
|
| 63 |
+
if COLOR_HEXDIGIT_PATTERN.match(value):
|
| 64 |
+
return True
|
| 65 |
+
else:
|
| 66 |
+
return False
|
| 67 |
+
elif value.startswith('rgb('):
|
| 68 |
+
if COLOR_RGB_INTEGER_PATTERN.match(value):
|
| 69 |
+
return True
|
| 70 |
+
elif COLOR_RGB_PERCENTAGE_PATTERN.match(value):
|
| 71 |
+
return True
|
| 72 |
+
return False
|
| 73 |
+
return self.is_color_keyword(value)
|
| 74 |
+
|
| 75 |
+
def is_color_keyword(self, value):
|
| 76 |
+
return value.strip() in colornames
|
| 77 |
+
|
| 78 |
+
def is_frequency(self, value):
|
| 79 |
+
# frequency ::= number (~"Hz" | ~"kHz")
|
| 80 |
+
if self.is_number(value):
|
| 81 |
+
return True
|
| 82 |
+
elif is_string(value):
|
| 83 |
+
return pattern.frequency.match(value.strip()) is not None
|
| 84 |
+
return False
|
| 85 |
+
|
| 86 |
+
def is_FuncIRI(self, value):
|
| 87 |
+
# FuncIRI ::= "url(" <IRI> ")"
|
| 88 |
+
res = FUNCIRI_PATTERN.match(str(value).strip())
|
| 89 |
+
if res:
|
| 90 |
+
return self.is_IRI(res.group(1))
|
| 91 |
+
return False
|
| 92 |
+
|
| 93 |
+
def is_icccolor(self, value):
|
| 94 |
+
# icccolor ::= "icc-color(" name (comma-wsp number)+ ")"
|
| 95 |
+
res = ICCCOLOR_PATTERN.match(str(value).strip())
|
| 96 |
+
if res:
|
| 97 |
+
return self.is_list_of_T(res.group(1), 'name')
|
| 98 |
+
return False
|
| 99 |
+
|
| 100 |
+
def is_integer(self, value):
|
| 101 |
+
if isinstance(value, float):
|
| 102 |
+
return False
|
| 103 |
+
try:
|
| 104 |
+
number = int(value)
|
| 105 |
+
return True
|
| 106 |
+
except:
|
| 107 |
+
return False
|
| 108 |
+
|
| 109 |
+
def is_IRI(self, value):
|
| 110 |
+
# Internationalized Resource Identifiers
|
| 111 |
+
# a more generalized complement to Uniform Resource Identifiers (URIs)
|
| 112 |
+
# nearly everything can be a valid <IRI>
|
| 113 |
+
# only a none-empty string ist a valid input
|
| 114 |
+
if is_string(value):
|
| 115 |
+
return bool(value.strip())
|
| 116 |
+
else:
|
| 117 |
+
return False
|
| 118 |
+
|
| 119 |
+
def is_length(self, value):
|
| 120 |
+
# length ::= number ("em" | "ex" | "px" | "in" | "cm" | "mm" | "pt" | "pc" | "%")?
|
| 121 |
+
if value is None:
|
| 122 |
+
return False
|
| 123 |
+
if isinstance(value, (int, float)):
|
| 124 |
+
return self.is_number(value)
|
| 125 |
+
elif is_string(value):
|
| 126 |
+
result = pattern.length.match(value.strip())
|
| 127 |
+
if result:
|
| 128 |
+
number, tmp, unit = result.groups()
|
| 129 |
+
return self.is_number(number) # for tiny check!
|
| 130 |
+
return False
|
| 131 |
+
|
| 132 |
+
is_coordinate = is_length
|
| 133 |
+
|
| 134 |
+
def is_list_of_T(self, value, t='string'):
|
| 135 |
+
def split(value):
|
| 136 |
+
#TODO: improve split function!!!!
|
| 137 |
+
if isinstance(value, (int, float)):
|
| 138 |
+
return (value, )
|
| 139 |
+
if is_string(value):
|
| 140 |
+
return iterflatlist(v.split(',') for v in value.split(' '))
|
| 141 |
+
return value
|
| 142 |
+
#list-of-Ts ::= T
|
| 143 |
+
# | T comma-wsp list-of-Ts
|
| 144 |
+
#comma-wsp ::= (wsp+ ","? wsp*) | ("," wsp*)
|
| 145 |
+
#wsp ::= (#x20 | #x9 | #xD | #xA)
|
| 146 |
+
checker = self.get_func_by_name(t)
|
| 147 |
+
for v in split(value):
|
| 148 |
+
if not checker(v):
|
| 149 |
+
return False
|
| 150 |
+
return True
|
| 151 |
+
|
| 152 |
+
def is_four_numbers(self, value):
|
| 153 |
+
def split(value):
|
| 154 |
+
if is_string(value):
|
| 155 |
+
values = iterflatlist( (v.strip().split(' ') for v in value.split(',')) )
|
| 156 |
+
return (v for v in values if v)
|
| 157 |
+
else:
|
| 158 |
+
return iterflatlist(value)
|
| 159 |
+
|
| 160 |
+
values = list(split(value))
|
| 161 |
+
if len(values) != 4:
|
| 162 |
+
return False
|
| 163 |
+
checker = self.get_func_by_name('number')
|
| 164 |
+
for v in values:
|
| 165 |
+
if not checker(v):
|
| 166 |
+
return False
|
| 167 |
+
return True
|
| 168 |
+
|
| 169 |
+
def is_semicolon_list(self, value):
|
| 170 |
+
#a semicolon-separated list of values
|
| 171 |
+
# | value comma-wsp list-of-values
|
| 172 |
+
#comma-wsp ::= (wsp+ ";" wsp*) | ("," wsp*)
|
| 173 |
+
#wsp ::= (#x20 | #x9 | #xD | #xA)
|
| 174 |
+
return self.is_list_of_T(value.replace(';', ' '), 'string')
|
| 175 |
+
|
| 176 |
+
def is_name(self, value):
|
| 177 |
+
# name ::= [^,()#x20#x9#xD#xA] /* any char except ",", "(", ")" or wsp */
|
| 178 |
+
chars = frozenset(str(value).strip())
|
| 179 |
+
if not chars or INVALID_NAME_CHARS.intersection(chars):
|
| 180 |
+
return False
|
| 181 |
+
else:
|
| 182 |
+
return True
|
| 183 |
+
|
| 184 |
+
def is_number(self, value):
|
| 185 |
+
try:
|
| 186 |
+
number = float(value)
|
| 187 |
+
return True
|
| 188 |
+
except:
|
| 189 |
+
return False
|
| 190 |
+
|
| 191 |
+
def is_number_optional_number(self, value):
|
| 192 |
+
#number-optional-number ::= number
|
| 193 |
+
# | number comma-wsp number
|
| 194 |
+
if is_string(value):
|
| 195 |
+
values = re.split('[ ,]+', value.strip())
|
| 196 |
+
if 0 < len(values) < 3: # 1 or 2 numbers
|
| 197 |
+
for v in values:
|
| 198 |
+
if not self.is_number(v):
|
| 199 |
+
return False
|
| 200 |
+
return True
|
| 201 |
+
else:
|
| 202 |
+
try: # is it a 2-tuple
|
| 203 |
+
n1, n2 = value
|
| 204 |
+
if self.is_number(n1) and \
|
| 205 |
+
self.is_number(n2):
|
| 206 |
+
return True
|
| 207 |
+
except TypeError: # just one value
|
| 208 |
+
return self.is_number(value)
|
| 209 |
+
except ValueError: # more than 2 values
|
| 210 |
+
pass
|
| 211 |
+
return False
|
| 212 |
+
|
| 213 |
+
def is_paint(self, value):
|
| 214 |
+
#paint ::= "none" |
|
| 215 |
+
# "currentColor" |
|
| 216 |
+
# <color> [<icccolor>] |
|
| 217 |
+
# <funciri> [ "none" | "currentColor" | <color> [<icccolor>] |
|
| 218 |
+
# "inherit"
|
| 219 |
+
def split_values(value):
|
| 220 |
+
try:
|
| 221 |
+
funcIRI, value = value.split(")", 1)
|
| 222 |
+
values = [funcIRI+")"]
|
| 223 |
+
values.extend(split_values(value))
|
| 224 |
+
return values
|
| 225 |
+
except ValueError:
|
| 226 |
+
return value.split()
|
| 227 |
+
|
| 228 |
+
values = split_values(str(value).strip())
|
| 229 |
+
for value in [v.strip() for v in values]:
|
| 230 |
+
if value in ('none', 'currentColor', 'inherit'):
|
| 231 |
+
continue
|
| 232 |
+
elif self.is_color(value):
|
| 233 |
+
continue
|
| 234 |
+
elif self.is_icccolor(value):
|
| 235 |
+
continue
|
| 236 |
+
elif self.is_FuncIRI(value):
|
| 237 |
+
continue
|
| 238 |
+
return False
|
| 239 |
+
return True
|
| 240 |
+
|
| 241 |
+
def is_percentage(self, value):
|
| 242 |
+
#percentage ::= number "%"
|
| 243 |
+
if self.is_number(value):
|
| 244 |
+
return True
|
| 245 |
+
elif is_string(value):
|
| 246 |
+
return pattern.percentage.match(value.strip()) is not None
|
| 247 |
+
return False
|
| 248 |
+
|
| 249 |
+
def is_time(self, value):
|
| 250 |
+
#time ::= <number> (~"ms" | ~"s")?
|
| 251 |
+
if self.is_number(value):
|
| 252 |
+
return True
|
| 253 |
+
elif is_string(value):
|
| 254 |
+
return pattern.time.match(value.strip()) is not None
|
| 255 |
+
return False
|
| 256 |
+
|
| 257 |
+
def is_transform_list(self, value):
|
| 258 |
+
if is_string(value):
|
| 259 |
+
return is_valid_transferlist(value)
|
| 260 |
+
else:
|
| 261 |
+
return False
|
| 262 |
+
|
| 263 |
+
def is_path_data(self, value):
|
| 264 |
+
if is_string(value):
|
| 265 |
+
return is_valid_pathdata(value)
|
| 266 |
+
else:
|
| 267 |
+
return False
|
| 268 |
+
|
| 269 |
+
def is_XML_Name(self, value):
|
| 270 |
+
# http://www.w3.org/TR/2006/REC-xml-20060816/#NT-Name
|
| 271 |
+
# Nmtoken
|
| 272 |
+
return bool(NMTOKEN_PATTERN.match(str(value).strip()))
|
| 273 |
+
|
| 274 |
+
def is_shape(self, value):
|
| 275 |
+
# shape ::= (<top> <right> <bottom> <left>)
|
| 276 |
+
# where <top>, <bottom> <right>, and <left> specify offsets from the
|
| 277 |
+
# respective sides of the box.
|
| 278 |
+
# <top>, <right>, <bottom>, and <left> are <length> values
|
| 279 |
+
# i.e. 'rect(5px, 10px, 10px, 5px)'
|
| 280 |
+
res = SHAPE_PATTERN.match(value.strip())
|
| 281 |
+
if res:
|
| 282 |
+
for arg in res.groups():
|
| 283 |
+
if arg.strip() == 'auto':
|
| 284 |
+
continue
|
| 285 |
+
if not self.is_length(arg):
|
| 286 |
+
return False
|
| 287 |
+
else:
|
| 288 |
+
return False
|
| 289 |
+
return True
|
| 290 |
+
|
| 291 |
+
def is_timing_value_list(self, value):
|
| 292 |
+
if is_string(value):
|
| 293 |
+
return is_valid_animation_timing(value)
|
| 294 |
+
else:
|
| 295 |
+
return False
|
| 296 |
+
|
| 297 |
+
def is_list_of_text_decoration_style(self, value):
|
| 298 |
+
return self.is_list_of_T(value, t='text_decoration_style')
|
| 299 |
+
|
| 300 |
+
def is_text_decoration_style(self, value):
|
| 301 |
+
return value in ('overline', 'underline', 'line-through', 'blink')
|
| 302 |
+
|
| 303 |
+
def get_func_by_name(self, funcname):
|
| 304 |
+
return getattr(self,
|
| 305 |
+
'is_'+funcname.replace('-', '_'),
|
| 306 |
+
self.is_anything)
|
| 307 |
+
|
| 308 |
+
def check(self, typename, value):
|
| 309 |
+
if typename.startswith('list-of-'):
|
| 310 |
+
t = typename[8:]
|
| 311 |
+
return self.is_list_of_T(value, t)
|
| 312 |
+
return self.get_func_by_name(typename)(value)
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
FOCUS_CONST = frozenset(['nav-next', 'nav-prev', 'nav-up', 'nav-down', 'nav-left',
|
| 316 |
+
'nav-right', 'nav-up-left', 'nav-up-right', 'nav-down-left',
|
| 317 |
+
'nav-down-right'])
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class Tiny12TypeChecker(Full11TypeChecker):
|
| 321 |
+
def get_version(self):
|
| 322 |
+
return '1.2', 'tiny'
|
| 323 |
+
|
| 324 |
+
def is_boolean(self, value):
|
| 325 |
+
if isinstance(value, bool):
|
| 326 |
+
return True
|
| 327 |
+
if is_string(value):
|
| 328 |
+
return value.strip().lower() in ('true', 'false')
|
| 329 |
+
return False
|
| 330 |
+
|
| 331 |
+
def is_number(self, value):
|
| 332 |
+
try:
|
| 333 |
+
number = float(value)
|
| 334 |
+
if -32767.9999 <= number <= 32767.9999:
|
| 335 |
+
return True
|
| 336 |
+
else:
|
| 337 |
+
return False
|
| 338 |
+
except:
|
| 339 |
+
return False
|
| 340 |
+
|
| 341 |
+
def is_focus(self, value):
|
| 342 |
+
return str(value).strip() in FOCUS_CONST
|
falcon/lib/python3.10/site-packages/svgwrite/data/types.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman --<mozman@gmx.at>
|
| 4 |
+
# Purpose: svg types
|
| 5 |
+
# Created: 30.09.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
class SVGAttribute(object):
|
| 11 |
+
def __init__(self, name, anim, types, const):
|
| 12 |
+
self.name = name
|
| 13 |
+
self._anim = anim
|
| 14 |
+
self._types = types
|
| 15 |
+
self._const = const
|
| 16 |
+
|
| 17 |
+
# 'elementname' is ignored, but necessary because of the signatures of
|
| 18 |
+
# the SVGMultiAttribute class methods get_...()
|
| 19 |
+
|
| 20 |
+
def get_anim(self, elementname='*'):
|
| 21 |
+
return self._anim
|
| 22 |
+
|
| 23 |
+
def get_types(self, elementname='*'):
|
| 24 |
+
return self._types
|
| 25 |
+
|
| 26 |
+
def get_const(self, elementname='*'):
|
| 27 |
+
return self._const
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class SVGMultiAttribute(object):
|
| 31 |
+
# example: SVGMultiAttribute({'*':SVGAttribute(...), 'text tref':SVGAttribute(...)} )
|
| 32 |
+
# parametr is a dict-like object
|
| 33 |
+
# '*' is the default attribute definition
|
| 34 |
+
# 'text' and 'tref' share the same attribute definition
|
| 35 |
+
|
| 36 |
+
def __init__(self, attributes):
|
| 37 |
+
self.name = None
|
| 38 |
+
self._attributes = {}
|
| 39 |
+
|
| 40 |
+
for names, attribute in attributes.items():
|
| 41 |
+
for name in names.split():
|
| 42 |
+
name = name.strip()
|
| 43 |
+
self._attributes[name] = attribute
|
| 44 |
+
if not self.name:
|
| 45 |
+
self.name = attribute.name
|
| 46 |
+
elif self.name != attribute.name:
|
| 47 |
+
raise ValueError("Different attribute-names for SVGMultiAttribute "\
|
| 48 |
+
"(%s != %s)." % (self.name, attribute.name))
|
| 49 |
+
|
| 50 |
+
if '*' not in self._attributes and len(self._attributes):
|
| 51 |
+
# if no default attribute definition were given
|
| 52 |
+
# set the first attribute definition as the default attribute definition
|
| 53 |
+
firstkey = sorted(self._attributes.keys())[0]
|
| 54 |
+
self._attributes['*'] = self._attributes[firstkey]
|
| 55 |
+
|
| 56 |
+
def get_attribute(self, elementname):
|
| 57 |
+
if elementname in self._attributes:
|
| 58 |
+
return self._attributes[elementname]
|
| 59 |
+
else:
|
| 60 |
+
return self._attributes['*']
|
| 61 |
+
|
| 62 |
+
def get_anim(self, elementname='*'):
|
| 63 |
+
attribute = self.get_attribute(elementname)
|
| 64 |
+
return attribute.get_anim()
|
| 65 |
+
|
| 66 |
+
def get_types(self, elementname='*'):
|
| 67 |
+
attribute = self.get_attribute(elementname)
|
| 68 |
+
return attribute.get_types()
|
| 69 |
+
|
| 70 |
+
def get_const(self, elementname='*'):
|
| 71 |
+
attribute = self.get_attribute(elementname)
|
| 72 |
+
return attribute.get_const()
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
class SVGElement(object):
|
| 76 |
+
def __init__(self, name, attributes, properties, children):
|
| 77 |
+
self.name = name
|
| 78 |
+
s = set(attributes)
|
| 79 |
+
s.update(properties)
|
| 80 |
+
self.valid_attributes = frozenset(s)
|
| 81 |
+
self.valid_children = frozenset(children)
|
falcon/lib/python3.10/site-packages/svgwrite/drawing.py
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman
|
| 4 |
+
# Purpose: drawing
|
| 5 |
+
# Created: 10.09.2010
|
| 6 |
+
# Copyright (C) 2010, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
"""
|
| 9 |
+
The *Drawing* object is the overall container for all SVG
|
| 10 |
+
elements. It provides the methods to store the drawing into a file or a
|
| 11 |
+
file-like object. If you want to use stylesheets, the reference links
|
| 12 |
+
to this stylesheets were also stored (`add_stylesheet`)
|
| 13 |
+
in the *Drawing* object.
|
| 14 |
+
|
| 15 |
+
set/get SVG attributes::
|
| 16 |
+
|
| 17 |
+
element['attribute'] = value
|
| 18 |
+
value = element['attribute']
|
| 19 |
+
|
| 20 |
+
The Drawing object also includes a defs section, add elements to the defs
|
| 21 |
+
section by::
|
| 22 |
+
|
| 23 |
+
drawing.defs.add(element)
|
| 24 |
+
|
| 25 |
+
"""
|
| 26 |
+
import io
|
| 27 |
+
|
| 28 |
+
from svgwrite.container import SVG, Defs
|
| 29 |
+
from svgwrite.elementfactory import ElementFactory
|
| 30 |
+
from svgwrite.utils import pretty_xml
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class Drawing(SVG, ElementFactory):
|
| 34 |
+
""" This is the SVG drawing represented by the top level *svg* element.
|
| 35 |
+
|
| 36 |
+
A drawing consists of any number of SVG elements contained within the drawing
|
| 37 |
+
element, stored in the *elements* attribute.
|
| 38 |
+
|
| 39 |
+
A drawing can range from an empty drawing (i.e., no content inside of the drawing),
|
| 40 |
+
to a very simple drawing containing a single SVG element such as a *rect*,
|
| 41 |
+
to a complex, deeply nested collection of container elements and graphics elements.
|
| 42 |
+
"""
|
| 43 |
+
def __init__(self, filename="noname.svg", size=('100%', '100%'), **extra):
|
| 44 |
+
"""
|
| 45 |
+
:param string filename: filesystem filename valid for :func:`open`
|
| 46 |
+
:param 2-tuple size: width, height
|
| 47 |
+
:param keywords extra: additional svg-attributes for the *SVG* object
|
| 48 |
+
|
| 49 |
+
Important (and not SVG Attributes) **extra** parameters:
|
| 50 |
+
|
| 51 |
+
:param string profile: ``'tiny | full'`` - define the SVG baseProfile
|
| 52 |
+
:param bool debug: switch validation on/off
|
| 53 |
+
|
| 54 |
+
"""
|
| 55 |
+
super(Drawing, self).__init__(size=size, **extra)
|
| 56 |
+
self.filename = filename
|
| 57 |
+
self._stylesheets = [] # list of stylesheets appended
|
| 58 |
+
|
| 59 |
+
def get_xml(self):
|
| 60 |
+
""" Get the XML representation as `ElementTree` object.
|
| 61 |
+
|
| 62 |
+
:return: XML `ElementTree` of this object and all its subelements
|
| 63 |
+
|
| 64 |
+
"""
|
| 65 |
+
profile = self.profile
|
| 66 |
+
version = self.version
|
| 67 |
+
self.attribs['xmlns'] = "http://www.w3.org/2000/svg"
|
| 68 |
+
self.attribs['xmlns:xlink'] = "http://www.w3.org/1999/xlink"
|
| 69 |
+
self.attribs['xmlns:ev'] = "http://www.w3.org/2001/xml-events"
|
| 70 |
+
|
| 71 |
+
self.attribs['baseProfile'] = profile
|
| 72 |
+
self.attribs['version'] = version
|
| 73 |
+
return super(Drawing, self).get_xml()
|
| 74 |
+
|
| 75 |
+
def add_stylesheet(self, href, title, alternate="no", media="screen"):
|
| 76 |
+
""" Add a stylesheet reference.
|
| 77 |
+
|
| 78 |
+
:param string href: link to stylesheet <URI>
|
| 79 |
+
:param string title: name of stylesheet
|
| 80 |
+
:param string alternate: ``'yes'|'no'``
|
| 81 |
+
:param string media: ``'all | aureal | braille | embossed | handheld | print | projection | screen | tty | tv'``
|
| 82 |
+
|
| 83 |
+
"""
|
| 84 |
+
self._stylesheets.append((href, title, alternate, media))
|
| 85 |
+
|
| 86 |
+
def write(self, fileobj, pretty=False, indent=2):
|
| 87 |
+
""" Write XML string to `fileobj`.
|
| 88 |
+
|
| 89 |
+
:param fileobj: a file-like object
|
| 90 |
+
:param pretty: True for easy readable output
|
| 91 |
+
:param indent: how much to indent if pretty is enabled, by default 2 spaces
|
| 92 |
+
|
| 93 |
+
Python 3.x - set encoding at the open command::
|
| 94 |
+
|
| 95 |
+
open('filename', 'w', encoding='utf-8')
|
| 96 |
+
"""
|
| 97 |
+
# write xml header
|
| 98 |
+
fileobj.write('<?xml version="1.0" encoding="utf-8" ?>\n')
|
| 99 |
+
|
| 100 |
+
# don't use DOCTYPE. It's useless. see also:
|
| 101 |
+
# http://tech.groups.yahoo.com/group/svg-developers/message/48562
|
| 102 |
+
# write stylesheets
|
| 103 |
+
stylesheet_template = '<?xml-stylesheet href="%s" type="text/css" ' \
|
| 104 |
+
'title="%s" alternate="%s" media="%s"?>\n'
|
| 105 |
+
# removed map(), does not work with Python 3
|
| 106 |
+
for stylesheet in self._stylesheets:
|
| 107 |
+
fileobj.write(stylesheet_template % stylesheet)
|
| 108 |
+
|
| 109 |
+
xml_string = self.tostring()
|
| 110 |
+
if pretty: # write easy readable XML file
|
| 111 |
+
xml_string = pretty_xml(xml_string, indent=indent)
|
| 112 |
+
fileobj.write(xml_string)
|
| 113 |
+
|
| 114 |
+
def save(self, pretty=False, indent=2):
|
| 115 |
+
""" Write the XML string to `self.filename`.
|
| 116 |
+
|
| 117 |
+
:param pretty: True for easy readable output
|
| 118 |
+
:param indent: how much to indent if pretty is enabled, by default 2 spaces
|
| 119 |
+
"""
|
| 120 |
+
fileobj = io.open(self.filename, mode='w', encoding='utf-8')
|
| 121 |
+
self.write(fileobj, pretty=pretty, indent=indent)
|
| 122 |
+
fileobj.close()
|
| 123 |
+
|
| 124 |
+
def saveas(self, filename, pretty=False, indent=2):
|
| 125 |
+
""" Write the XML string to `filename`.
|
| 126 |
+
|
| 127 |
+
:param string filename: filesystem filename valid for :func:`open`
|
| 128 |
+
:param pretty: True for easy readable output
|
| 129 |
+
:param indent: how much to indent if pretty is enabled, by default 2 spaces
|
| 130 |
+
"""
|
| 131 |
+
self.filename = filename
|
| 132 |
+
self.save(pretty=pretty, indent=indent)
|
| 133 |
+
|
| 134 |
+
def _repr_svg_(self):
|
| 135 |
+
""" Show SVG in IPython, Jupyter Notebook, and Jupyter Lab
|
| 136 |
+
|
| 137 |
+
:return: unicode XML string of this object and all its subelements
|
| 138 |
+
|
| 139 |
+
"""
|
| 140 |
+
return self.tostring()
|
falcon/lib/python3.10/site-packages/svgwrite/etree.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
#coding:utf-8
|
| 3 |
+
# Author: mozman
|
| 4 |
+
# Purpose: a hack to generate XML containing CDATA by ElementTree
|
| 5 |
+
# Created: 26.05.2012
|
| 6 |
+
# Copyright (C) 2012, Manfred Moitzi
|
| 7 |
+
# License: MIT License
|
| 8 |
+
|
| 9 |
+
# usage:
|
| 10 |
+
#
|
| 11 |
+
# from svgwrite.etree import etree, CDATA
|
| 12 |
+
#
|
| 13 |
+
# element = etree.Element('myTag')
|
| 14 |
+
# element.append(CDATA("< and >"))
|
| 15 |
+
#
|
| 16 |
+
# assert etree.tostring(element) == "<myTag><![CDATA[< and >]]></myTag>"
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
import sys
|
| 20 |
+
PY3 = sys.version_info[0] > 2
|
| 21 |
+
|
| 22 |
+
import xml.etree.ElementTree as etree
|
| 23 |
+
|
| 24 |
+
CDATA_TPL = "<![CDATA[%s]]>"
|
| 25 |
+
CDATA_TAG = CDATA_TPL
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def CDATA(text):
|
| 29 |
+
element = etree.Element(CDATA_TAG)
|
| 30 |
+
element.text = text
|
| 31 |
+
return element
|
| 32 |
+
|
| 33 |
+
original_serialize_xml = etree._serialize_xml
|
| 34 |
+
|
| 35 |
+
if PY3:
|
| 36 |
+
def _serialize_xml_with_CDATA_support(write, elem, qnames, namespaces, **kwargs):
|
| 37 |
+
if elem.tag == CDATA_TAG:
|
| 38 |
+
write(CDATA_TPL % elem.text)
|
| 39 |
+
else:
|
| 40 |
+
original_serialize_xml(write, elem, qnames, namespaces, **kwargs)
|
| 41 |
+
else:
|
| 42 |
+
def _serialize_xml_with_CDATA_support(write, elem, encoding, qnames, namespaces):
|
| 43 |
+
if elem.tag == CDATA_TAG:
|
| 44 |
+
write(CDATA_TPL % elem.text.encode(encoding))
|
| 45 |
+
else:
|
| 46 |
+
original_serialize_xml(write, elem, encoding, qnames, namespaces)
|
| 47 |
+
|
| 48 |
+
# ugly, ugly, ugly patching
|
| 49 |
+
etree._serialize_xml = _serialize_xml_with_CDATA_support
|
falcon/lib/python3.10/site-packages/svgwrite/extensions/__init__.py
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (c) 2018 Manfred Moitzi
|
| 2 |
+
# License: MIT License
|
| 3 |
+
from .inkscape import Inkscape
|