~ubuntu-branches/ubuntu/natty/pytables/natty-updates

« back to all changes in this revision

Viewing changes to doc/html/x5902.html

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2006-06-28 10:45:03 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20060628104503-cc251q5o5j3e2k10
  * Fixed call to pyversions in debian/rules which failed on recent versions 
    of pyversions
  * Fixed clean rule in debian/rules which left the stamp files behind
  * Acknowledge NMU
  * Added Alexandre Fayolle to uploaders

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>FileNode module
 
6
            reference</TITLE
 
7
><META
 
8
NAME="GENERATOR"
 
9
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
 
10
REL="HOME"
 
11
TITLE="PyTables User's Guide"
 
12
HREF="index.html"><LINK
 
13
REL="UP"
 
14
TITLE="FileNode - simulating a filesystem with PyTables"
 
15
HREF="c5708.html"><LINK
 
16
REL="PREVIOUS"
 
17
TITLE="Current limitations"
 
18
HREF="x5885.html"><LINK
 
19
REL="NEXT"
 
20
TITLE="NetCDF - a PyTables
 
21
          NetCDF3 emulation API"
 
22
HREF="c6061.html"></HEAD
 
23
><BODY
 
24
CLASS="sect1"
 
25
BGCOLOR="#FFFFFF"
 
26
TEXT="#000000"
 
27
LINK="#0000FF"
 
28
VLINK="#840084"
 
29
ALINK="#0000FF"
 
30
><DIV
 
31
CLASS="NAVHEADER"
 
32
><TABLE
 
33
SUMMARY="Header navigation table"
 
34
WIDTH="100%"
 
35
BORDER="0"
 
36
CELLPADDING="0"
 
37
CELLSPACING="0"
 
38
><TR
 
39
><TH
 
40
COLSPAN="3"
 
41
ALIGN="center"
 
42
><SPAN
 
43
CLASS="markup"
 
44
>PyTables</SPAN
 
45
> User's Guide: Hierarchical datasets in Python - Release 1.3.2</TH
 
46
></TR
 
47
><TR
 
48
><TD
 
49
WIDTH="10%"
 
50
ALIGN="left"
 
51
VALIGN="bottom"
 
52
><A
 
53
HREF="x5885.html"
 
54
ACCESSKEY="P"
 
55
>Prev</A
 
56
></TD
 
57
><TD
 
58
WIDTH="80%"
 
59
ALIGN="center"
 
60
VALIGN="bottom"
 
61
>Chapter 6. FileNode - simulating a filesystem with <SPAN
 
62
CLASS="markup"
 
63
>PyTables</SPAN
 
64
></TD
 
65
><TD
 
66
WIDTH="10%"
 
67
ALIGN="right"
 
68
VALIGN="bottom"
 
69
><A
 
70
HREF="c6061.html"
 
71
ACCESSKEY="N"
 
72
>Next</A
 
73
></TD
 
74
></TR
 
75
></TABLE
 
76
><HR
 
77
ALIGN="LEFT"
 
78
WIDTH="100%"></DIV
 
79
><DIV
 
80
CLASS="sect1"
 
81
><H1
 
82
CLASS="sect1"
 
83
><A
 
84
NAME="section6.6"
 
85
>6.6. <SPAN
 
86
CLASS="markup"
 
87
>FileNode</SPAN
 
88
> module
 
89
            reference</A
 
90
></H1
 
91
><DIV
 
92
CLASS="sect2"
 
93
><H2
 
94
CLASS="sect2"
 
95
><A
 
96
NAME="subsection6.6.1"
 
97
>6.6.1. Global constants</A
 
98
></H2
 
99
><DIV
 
100
CLASS="glosslist"
 
101
><DL
 
102
><DT
 
103
><B
 
104
>NodeType</B
 
105
></DT
 
106
><DD
 
107
><P
 
108
>Value for <SAMP
 
109
CLASS="computeroutput"
 
110
>NODE_TYPE</SAMP
 
111
>
 
112
                node system attribute.</P
 
113
></DD
 
114
><DT
 
115
><B
 
116
>NodeTypeVersions</B
 
117
></DT
 
118
><DD
 
119
><P
 
120
>Supported values for
 
121
                <SAMP
 
122
CLASS="computeroutput"
 
123
>NODE_TYPE_VERSION</SAMP
 
124
> node system attribute.</P
 
