diff --git a/build/lib/markovbot/__init__.py b/build/lib/markovbot/__init__.py deleted file mode 100644 index d33a348..0000000 --- a/build/lib/markovbot/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -import argparse - -def parser() = - parser = argparse.ArgumentParser(description='Process some integers.') - parser.add_argument('--config', dest='filepath', metavar='CREDENTIALS', type=str, help='Path to config file') - parser.add_argument('text', metavar='CORPUS', type=str, help='path to the text you wish to mimic') # filepath should be a flag; corpus an argument! - parser.add_argument('--coke-binge', dest='coke_binge', action="store_true", default=False, help='Tweet excessively/emulate our POTUS') # instead of tweeting once, tweet a random number of times. - parser.add_argument('-t', dest='test', action="store_true", default=False, help='Test text generation without tweeting.') # distance on markov chains?? distance on syntax trees? # default to test or default to tweet?? - return parser.parse_args() - -# Function to help process credentials file -def drop_tag(str): - parsed = itertools.dropwhile(lambda x: x!= ':', str) - str2 = "".join(parsed) - parsed2 = itertools.dropwhile(lambda x: x == ' ' or x == ':', str2) - return "".join(parsed2) - -# Process api keys etc. -def make_api_keys(filepath): - # Open file with credentials - with open(filepath) as f: - content = f.readlines() - # Strip irrelevant text - let content = [drop_tag(x.strip()) for x in content] - # create twitter api object - return twitter.Api(consumer_key=content[0], - consumer_secret=content[1], - access_token_key=content[2], - access_token_secret=content[3]) diff --git a/build/scripts-3.5/markovbot b/build/scripts-3.5/markovbot deleted file mode 100755 index d31776c..0000000 --- a/build/scripts-3.5/markovbot +++ /dev/null @@ -1,41 +0,0 @@ -#!python -import markovify -import markovbot -import twitter -import itertools -import random - -# Command line parser - -args = parser() - -# Set the coke binge parameter -if args.coke_binge: - coke_binge_num = random.randint(1, 6) -else: - coke_binge_num = 1 - -# Get raw text of markov chain as string. -with open(args.text) as f: - text = f.read() - -# Build the model. -text_model = markovify.Text(text) - -api = make_api_keys(args.filepath) - -# Generate three randomly-generated sentences of no more than 140 characters and tweet them. -selected = False -for i in range(0, coke_binge_num): - while selected is False: - str_potentially = text_model.make_short_sentence(140) - if not("http" in str_potentially): - if not(args.test): - # tweet the generated text - status = api.PostUpdate(str_potentially) - print(status.text) # verify it worked - else: - # test mode; just display it - print(str_potentially) - selected = True - selected = False diff --git a/setup.py b/setup.py index 2923138..2fd4bca 100755 --- a/setup.py +++ b/setup.py @@ -10,7 +10,6 @@ setup(name='markovbot', packages=['markovbot'], scripts=['bin/markovbot'], install_requires=[ - 'gitpython', 'markovify', 'python-twitter', ],