|
|
|
@ -2,6 +2,7 @@ import glob
|
|
|
|
|
import math
|
|
|
|
|
import mimetypes
|
|
|
|
|
import os
|
|
|
|
|
import queue
|
|
|
|
|
import subprocess
|
|
|
|
|
import urllib
|
|
|
|
|
import yaml
|
|
|
|
@ -23,6 +24,7 @@ class Soup(Bureau):
|
|
|
|
|
prefix = "SB"
|
|
|
|
|
version = 0
|
|
|
|
|
input_queue = []
|
|
|
|
|
pattern = ''
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
Bureau.__init__(self)
|
|
|
|
@ -40,13 +42,14 @@ class Soup(Bureau):
|
|
|
|
|
|
|
|
|
|
self.print_small(game)
|
|
|
|
|
|
|
|
|
|
@add_command("ptrn", 'Set Pattern')
|
|
|
|
|
@add_command("pa", 'Set Pattern')
|
|
|
|
|
def print_pattern(self, data):
|
|
|
|
|
"""
|
|
|
|
|
Prints a pattern composed with A and B characters.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
pattern, _ = data.split(".")
|
|
|
|
|
self.pattern = pattern
|
|
|
|
|
self.print_small(pattern)
|
|
|
|
|
|
|
|
|
|
@add_command('list', 'Return a list of contents')
|
|
|
|
@ -96,6 +99,34 @@ class Soup(Bureau):
|
|
|
|
|
# @add_command('fx', 'execute the chosen function')
|
|
|
|
|
# def ex_function
|
|
|
|
|
|
|
|
|
|
@add_command('wv', 'veawe 2 texts')
|
|
|
|
|
def weave(self):
|
|
|
|
|
|
|
|
|
|
result = ''
|
|
|
|
|
|
|
|
|
|
with open(os.path.join(self.mdir, 'contents', self.input_queue[0] + '.txt'), 'r') as f:
|
|
|
|
|
list_a = f.read().split(' ')
|
|
|
|
|
|
|
|
|
|
with open(os.path.join(self.mdir, 'contents', self.input_queue[1] + '.txt'), 'r') as f:
|
|
|
|
|
list_b = f.read().split(' ')
|
|
|
|
|
|
|
|
|
|
text_a_cursor = 0
|
|
|
|
|
text_b_cursor = 0
|
|
|
|
|
|
|
|
|
|
length = len(list_a) + len(list_b)
|
|
|
|
|
|
|
|
|
|
repeated_pattern = (self.pattern * (length // len(self.pattern))
|
|
|
|
|
) + (length % self.pattern)
|
|
|
|
|
|
|
|
|
|
for choice in repeated_pattern:
|
|
|
|
|
if choice == 'A':
|
|
|
|
|
result += list_a[text_a_cursor]
|
|
|
|
|
text_a_cursor += 1
|
|
|
|
|
if choice == 'B':
|
|
|
|
|
result += list_b[text_b_cursor]
|
|
|
|
|
text_b_cursor += 1
|
|
|
|
|
self.print_small(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
sb = Soup()
|
|
|
|
|