Ejemplo n.º 1
0
 def phrasesub(self, text):
     out = ""
     inside = False
     for c in str(text):
         if inside:
             if c == "}":
                 if inside is True:
                     inside = ""
                 parts = inside.split(":")
                 if len(parts) == 2:
                     done = False
                     if parts[0] and parts[0] != "fut":
                         try:
                             hackergen.tense(parts[0])
                         except:
                             done = None
                         else:
                             done = True
                     if done is not None:
                         if not parts[1]:
                             out += getPhrase()
                             inside = False
                         else:
                             try:
                                 num = int(parts[1])
                             except ValueError:
                                 inside = parts[1]
                             else:
                                 out += getPhrase(num)
                                 inside = False
                         if done:
                             hackergen.tense("fut")
                 if inside is not False:
                     out += "{"+inside+"}"
                     inside = False
             elif inside is True:
                 inside = c
             else:
                 inside += c
         elif c == "{":
             if len(out) != 0 and out[-1] == "\\":
                 if len(out) != 1 and out[-2] == "\\":
                     out = out[:-1]
                     inside = True
                 else:
                     out = out[:-1]+c
             else:
                 inside = True
         else:
             out += c
     if inside is True:
         out += "{"
     elif inside:
         out += "{"+inside
     return out
Ejemplo n.º 2
0
 def phrasesub(self, text):
     out = ""
     inside = False
     for c in str(text):
         if inside:
             if c == "}":
                 if inside is True:
                     inside = ""
                 parts = inside.split(":")
                 if len(parts) == 2:
                     done = False
                     if parts[0] and parts[0] != "fut":
                         try:
                             hackergen.tense(parts[0])
                         except:
                             done = None
                         else:
                             done = True
                     if done is not None:
                         if not parts[1]:
                             out += getPhrase()
                             inside = False
                         else:
                             try:
                                 num = int(parts[1])
                             except ValueError:
                                 inside = parts[1]
                             else:
                                 out += getPhrase(num)
                                 inside = False
                         if done:
                             hackergen.tense("fut")
                 if inside is not False:
                     out += "{" + inside + "}"
                     inside = False
             elif inside is True:
                 inside = c
             else:
                 inside += c
         elif c == "{":
             if len(out) != 0 and out[-1] == "\\":
                 if len(out) != 1 and out[-2] == "\\":
                     out = out[:-1]
                     inside = True
                 else:
                     out = out[:-1] + c
             else:
                 inside = True
         else:
             out += c
     if inside is True:
         out += "{"
     elif inside:
         out += "{" + inside
     return out
Ejemplo n.º 3
0
    formatisyes,
    formatisno,
    madeof,
    containsany,
    re
    )

try:
    import hackergen.phrasegen as hackergen
except ImportError:
    try:
        import hackergen
    except ImportError:
        hackergen = None
else:
    hackergen.tense("fut")

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# CODE AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

def getPhrase(*args, **kwargs):
    out = hackergen.getPhrase(*args, **kwargs)
    if out.endswith("."):
        out = out[:-1]
    return out

class card(object):
    def __init__(self, text, scan=False):
        if hackergen:
            out = self.phrasesub(text)
Ejemplo n.º 4
0
from __future__ import with_statement, unicode_literals, print_function
from rabbit.all import basicformat
import socket
import random
import re
from collections import deque

try:
    import hackergen.phrasegen as hackergen
except ImportError:
    try:
        import hackergen
    except ImportError:
        hackergen = None
else:
    hackergen.tense("fut")

#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# CODE AREA: (IMPORTANT: DO NOT MODIFY THIS SECTION!)
#-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


# fake substitute for popup
def popup():
    pass


def getPhrase(*args, **kwargs):
    out = hackergen.getPhrase(*args, **kwargs)
    if out.endswith("."):
        out = out[:-1]