This repository has been archived by the owner on May 16, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
colour.utilities.data_structures.html
652 lines (602 loc) · 36.6 KB
/
colour.utilities.data_structures.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>colour.utilities.data_structures Module — Colour 0.3.5 documentation</title>
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/bootswatch-3.1.0/colour/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
<link rel="stylesheet" href="_static/styles.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.3.5',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.1.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="top" title="Colour 0.3.5 documentation" href="index.html" />
<link rel="up" title="colour.utilities Package" href="colour.utilities.html" />
<link rel="next" title="colour.utilities.verbose Module" href="colour.utilities.verbose.html" />
<link rel="prev" title="colour.utilities.common Module" href="colour.utilities.common.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body>
<div id="navbar" class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="_static/Colour_Logo_Icon_001.png">
Colour 0.3</a>
<!--<span class="navbar-text navbar-version pull-left"><b>0.3</b></span>-->
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li class="divider-vertical"></li>
<li><a href="http://colour-science.org">colour-science.org</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-life-ring"> Documentation</i><b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="api.html" class="fa fa-life-ring"> API Reference</a>
</li>
<li>
<a href="http://nbviewer.ipython.org/github/colour-science/colour-ipython/blob/master/notebooks/colour.ipynb', True)" class="fa fa-book"> IPython Notebooks</a>
</li>
<li>
<a href="http://colour-science.org/features.php" class="fa fa-lightbulb-o"> Features</a>
</li>
<li>
<a href="http://colour-science.org/contributing.php"><span class="fa fa-gears"> Contributing</span></a>
</li>
</ul>
</li>
<li>
<a href="colour.utilities.common.html" title="Previous Chapter: colour.utilities.common Module"><span class="glyphicon glyphicon-chevron-left visible-sm"></span><span class="hidden-sm">« colour.utilities...</span>
</a>
</li>
<li>
<a href="colour.utilities.verbose.html" title="Next Chapter: colour.utilities.verbose Module"><span class="glyphicon glyphicon-chevron-right visible-sm"></span><span class="hidden-sm">colour.utilities... »</span>
</a>
</li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="section" id="module-colour.utilities.data_structures">
<span id="colour-utilities-data-structures-module"></span><h1>colour.utilities.data_structures Module<a class="headerlink" href="#module-colour.utilities.data_structures" title="Permalink to this headline">¶</a></h1>
<div class="section" id="data-structures">
<h2>Data Structures<a class="headerlink" href="#data-structures" title="Permalink to this headline">¶</a></h2>
<p>Defines various data structures classes:</p>
<ul class="simple">
<li><a class="reference internal" href="#colour.utilities.data_structures.Structure" title="colour.utilities.data_structures.Structure"><tt class="xref py py-class docutils literal"><span class="pre">Structure</span></tt></a>: An object similar to C/C++ structured type.</li>
<li><a class="reference internal" href="#colour.utilities.data_structures.Lookup" title="colour.utilities.data_structures.Lookup"><tt class="xref py py-class docutils literal"><span class="pre">Lookup</span></tt></a>: A <em>dict</em> sub-class acting as a lookup to retrieve keys by
values.</li>
</ul>
<dl class="class">
<dt id="colour.utilities.data_structures.Structure">
<em class="property">class </em><tt class="descclassname">colour.utilities.data_structures.</tt><tt class="descname">Structure</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Structure"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Structure" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></p>
<p>Defines an object similar to C/C++ structured type.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>*args</strong> (<em>*</em>) – Arguments.</li>
<li><strong>**kwargs</strong> (<em>dict</em>) – Key / Value pairs.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">References</p>
<table class="docutils footnote" frame="void" id="id1" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[1]</td><td>Mansencal, T. (n.d.). Structure. Retrieved from
<a class="reference external" href="https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py">https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py</a></td></tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">person</span> <span class="o">=</span> <span class="n">Structure</span><span class="p">(</span><span class="n">first_name</span><span class="o">=</span><span class="s">'Doe'</span><span class="p">,</span> <span class="n">last_name</span><span class="o">=</span><span class="s">'John'</span><span class="p">,</span> <span class="n">gender</span><span class="o">=</span><span class="s">'male'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="c"># Doctests skip for Python 2.x compatibility.</span>
<span class="gp">>>> </span><span class="n">person</span><span class="o">.</span><span class="n">first_name</span>
<span class="go">'Doe'</span>
<span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">person</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span>
<span class="go">['first_name', 'gender', 'last_name']</span>
<span class="gp">>>> </span><span class="c"># Doctests skip for Python 2.x compatibility.</span>
<span class="gp">>>> </span><span class="n">person</span><span class="p">[</span><span class="s">'gender'</span><span class="p">]</span>
<span class="go">'male'</span>
</pre></div>
</div>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.__delattr__">
<tt class="descname">__delattr__</tt><big>(</big><em>attribute</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Structure.__delattr__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Structure.__delattr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes both key and sibling attribute.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>attribute</strong> (<em>object</em>) – Attribute.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.__delattr__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.__delitem__">
<tt class="descname">__delitem__</tt><big>(</big><em>attribute</em><big>)</big><a class="headerlink" href="#colour.utilities.data_structures.Structure.__delitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes both key and sibling attribute.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>attribute</strong> (<em>object</em>) – Attribute.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.__delattr__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.__getattr__">
<tt class="descname">__getattr__</tt><big>(</big><em>attribute</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Structure.__getattr__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Structure.__getattr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns given attribute value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>attribute</strong> (<em>unicode</em>) – Attribute name.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.__getattr__()</span></tt> method.</li>
</ul>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Attribute value.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><tt class="xref py py-exc docutils literal"><span class="pre">AttributeError</span></tt> –
If the attribute is not defined.</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.__setattr__">
<tt class="descname">__setattr__</tt><big>(</big><em>attribute</em>, <em>value</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Structure.__setattr__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Structure.__setattr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets both key and sibling attribute with given value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>attribute</strong> (<em>object</em>) – Attribute.</li>
<li><strong>value</strong> (<em>object</em>) – Value.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.__setattr__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.__setitem__">
<tt class="descname">__setitem__</tt><big>(</big><em>attribute</em>, <em>value</em><big>)</big><a class="headerlink" href="#colour.utilities.data_structures.Structure.__setitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets both key and sibling attribute with given value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>attribute</strong> (<em>object</em>) – Attribute.</li>
<li><strong>value</strong> (<em>object</em>) – Value.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.__setattr__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Structure.update">
<tt class="descname">update</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Structure.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Structure.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Updates both keys and sibling attributes.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>*args</strong> (<em>*</em>) – Arguments.</li>
<li><strong>**kwargs</strong> (<em>**</em>) – Keywords arguments.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">dict.update()</span></tt> method.</li>
</ul>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="colour.utilities.data_structures.Lookup">
<em class="property">class </em><tt class="descclassname">colour.utilities.data_structures.</tt><tt class="descname">Lookup</tt><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Lookup"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Lookup" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt></p>
<p>Extends <em>dict</em> type to provide a lookup by value(s).</p>
<p class="rubric">References</p>
<table class="docutils footnote" frame="void" id="id2" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[2]</td><td>Mansencal, T. (n.d.). Lookup. Retrieved from
<a class="reference external" href="https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py">https://github.com/KelSolaar/Foundations/blob/develop/foundations/data_structures.py</a></td></tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">person</span> <span class="o">=</span> <span class="n">Lookup</span><span class="p">(</span><span class="n">first_name</span><span class="o">=</span><span class="s">'Doe'</span><span class="p">,</span> <span class="n">last_name</span><span class="o">=</span><span class="s">'John'</span><span class="p">,</span> <span class="n">gender</span><span class="o">=</span><span class="s">'male'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">person</span><span class="o">.</span><span class="n">first_key_from_value</span><span class="p">(</span><span class="s">'Doe'</span><span class="p">)</span>
<span class="go">'first_name'</span>
<span class="gp">>>> </span><span class="n">persons</span> <span class="o">=</span> <span class="n">Lookup</span><span class="p">(</span><span class="n">John</span><span class="o">=</span><span class="s">'Doe'</span><span class="p">,</span> <span class="n">Jane</span><span class="o">=</span><span class="s">'Doe'</span><span class="p">,</span> <span class="n">Luke</span><span class="o">=</span><span class="s">'Skywalker'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="nb">sorted</span><span class="p">(</span><span class="n">persons</span><span class="o">.</span><span class="n">keys_from_value</span><span class="p">(</span><span class="s">'Doe'</span><span class="p">))</span>
<span class="go">['Jane', 'John']</span>
</pre></div>
</div>
<dl class="method">
<dt id="colour.utilities.data_structures.Lookup.first_key_from_value">
<tt class="descname">first_key_from_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Lookup.first_key_from_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Lookup.first_key_from_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the first key with given value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>object</em>) – Value.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Key.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.Lookup.keys_from_value">
<tt class="descname">keys_from_value</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#Lookup.keys_from_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.Lookup.keys_from_value" title="Permalink to this definition">¶</a></dt>
<dd><p>Gets the keys with given value.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>value</strong> (<em>object</em>) – Value.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Keys.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping">
<em class="property">class </em><tt class="descclassname">colour.utilities.data_structures.</tt><tt class="descname">CaseInsensitiveMapping</tt><big>(</big><em>data=None</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">_abcoll.MutableMapping</span></tt></p>
<p>Implements a case-insensitive mutable mapping / <em>dict</em> object.</p>
<p>Allows values retrieving from keys while ignoring the key case.
The keys are expected to be unicode or string-like objects supporting the
<tt class="xref py py-meth docutils literal"><span class="pre">str.lower()</span></tt> method.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>data</strong> (<em>dict</em>) – <em>dict</em> of data to store into the mapping at initialisation.</li>
<li><strong>**kwargs</strong> (<em>dict</em>) – Key / Value pairs to store into the mapping at initialisation.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The keys are expected to be unicode or string-like objects.</p>
</div>
<p class="rubric">References</p>
<table class="docutils footnote" frame="void" id="id3" rules="none">
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label">[3]</td><td>Reitz, K. (n.d.). CaseInsensitiveDict. Retrieved from
<a class="reference external" href="https://github.com/kennethreitz/requests/blob/v1.2.3/requests/structures.py#L37">https://github.com/kennethreitz/requests/blob/v1.2.3/requests/structures.py#L37</a></td></tr>
</tbody>
</table>
<p class="rubric">Examples</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">methods</span> <span class="o">=</span> <span class="n">CaseInsensitiveMapping</span><span class="p">({</span><span class="s">'McCamy'</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s">'Hernandez'</span><span class="p">:</span> <span class="mi">2</span><span class="p">})</span>
<span class="gp">>>> </span><span class="n">methods</span><span class="p">[</span><span class="s">'mccamy'</span><span class="p">]</span>
<span class="go">1</span>
</pre></div>
</div>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__contains__">
<tt class="descname">__contains__</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__contains__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__contains__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns if the mapping contains given item.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> (<em>unicode</em>) – Item name.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Is item in mapping.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__contains__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__delitem__">
<tt class="descname">__delitem__</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__delitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__delitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Deletes the item with given name.</p>
<p>The item is deleted from the mapping using its lower name.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> (<em>unicode</em>) – Item name.</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__delitem__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__eq__">
<tt class="descname">__eq__</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__eq__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__eq__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the equality with given object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> – Object item.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Equality.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__eq__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__getitem__">
<tt class="descname">__getitem__</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__getitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__getitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the value of given item.</p>
<p>The item value is retrieved using its lower name in the mapping.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> (<em>unicode</em>) – Item name.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Item value</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">object</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__getitem__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__iter__">
<tt class="descname">__iter__</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__iter__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__iter__" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterates over the items names in the mapping.</p>
<p>The item names returned are the original input ones.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Item names.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">generator</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__iter__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__len__">
<tt class="descname">__len__</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__len__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__len__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the items count.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Items count.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">int</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__iter__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__ne__">
<tt class="descname">__ne__</tt><big>(</big><em>item</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__ne__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__ne__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the inequality with given object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>item</strong> – Object item.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Inequality.</td>
</tr>
<tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">bool</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__ne__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__repr__">
<tt class="descname">__repr__</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__repr__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__repr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the mapping representation with the original item names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Mapping representation.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">unicode</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__repr__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.__setitem__">
<tt class="descname">__setitem__</tt><big>(</big><em>item</em>, <em>value</em><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.__setitem__"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.__setitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Sets given item with given value.</p>
<p>The item is stored as lower in the mapping while the original name and
its value are stored together as the value in a <em>tuple</em>:</p>
<p>{“item.lower()”: (“item”, value)}</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>item</strong> (<em>object</em>) – Attribute.</li>
<li><strong>value</strong> (<em>object</em>) – Value.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>Reimplements the <tt class="xref py py-meth docutils literal"><span class="pre">MutableMapping.__setitem__()</span></tt> method.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.copy">
<tt class="descname">copy</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.copy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a copy of the mapping.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Mapping copy.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">CaseInsensitiveMapping</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<ul class="simple">
<li>The <a class="reference internal" href="#colour.utilities.data_structures.CaseInsensitiveMapping" title="colour.utilities.data_structures.CaseInsensitiveMapping"><tt class="xref py py-class docutils literal"><span class="pre">CaseInsensitiveMapping</span></tt></a> class copy returned is a simple
<em>copy</em> not a <em>deepcopy</em>.</li>
</ul>
</dd></dl>
<dl class="method">
<dt id="colour.utilities.data_structures.CaseInsensitiveMapping.lower_items">
<tt class="descname">lower_items</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/colour/utilities/data_structures.html#CaseInsensitiveMapping.lower_items"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#colour.utilities.data_structures.CaseInsensitiveMapping.lower_items" title="Permalink to this definition">¶</a></dt>
<dd><p>Iterates over the lower items names.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">Lower item names.</td>
</tr>
<tr class="field-even field"><th class="field-name">Return type:</th><td class="field-body">generator</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p class="pull-right">
<a href="#">Back to top</a>
</p>
<p>
© Copyright 2013 - 2015, Colour Developers.<br/>
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.2.<br/>
</p>
</div>
</footer>
</body>
</html>