def __init__(self, config): try: self.email = config['account'].split(':')[0] self.password = config['account'].split(':')[1] except: sys.exit(1) self.config = config self.randomWord = RandomWords() self.action = 'starting the oneCaptcha tool.' self.notification = None self.startTime = time.time() self.currentWatchTime = 0 self.completedSearches = 0 self.readStories = 0 self.currentTranslations = 0 self.completedEmailActions = 0 self.maxSearches = random.randint(int(self.config['settings']['min_searches']), int(self.config['settings']['max_searches'])) self.maxWatchTime = random.randint(int(self.config['settings']['min_watchTime']), int(self.config['settings']['max_watchTime'])) self.maxStories = random.randint(int(self.config['settings']['min_newsStories']), int(self.config['settings']['max_newsStories'])) self.maxTranslations = random.randint(int(self.config['settings']['min_translations']), int(self.config['settings']['max_translations'])) self.maxEmailActions = random.randint(int(self.config['settings']['min_emailActions']), int(self.config['settings']['max_emailActions'])) self.log = Logger(config['tid']).log
def index(request): singleword = 'hello' defination = '' translate = '' keys = '' values = '' word = '' if 'getword'in request.POST: r = RandomWords() dictionary = PyDictionary() word = r.get_random_word(hasDictionaryDef="true") wordone = word.replace('a','_') wordtwo = wordone.replace('e','_') wordthree = wordtwo.replace('i','_') singleword = wordthree.replace('o','_') try: defination = (dictionary.meaning(word)) values = defination.values() except: values = '' print(word) data = request.POST text = data['word'] print(text) if word == text: print('Hello') context = {'word': singleword,'defination':defination,'translate':translate,'values':values,'w':word} return render(request,'wordgame/game.html',context)
def generate_word(): rw = RandomWords() word = rw.get_random_word(hasDictionaryDef='true').upper() for i in word: if i == '-' or i == ' ': generate_word() return word
def create_repositories(driver, n): r = RandomWords() words = list() for i in range(n): print('Creating repository number %d...' % (i+1)) words = r.get_random_words(maxLength=15, limit=2) print('Random words generated in iteration %d: %r' % (i, words)) composed_repository_name = 'orarepo' for item in words: composed_repository_name = composed_repository_name + '-' + item print('Composed repository name: ' + composed_repository_name) # Convert to lowercasxe composed_repository_name = composed_repository_name.lower() driver.get('https://github.com/new') # Now, in github.com/new repository_name = driver.find_element_by_name('repository[name]') repository_description = driver.find_element_by_name('repository[description]') repository_readme_init = driver.find_element_by_id('repository_auto_init') repository_private = driver.find_element_by_id('repository_visibility_private') repository_name.send_keys(composed_repository_name) repository_description.send_keys('%s, generated using Selenium automation by jasperan: https://github.com/jasperan/orarepo-creator' % composed_repository_name) repository_readme_init.click() repository_private.click() time.sleep(.5) repository_create = driver.find_element_by_xpath('//*[@id="new_repository"]/div[3]/button') repository_create.click() print('Successfully created repository number %d.' % (i+1))
def getGibberishWords(n): gibberishWordsList = [] r = RandomWords() # For n entries for i in range(n): # Generate a random word and convert to Gibberish try: word = r.get_random_word() except: i = i - 1 continue print('Random Word:', word) # Following portion relates to word having more than one syllable ''''# Find all syllables in a word, then form gibberish word syllables = getAllSyllables(word) #gibberish = "" # Process each syllable #for syllable in syllables: ''' # Only single syllable words will be processed if syllable_count(word) > 1: print('Cannot process word having multiple syllables!') i = i - 1 continue gibberish = convertToGibberish(word) gibberishWordsList.append(gibberish) return gibberishWordsList
def main(): r = RandomWords() words = list() words = r.get_random_words(maxLength=15, limit=2) print('Random words: ', words) composed_repository_name = 'orarepo' for item in words: composed_repository_name = composed_repository_name + '-' + item print('Composed repository name: ' + composed_repository_name) # Convert to lowercasxe composed_repository_name = composed_repository_name.lower() # Now, we will initialize the repository in Github using os.system #location = input('Please introduce the pwd where you want to create the repositories:') #os.system('cd ' + location) os.system('mkdir /home/jasper/git/%s' % composed_repository_name) os.system('cd /home/jasper/git/%s' % composed_repository_name) os.system('git init /home/jasper/git/%s' % composed_repository_name) os.system('touch /home/jasper/git/%s/README.md' % composed_repository_name) os.system('echo %s >> /home/jasper/git/%s/README.md' % (composed_repository_name, composed_repository_name)) os.system('git add -A') os.system('git commit') os.system('git push --set-upstream origin master') #os.system('git remote add origin [email protected]/jasperan/%s' % composed_repository_name) os.system('git push')
def __init__(self, master): self.ranWordGen = RandomWords() print("check your internet connection!") master.title("Hangman") self.dashtext = StringVar() self.attempttext = StringVar() self.complicated = IntVar() self.dashes = Label(master, textvariable=self.dashtext) self.attempts = Label(master, textvariable=self.attempttext) self.dashes.pack() self.lives = IntVar() self.liveslabel = Label(master, textvariable=self.lives) self.liveslabel.pack() self.insert = Entry(master) self.insert.bind("<Return>", self.checkLetter) self.insert.pack() self.attempts.pack() self.newgame() self.playButton = Button(master, text="new Game", command=self.newgame) self.playButton.pack() self.quitButton = Button(master, text="quit", command=master.quit) self.quitButton.pack() self.ownwords = Checkbutton(master, text="random words", variable=self.complicated) self.ownwords.pack() self.insert.focus()
def get_a_new_word(): length = 4 r = RandomWords() word = '' while(len(word) !=length or does_contain_repeated_words(word)): word = r.get_random_word(hasDictionaryDef="true", includePartOfSpeech="verb", minLength=length, maxLength=length) return word
def generate_words(length): wordGenerator = RandomWords() print(length) word1 = wordGenerator.get_random_word(hasDictionaryDef='true', includePartOfSpeech='noun,adjective,verb', minCorpusCount=10000, excludePartOfSpeech='Pronoun,name', minLength=length, maxLength=length) word2 = wordGenerator.get_random_word(hasDictionaryDef='true', includePartOfSpeech='noun,adjective,verb', minCorpusCount=10000, excludePartOfSpeech='Pronoun,name', minLength=length, maxLength=length) print(word1, word2) return (word1,word2)
def main(): r = RandomWords() a = r.get_random_word() #generates random word print(a) good = [] #sotres correct guesses bad = [] #stores incorrect guesses for i in a: #adds underscores for each letter in the word so user can see good.append("_") guess = input("Enter a letter.\n") #user guesses a letter while len(bad) < 7: #user has total of 7 incorrect guesses if guess in good: #checks to see if user alreafy guessed a letter print("You've already guessed that letter.") if guess in bad: #removes guess from bad list if user already guessed it to avoid duplicates print("You've already guessed that letter.") bad.remove(guess) for i in range(len(a)): #iterates through letters of random word if a[i] == guess: #replaces underscore with letter of random word in good list good[i] = a[ i] #index of good aligns with the spelling of the random word if guess not in a: #adds incorrect guess to bad list print("No such letter.") bad.append(guess) if "_" not in good: #user wins if all the underscores in good list are gone print("Congratulaions! You've won. The word is", a) exit() print(good) #shows user their progress print("The incorrect letters you've guessed are", bad) guess = input("Enter another letter.\n") if len(bad) == 7: #user loses on 7th incorrect guess (hangman) print("You've lost. The word is", a)
def get_word_to_guess(): try: r = RandomWords() words_list = r.get_random_words() word_to_guess = words_list[random.randint(0, len(words_list) - 1)].lower() except TypeError as e: print( "-----------------------------------------------------------------------------------------" ) print( "'random_word' module did not succesfully return a list of words. Picking one from the default list." ) print( "-----------------------------------------------------------------------------------------" ) default_words = [ "noiseless", "day", "boring", "holiday", "grieving", "subtract", "love", "whine", "bustling", "craven", "guttural", "muscle", "choke", "oatmeal", "shrill", "shade", "can", "hilarious", "discreet", "big" ] word_to_guess = default_words[random.randint(0, len(default_words) - 1)].lower() return word_to_guess
def testing(): r = RandomWords() text = r.get_random_word() print("Testing using the word - " + text + "\n") for i in range(5,25,5): print(str(i) + " queries - " + str(test(text,i)) + " seconds") print("\n")
def Add_New_Milestone(self): r=RandomWords() name=r.get_random_word() self.driver.find_element_by_xpath(self.Addnewmilestone_button_xpath).click() self.driver.find_element_by_xpath(self.Name_text_xpath).send_keys(name) self.driver.find_element_by_xpath(self.Probabliity_text_xpath).send_keys('5') self.driver.find_element_by_xpath(self.Save_button_xpath).click()
def f_wordget(): while True: word = RandomWords().get_random_word() if f_wordcheck(word) == True: word = word.lower() break return (word)
async def word(ctx): dictionary = PyDictionary() while True: try: ranWord = RandomWords() word = ranWord.get_random_word(hasDictionaryDef="true") print(word) meaning = dictionary.meaning(word) synonyms = dictionary.synonym(word) antonyms = dictionary.antonym(word) break except Exception: pass cleanMeaning = str(meaning).replace('{', '').replace('[', '').replace( ']', '').replace('}', '').replace("'", '') cleanSyns = str(synonyms).replace('[', '').replace(']', '').replace("'", '') cleanAnt = str(antonyms).replace('[', '').replace(']', '').replace("'", '') wordEmbed = discord.Embed(title=f"Random Word - {word.capitalize()}", description=f"{cleanMeaning}\n", color=0xB87DDF) wordEmbed.add_field(name="Synonyms", value=cleanSyns) wordEmbed.add_field(name="Antonyms", value=cleanAnt) await ctx.channel.send(embed=wordEmbed)
def __random_password_gen__(self): r = RandomWords() randomWords = r.get_random_words() print(randomWords) password = randomWords[0] + "-" + randomWords[1] + "-" + randomWords[ 2] + "-" + randomWords[3] return password
def fill_data(userinfo): name = driver.find_element_by_name("name") email = driver.find_element_by_name("email") title = driver.find_element_by_name("title") author = driver.find_element_by_name("author") genre = driver.find_element_by_name("genre") color = driver.find_element_by_name("color") keyword = driver.find_element_by_name("keyword") inspiration = driver.find_element_by_name("inspiration") remarks = driver.find_element_by_name("remarks") word = RandomWords() genre_array = [ 'Action', 'Adventure', 'Comedy', 'Drama', 'Fantasy', 'Horror', 'Romance', 'Tragedy' ] color_array = ['Red', 'Blue', 'Green', 'Yellow', 'Gray', 'Black', 'White'] genre_number = randrange(0, len(genre_array) - 1, 1) color_number = randrange(0, len(color_array) - 1, 1) new_title = word.get_random_word() name.send_keys(userinfo[0]) email.send_keys(userinfo[1]) title.send_keys(new_title) author.send_keys(userinfo[0]) genre.send_keys(genre_array[genre_number]) color.send_keys(color_array[color_number]) keyword.send_keys(word.get_random_word()) inspiration.send_keys("wwww.wrapyourbook.com") remarks.send_keys(word.get_random_word()) print("\nName of the book: " + new_title + "\n") print("Username: "******"User Email: " + userinfo[1] + "\n")
def get_band_name(optional_word): r = RandomWords() random_word = str(r.get_random_word()) random_word2 = str(r.get_random_word()) and_the = "and the" band_name = optional_word + " " + and_the + " " + random_word + " " + random_word2 return band_name
def getRandomWord(): if RandomWords is not None: r = RandomWords() return r.get_random_word() else: import random return str(random.randint(1000, 9999))
def gen_word(): r = RandomWords() random_words = r.get_random_words() gen_random_number = random.randint(1, len(random_words)) #print(random_words[gen_random_number]) random_word = random_words[gen_random_number] return random_word
def update_songs(cur, conn): #get a random word from rand word generator r = RandomWords() rw = r.get_random_word() #plug word into spotify and get list of songs get_artists(rw, cur, conn) get_songs(rw, cur, conn)
def execute(self, context): from random_word import RandomWords r = RandomWords() word = r.get_random_word() bpy.ops.object.text_add() ob = bpy.context.object ob.data.body = word return {"FINISHED"}
def __init__(self): self.dic = PyDictionary() self.rw = RandomWords() self.playing = True self.compwords = [] self.playerwords = []
def create_list(length): r = RandomWords() list = [] for i in range(int(length)): list.append(r.get_random_word()) print(list) return list
def getWord(): try: rand = RandomWords() word = rand.get_random_word(hasDictionaryDef="true").lower() except: words = ["summer", "autumn", "winter", "spring"] word = words[random.randrange(0, words.__len__())] return word
def update_songs(cur, conn): result = 1 while result == -1: #get a random word from rand word generator r = RandomWords() rw = r.get_random_word() #plug word into spotify and update tables result = get_songs(rw, cur, conn)
def _name(self, name) -> str: if name: return name # If name is not provided, return a random name else: r = RandomWords() words = r.get_random_words(minLength=8, limit=3) random_package_name = "_".join(words).lower() return random_package_name
def __generate_word(self): r = RandomWords() return r.get_random_word(hasDictionaryDef="true", includePartOfSpeech="noun,verb", minCorpusCount=1, maxCorpusCount=10, minDictionaryCount=1, maxDictionaryCount=10, minLength=5)
def concat(string): global RANDOM from random_word import RandomWords if RANDOM is None: RANDOM = RandomWords() r = RANDOM.get_random_word() return f'{r} {string}'
def hangman(): r = RandomWords() wor = r.get_random_word() word = list(wor) word1 = wor guess = len(word) segment1 = list(len(word) * "_") length = len(word) while 0 <= guess <= len(word1) + 1: segment3 = [] print(f'You have {guess} chances left! ') ui = list( input( f'Guess the letter it is a {len(word)} letters word. Only {length} letters limited : ' )) if len(ui) <= length: for item in ui: if item in list(word): length -= 1 value = word.index(item) segment1[value] = item word.pop(value) word.insert(value, "_") else: print(f"Not allowed {len(ui)} letters!") if not 0 <= guess <= len(word1) + 1: break if length == 0: break for item in segment1: segment3.append(item) segment2 = '' for i in segment3: segment2 += i print(segment2) guess -= 1 if length == 0: print('You nailed it!') print(str(wor)) else: print("Sorry, you failed it!") print(str(wor))