125
></DD
 
126
></DL
 
127
></DIV
 
128
></DIV
 
129
><DIV
 
130
CLASS="sect2"
 
131
><H2
 
132
CLASS="sect2"
 
133
><A
 
134
NAME="subsection6.6.2"
 
135
>6.6.2. Global functions</A
 
136
></H2
 
137
><DIV
 
138
CLASS="sect3"
 
139
><H3
 
140
CLASS="sect3"
 
141
><A
 
142
NAME="subsubsection6.6.2.1"
 
143
>6.6.2.1. newNode(h5file, where, name, title="",
 
144
                filters=None, expectedsize=1000)</A
 
145
></H3
 
146
><P
 
147
>Creates a new file node object in the specified
 
148
                <SAMP
 
149
CLASS="computeroutput"
 
150
>PyTables</SAMP
 
151
> file object.  Additional named
 
152
                arguments <SAMP
 
153
CLASS="computeroutput"
 
154
>where</SAMP
 
155
> and <SAMP
 
156
CLASS="computeroutput"
 
157
>name</SAMP
 
158
> must
 
159
                be passed to specify where the file node is to be
 
160
                created.  Other named arguments such as
 
161
                <SAMP
 
162
CLASS="computeroutput"
 
163
>title</SAMP
 
164
> and <SAMP
 
165
CLASS="computeroutput"
 
166
>filters</SAMP
 
167
> may also be
 
168
                passed. The special named argument
 
169
                <SAMP
 
170
CLASS="computeroutput"
 
171
>expectedsize</SAMP
 
172
>, indicating an estimate of the
 
173
                file size in bytes, may also be passed. It returns the
 
174
                file node object.
 
175
              </P
 
176
></DIV
 
177
><DIV
 
178
CLASS="sect3"
 
179
><H3
 
180
CLASS="sect3"
 
181
><A
 
182
NAME="subsubsection6.6.2.2"
 
183
>6.6.2.2. openNode(node, mode = 'r')</A
 
184
></H3
 
185
><P
 
186
>Opens an existing file node. Returns a file node object
 
187
                from the existing specified PyTables node.  If mode is
 
188
                not specified or it is <SAMP
 
189
CLASS="computeroutput"
 
190
>'r'</SAMP
 
191
>, the file can
 
192
                only be read, and the pointer is positioned at the
 
193
                beginning of the file.  If mode is <SAMP
 
194
CLASS="computeroutput"
 
195
>'a+'</SAMP
 
196
>,
 
197
                the file can be read and appended, and the pointer is
 
198
                positioned at the end of the file.
 
199
              </P
 
200
></DIV
 
201
></DIV
 
202
><DIV
 
203
CLASS="sect2"
 
204
><H2
 
205
CLASS="sect2"
 
206
><A
 
207
NAME="subsection6.6.3"
 
208
>6.6.3. The <SPAN
 
209
CLASS="markup"
 
210
>FileNode</SPAN
 
211
>
 
212
              abstract class</A
 
213
></H2
 
214
><P
 
215
>This is the ancestor of <SAMP
 
216
CLASS="computeroutput"
 
217
>ROFileNode</SAMP
 
218
> and
 
219
              <SAMP
 
220
CLASS="computeroutput"
 
221
>RAFileNode</SAMP
 
222
> (see below). Instances of these
 
223
              classes are returned when <SAMP
 
224
CLASS="computeroutput"
 
225
>newNode()</SAMP
 
226
> or
 
227
              <SAMP
 
228
CLASS="computeroutput"
 
229
>openNode()</SAMP
 
230
> are called. It represents a new
 
231
              file node associated with a <SAMP
 
232
CLASS="computeroutput"
 
233
>PyTables</SAMP
 
234
> node,
 
235
              providing a standard Python file interface to it.
 
236
            </P
 
237
><P
 
238
>This abstract class provides only an implementation of
 
239
              the reading methods needed to implement a file-like object
 
240
              over a <SAMP
 
241
CLASS="computeroutput"
 
242
>PyTables</SAMP
 
243
> node.  The attribute set of
 
244
              the node becomes available via the <SAMP
 
245
CLASS="computeroutput"
 
246
>attrs</SAMP
 
247
>
 
248
              property.  You can add attributes there, but try to avoid
 
249
              attribute names in all caps or starting with
 
250
              <SAMP
 
