Пример #1
0
 def do(self, operations, input_str, flow_name):
     if input_str in operations :            
         Flow.create_flow(operations[input_str], StringUtils.camelize(operations[input_str])).step_one()
     elif (input_str == "9"):
       exit()          
     else:
         print("Wrong Selection: \n")
         Flow.create_flow(flow_name, StringUtils.camelize(flow_name)).menu()
Пример #2
0
 def do(self, operations, input_str, flow_name):
     if input_str in operations:
         Flow.create_flow(operations[input_str],
                          StringUtils.camelize(
                              operations[input_str])).step_one()
     elif (input_str == "9"):
         exit()
     else:
         print("Wrong Selection: \n")
         Flow.create_flow(flow_name, StringUtils.camelize(flow_name)).menu()
Пример #3
0
 def step_one(self):
     self.first_number = input("Enter the first number: \n")
     if StringUtils.is_number(self.first_number):
         self.step_two()
     else:
         print("Please enter a valid number: \n")
         self.step_one()
Пример #4
0
 def step_one(self):
   self.first_number =  input("Enter the first number: \n")
   if StringUtils.is_number(self.first_number):
       self.step_two()
   else:
       print("Please enter a valid number: \n")
       self.step_one()
Пример #5
0
 def __str__(self):
     # TODO understand unicode conversion issue in more details
     # return self.__class__.__name__ + \
     #        " { name: " + self.name + \
     #        ", display_name: " + str(self.display_name) + " }"
     # UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 7: ordinal not in range(128)
     return self.__class__.__name__ + \
            " { name: " + self.name + \
            ", display_name: " + StringUtils.replace_special_chars(self.display_name) + " }"
Пример #6
0
 def step_two(self):
     self.second_number = input("Enter the second number: \n")
     if not StringUtils.is_number(self.second_number):
         print("Please enter a valid number: \n")
         self.step_two()
     else:
         print(self.do())
         print("\n")
         calculator_flow = CalculatorFlow()
         calculator_flow.menu()
Пример #7
0
 def step_two(self):
     self.second_number =  input("Enter the second number: \n")              
     if not StringUtils.is_number(self.second_number):          
       print("Please enter a valid number: \n")
       self.step_two()
     else:
       print(self.do())
       print("\n")
       calculator_flow = CalculatorFlow()
       calculator_flow.menu()
Пример #8
0
import discord
import asyncio
from discord.ext import commands
from string_utils import StringUtils
from random import randint

bot = commands.Bot(command_prefix="?")
utils = StringUtils(dict="dictionary.json")

@bot.event
async def on_ready():
    print("Bot succesfully started")


@bot.event
async def on_message(message):

    if message.author.bot or message.content == "":
        return

    list_to_check = message.content.split()
    vulgar = False
    to_send = "**" + message.author.mention + " **powiedział(a):\n"

    for word in list_to_check:
        to_check = utils.refactor(word)
        result = utils.binary_search_by_distance(to_check, utils.dictionaries["dict"], 0)
        if result:
            print("Word %s succesfuly cenzored" % word)
            vulgar = True
            i = randint(0, len(utils.dictionaries["dict"][result]["synonyms"])-1)
Пример #9
0
 def run(self):
     msisdn = input("Enter your MSISDN: \n #123# for Banking \n #234# for Calculator \n") 
     if msisdn in self.flows:            
         Flow.create_flow(self.flows[msisdn], StringUtils.camelize(self.flows[msisdn])).menu()         
     else:
         self.run()