Debian Codegraph @

weblogo/seq_io/null_io.py

raw
1 #!/usr/bin/env python
2
3 # Copyright (c) 2005 Gavin E. Crooks <[email protected]>
4 #
5 # This software is distributed under the MIT Open Source License.
6 # <http://www.opensource.org/licenses/mit-license.html>
7 #
8 # Permission is hereby granted, free of charge, to any person obtaining a
9 # copy of this software and associated documentation files (the "Software"),
10 # to deal in the Software without restriction, including without limitation
11 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 # and/or sell copies of the Software, and to permit persons to whom the
13 # Software is furnished to do so, subject to the following conditions:
14 #
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
17 #
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 # THE SOFTWARE.
25 #
26
27 """
28 Null sequence IO. Acts like /dev/null. Read returns empty sequences or sequence lists,
29 writes do nothing.
30 """
31
32 from typing import Iterator, Optional, TextIO
33
34 from ..seq import Alphabet, Seq, SeqList
35
36 names = ()
37 extensions = ()
38
39
40 def read(fin: TextIO, alphabet: Optional[Alphabet] = None) -> SeqList:
41 assert fin is not None # Do something with arguments to quiet pychecker
42 # if alphabet is not None:
43 # pass
44 return SeqList([])
45
46
47 def iterseq(fin: TextIO, alphabet: Optional[Alphabet] = None) -> Iterator[Seq]:
48 assert fin is not None
49 # if alphabet is not None:
50 # pass
51 yield Seq("")
52 return
53
54
55 def write(fout: TextIO, seqs: SeqList) -> None:
56 for s in seqs:
57 writeseq(fout, s)
58
59
60 def writeseq(fout: TextIO, seq: SeqList) -> None:
61 assert fout is not None
62 assert seq is not None
63 return