251
CLASS="computeroutput"
 
252
>'_'</SAMP
 
253
>, since they may clash with internal
 
254
              attributes.
 
255
            </P
 
256
><P
 
257
>The node used as storage is also made available via the
 
258
              read-only attribute <SAMP
 
259
CLASS="computeroutput"
 
260
>node</SAMP
 
261
>.  Please do not
 
262
              tamper with this object unless unavoidably, since you may
 
263
              break the operation of the file node object.
 
264
            </P
 
265
><P
 
266
>The <SAMP
 
267
CLASS="computeroutput"
 
268
>lineSeparator</SAMP
 
269
> property contains the
 
270
              string used as a line separator, and defaults to
 
271
              <SAMP
 
272
CLASS="computeroutput"
 
273
>os.linesep</SAMP
 
274
>.  It can be set to any
 
275
              reasonably-sized string you want.
 
276
            </P
 
277
><P
 
278
>The constructor sets the <SAMP
 
279
CLASS="computeroutput"
 
280
>closed</SAMP
 
281
>,
 
282
              <SAMP
 
283
CLASS="computeroutput"
 
284
>softspace</SAMP
 
285
> and <SAMP
 
286
CLASS="computeroutput"
 
287
>_lineSeparator</SAMP
 
288
>
 
289
              attributes to their initial values, as well as the
 
290
              <SAMP
 
291
CLASS="computeroutput"
 
292
>node</SAMP
 
293
> attribute to <SAMP
 
294
CLASS="computeroutput"
 
295
>None</SAMP
 
296
>.
 
297
              Sub-classes should set the <SAMP
 
298
CLASS="computeroutput"
 
299
>node</SAMP
 
300
>,
 
301
              <SAMP
 
302
CLASS="computeroutput"
 
303
>mode</SAMP
 
304
> and <SAMP
 
305
CLASS="computeroutput"
 
306
>offset</SAMP
 
307
> attributes.
 
308
            </P
 
309
><P
 
310
>Version 1 implements the file storage as a
 
311
              <SAMP
 
312
CLASS="computeroutput"
 
313
>UInt8</SAMP
 
314
> uni-dimensional <SAMP
 
315
CLASS="computeroutput"
 
316
>EArray</SAMP
 
317
>.
 
318
            </P
 
319
><DIV
 
320
CLASS="sect3"
 
321
><H3
 
322
CLASS="sect3"
 
323
><A
 
324
NAME="subsubsection6.6.3.1"
 
325
>6.6.3.1. <SPAN
 
326
CLASS="markup"
 
327
>FileNode</SPAN
 
328
>
 
329
                methods</A
 
330
></H3
 
331
><DIV
 
332
CLASS="glosslist"
 
333
><DL
 
334
><DT
 
335
><B
 
336
>getLineSeparator()</B
 
337
></DT
 
338
><DD
 
339
><P
 
340
>Returns the line
 
341
                  separator string.</P
 
342
></DD
 
343
><DT
 
344
><B
 
345
>setLineSeparator()</B
 
346
></DT
 
347
><DD
 
348
><P
 
349
>Sets the line
 
350
                  separator string.</P
 
351
></DD
 
352
><DT
 
353
><B
 
354
>getAttrs()</B
 
355
></DT
 
356
><DD
 
357
><P
 
358
>Returns the attribute set
 
359
                  of the file node.</P
 
360
></DD
 
361
><DT
 
362
><B
 
363
>close()</B
 
364
></DT
 
365
><DD
 
366
><P
 
367
>Flushes the file and closes
 
368
                  it.  The <SAMP
 
369
CLASS="computeroutput"
 
370
>node</SAMP
 
371
> attribute becomes
 
372
                  <SAMP
 
373
CLASS="computeroutput"
 
374
>None</SAMP
 
375
> and the <SAMP
 
376
CLASS="computeroutput"
 
377
>attrs</SAMP
 
378
> property
 
379
                  becomes no longer available.</P
 
380
></DD
 
381
><DT
 
382
><B
 
383
>next()</B
 
384
></DT
 
385
><DD
 
386
><P
 
387
>Returns the next line of text.
 
388
                  Raises <SAMP
 
389
CLASS="computeroutput"
 
390
>StopIteration</SAMP
 
391
> when lines are
 
392
                  exhausted.  See <SAMP
 
393
CLASS="computeroutput"
 
