<li><strong><codeclass="python hljs"><spanclass="hljs-string">'<time>'</span></code> - Time of day.</strong></li>
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'<str>'</span></code> - Any of above as a string: <codeclass="python hljs"><spanclass="hljs-string">'100 MB'</span></code>, <codeclass="python hljs"><spanclass="hljs-string">'1 month'</span></code>, <codeclass="python hljs"><spanclass="hljs-string">'monday at 12:00'</span></code>, …</strong></li>
</ul>
<div><h3id="retention">Retention</h3><p><strong>Sets a condition which old log files are deleted.</strong></p><pre><codeclass="python language-python hljs">retention=<int>|<datetime.timedelta>|<str>
<div><h3id="retention">Retention</h3><p><strong>Sets a condition which old log files get deleted.</strong></p><pre><codeclass="python language-python hljs">retention=<int>|<datetime.timedelta>|<str>
</code></pre></div>
@ -2228,7 +2228,7 @@ right = [[<span class="hljs-number">0.1</span>, <span class="hljs-number">0.6</s
<pre><codeclass="python language-python hljs"><tuple/int> = <Image>.getpixel((x, y)) <spanclass="hljs-comment"># Returns a pixel.</span>
<Image>.putpixel((x, y), <tuple/int>) <spanclass="hljs-comment"># Writes a pixel to image.</span>
<ImagingCore> = <Image>.getdata() <spanclass="hljs-comment"># Returns a sequence of pixels.</span>
<Image>.putdata(<list/tuple>)<spanclass="hljs-comment"># Writes a sequence of pixels.</span>
<Image>.putdata(<list/tuple/ImagingCore>) <spanclass="hljs-comment"># Writes a sequence of pixels.</span>
<Image>.paste(<Image>, (x, y)) <spanclass="hljs-comment"># Writes an image to image.</span>
</code></pre>
<div><h3id="modes-1">Modes</h3><ul>
@ -2239,9 +2239,9 @@ right = [[<span class="hljs-number">0.1</span>, <span class="hljs-number">0.6</s
<li><strong><codeclass="python hljs"><spanclass="hljs-string">'HSV'</span></code> - 3x8-bit pixels, Hue, Saturation, Value color space.</strong></li>
</ul><div><h3id="examples">Examples</h3><div><h4id="createsapngimageofarainbowgradient">Creates a PNG image of a rainbow gradient:</h4><pre><codeclass="python language-python hljs">WIDTH, HEIGHT = <spanclass="hljs-number">100</span>, <spanclass="hljs-number">100</span>
size = WIDTH * HEIGHT
hue = [<spanclass="hljs-number">255</span> * i/size <spanclass="hljs-keyword">for</span> i <spanclass="hljs-keyword">in</span> range(size)]
hues = [<spanclass="hljs-number">255</span> * i/size <spanclass="hljs-keyword">for</span> i <spanclass="hljs-keyword">in</span> range(size)]
file.writeframes(<spanclass="hljs-string">b''</span>.join(get_bytes(a) <spanclass="hljs-keyword">for</span> a <spanclass="hljs-keyword">in</span> frames_float))
file.writeframes(<spanclass="hljs-string">b''</span>.join(get_bytes(a) <spanclass="hljs-keyword">for</span> a <spanclass="hljs-keyword">in</span> float_samples))
</code></pre></div>
<div><h3id="examples-1">Examples</h3><div><h4id="savesasinewavetoamonowavfile">Saves a sine wave to a mono WAV file:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> math <spanclass="hljs-keyword">import</span> pi, sin
<div><h4id="addsnoisetoamonowavfile">Adds noise to a mono WAV file:</h4><pre><codeclass="python language-python hljs"><spanclass="hljs-keyword">from</span> random <spanclass="hljs-keyword">import</span> random
add_noise = <spanclass="hljs-keyword">lambda</span> value: value + (random()<spanclass="hljs-number">-0.5</span>) * <spanclass="hljs-number">0.03</span>
xxxxxxxxxx