예제 #1
0
 def answer(self, sender, message):
     args = message.strip()
     if args == "":
         channels = ["tf1", "france 2", "france 3", "canal+", "arte", "m6"]
         res = extract(Requete.SOIREE)
         return u"\n".join("%s : %s" % (key, res[key]) for key in channels)
     else:
         res = extract(Requete.TNT)
         try:
             return u"%s : %s" % (args, res[args.lower()])
         except KeyError:
             return u"%s n'est pas une chaîne valide... Regardez le help pour plus d'informations" % args
예제 #2
0
    def __init__(self, bot):
        desc = u"""tv
Donne les programmes tv de la soirée
Les chaînes disponibles sont les suivantes :
%s""" % (", ".join(sorted(extract(Requete.TNT).keys())))
        SyncModule.__init__(self,
                            bot,
                            desc=desc,
                            name="tv")
import parser

parser.extract('test.fastq', 'output_test.fastq', 5, frozenset(['header1', 'header3']))

with open('output_test.fastq') as f:
	lines = list(f.readlines())
	text = ''.join(lines)
	print(text)
	print(type(text))
	assert 'header1' in text
	assert 'header2' not in text
	assert 'header3' not in text
예제 #4
0
 def channels(self, sender):
     return u"Les chaînes valides sont les suivantes :\n%s" % (", ".join(sorted(extract(Requete.TNT).keys())))
import parser

parser.extract('test.fastq', 'output_test.fastq', 5,
               frozenset(['header1', 'header3']))

with open('output_test.fastq') as f:
    lines = list(f.readlines())
    text = ''.join(lines)
    print(text)
    print(type(text))
    assert 'header1' in text
    assert 'header2' not in text
    assert 'header3' not in text