394
>file.next.__doc__</SAMP
 
395
> for
 
396
                  more information.</P
 
397
></DD
 
398
><DT
 
399
><B
 
400
>read(size=None)</B
 
401
></DT
 
402
><DD
 
403
><P
 
404
>Reads at most
 
405
                  <SAMP
 
406
CLASS="computeroutput"
 
407
>size</SAMP
 
408
> bytes.  See
 
409
                  <SAMP
 
410
CLASS="computeroutput"
 
411
>file.read.__doc__</SAMP
 
412
> for more
 
413
                  information</P
 
414
></DD
 
415
><DT
 
416
><B
 
417
>readline(size=-1)</B
 
418
></DT
 
419
><DD
 
420
><P
 
421
>Reads the next text
 
422
                  line.  See <SAMP
 
423
CLASS="computeroutput"
 
424
>file.readline.__doc__</SAMP
 
425
> for more
 
426
                  information</P
 
427
></DD
 
428
><DT
 
429
><B
 
430
>readlines(sizehint=-1)</B
 
431
></DT
 
432
><DD
 
433
><P
 
434
>Reads the text
 
435
                  lines.  See <SAMP
 
436
CLASS="computeroutput"
 
437
>file.readlines.__doc__</SAMP
 
438
> for
 
439
                  more information.</P
 
440
></DD
 
441
><DT
 
442
><B
 
443
>seek(offset, whence=0)</B
 
444
></DT
 
445
><DD
 
446
><P
 
447
>Moves to a new
 
448
                  file position.  See <SAMP
 
449
CLASS="computeroutput"
 
450
>file.seek.__doc__</SAMP
 
451
> for
 
452
                  more information.</P
 
453
></DD
 
454
><DT
 
455
><B
 
456
>tell()</B
 
457
></DT
 
458
><DD
 
459
><P
 
460
> Gets the current file
 
461
                  position.  See <SAMP
 
462
CLASS="computeroutput"
 
463
>file.tell.__doc__</SAMP
 
464
> for more
 
465
                  information.</P
 
466
></DD
 
467
><DT
 
468
><B
 
469
>xreadlines()</B
 
470
></DT
 
471
><DD
 
472
><P
 
473
>For backward
 
474
                  compatibility.  See
 
475
                  <SAMP
 
476
CLASS="computeroutput"
 
477
>file.xreadlines.__doc__</SAMP
 
478
> for more
 
479
                  information.</P
 
480
></DD
 
481
></DL
 
482
></DIV
 
483
></DIV
 
484
></DIV
 
485
><DIV
 
486
CLASS="sect2"
 
487
><H2
 
488
CLASS="sect2"
 
489
><A
 
490
NAME="subsection6.6.4"
 
491
>6.6.4. The <SPAN
 
492
CLASS="markup"
 
493
>ROFileNode</SPAN
 
494
>
 
495
              class</A
 
496
></H2
 
497
><P
 
498
>Instances of this class are returned when
 
499
              <SAMP
 
500
CLASS="computeroutput"
 
501
>openNode()</SAMP
 
502
> is called in read-only mode
 
503
              (<SAMP
 
504
CLASS="computeroutput"
 
505
>'r'</SAMP
 
506
>). This is a descendant of
 
507
              <SAMP
 
508
CLASS="computeroutput"
 
509
>FileNode</SAMP
 
510
> class, so it inherits all its
 
511
              methods. Moreover, it does not define any other useful
 
512
              method, just some protections against users intents to
 
513
              write on file.
 
514
            </P
 
515
></DIV
 
516
><DIV
 
517
CLASS="sect2"
 
518
><H2
 
519
CLASS="sect2"
 
520
><A
 
521
NAME="subsection6.6.5"
 
522
>6.6.5. The <SPAN
 
523
CLASS="markup"
 
524
>RAFileNode</SPAN
 
525
>
 
526
              class</A
 
527
></H2
 
528
><P
 
529
>Instances of this class are returned when either
 
530
              <SAMP
 
531
CLASS="computeroutput"
 
532
>newNode()</SAMP
 
533
> is called or when
 
534
              <SAMP
 
535
CLASS="computeroutput"
 
536
>openNode()</SAMP
 
537
> is called in append mode
 
538
              (<SAMP
 
539
CLASS="computeroutput"
 
540
>'a+'</SAMP
 
541
>). This is a descendant of
 
542
              <SAMP
 
543
CLASS="computeroutput"
 
544
>FileNode</SAMP
 
545
> class, so it inherits all its
 
546
              methods. It provides additional methods that allow to
 
547
              write on file nodes.
 
548
            </P
 
549
><DIV
 
550
CLASS="glosslist"
 
551
><DL
 
552
><DT
 
553
><B
 
554
>flush()</B
 
555
></DT
 
556
><DD
 
557
><P
 
558
>Flushes the file node.  See
 
559
                <SAMP
 
560
CLASS="computeroutput"
 
561
>file.flush.__doc__</SAMP
 
562
> for more
 
563
                information.</P
 
564
></DD
 
565
><DT
 
566
><B
 
567
>truncate(size=None)</B
 
568
></DT
 
569
><DD
 
570
><P
 
571
>Truncates the file
 
572
                node to at most <SAMP
 
573
CLASS="computeroutput"
 
574
>size</SAMP
 
575
> bytes. Currently, this
 
576
                method only makes sense to grow the file node, since
 
577
                data can not be rewritten nor deleted.  See
 
578
                <SAMP
 
579
CLASS="computeroutput"
 
580
>file.truncate.__doc__</SAMP
 
581
> for more
 
582
                information.</P
 
583
></DD
 
584
><DT
 
585
><B
 
586
>write(string)</B
 
587
></DT
 
588
><DD
 
589
><P
 
590
>Writes the string to the
 
591
                file.  Writing an empty string does nothing, but
 
592
                requires the file to be open.  See
 
593
                <SAMP
 
594
CLASS="computeroutput"
 
595
>file.write.__doc__</SAMP
 
596
> for more
 
597
                information.</P
 
598
></DD
 
599
><DT
 
600
><B
 
601
>writelines(sequence)</B
 
602
></DT
 
603
><DD
 
604
><P
 
605
>Writes the
 
606
                sequence of strings to the file.  See
 
607
                <SAMP
 
608
CLASS="computeroutput"
 
609
>file.writelines.__doc__</SAMP
 
610
> for more
 
611
                information.</P
 
612
></DD
 
613
></DL
 
614
></DIV
 
615
></DIV
 
616
></DIV
 
617
><DIV
 
618
CLASS="NAVFOOTER"
 
619
><HR
 
620
ALIGN="LEFT"
 
621
WIDTH="100%"><TABLE
 
622
SUMMARY="Footer navigation table"
 
623
WIDTH="100%"
 
624
BORDER="0"
 
625
CELLPADDING="0"
 
626
CELLSPACING="0"
 
627
><TR
 
628
><TD
 
629
WIDTH="33%"
 
630
ALIGN="left"
 
631
VALIGN="top"
 
632
><A
 
633
HREF="x5885.html"
 
634
ACCESSKEY="P"
 
635
>Prev</A
 
636
></TD
 
637
><TD
 
638
WIDTH="34%"
 
639
ALIGN="center"
 
640
VALIGN="top"
 
641
><A
 
642
HREF="index.html"
 
643
ACCESSKEY="H"
 
644
>Home</A
 
645
></TD
 
646
><TD
 
647
WIDTH="33%"
 
648
ALIGN="right"
 
649
VALIGN="top"
 
650
><A
 
651
HREF="c6061.html"
 
652
ACCESSKEY="N"
 
653
>Next</A
 
654
></TD
 
655
></TR
 
656
><TR
 
657
><TD
 
658
WIDTH="33%"
 
659
ALIGN="left"
 
660
VALIGN="top"
 
661
>Current limitations</TD
 
662
><TD
 
663
WIDTH="34%"
 
664
ALIGN="center"
 
665
VALIGN="top"
 
666
><A
 
667
HREF="c5708.html"
 
668
ACCESSKEY="U"
 
669
>Up</A
 
670
></TD
 
671
><TD
 
672
WIDTH="33%"
 
673
ALIGN="right"
 
674
VALIGN="top"
 
675
>NetCDF - a <SPAN
 
676
CLASS="markup"
 
677
>PyTables</SPAN
 
678
>
 
679
          NetCDF3 emulation API</TD
 
680
></TR
 
681
></TABLE
 
682
></DIV
 
683
></BODY
 
684
></HTML
 
685
>
 
 
b'\\ No newline at end of file'