forked from kyclark/tiny_python_projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
joy
committed
Oct 7, 2021
1 parent
5ce2d01
commit 8953e20
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Author : NowHappy <[email protected]> | ||
Date : 2021-10-07 | ||
Purpose: Heap abuse | ||
""" | ||
|
||
import argparse | ||
import random | ||
|
||
|
||
# -------------------------------------------------- | ||
def get_args(): | ||
"""Get command-line arguments""" | ||
|
||
parser = argparse.ArgumentParser( | ||
description='Heap abuse', | ||
formatter_class=argparse.ArgumentDefaultsHelpFormatter) | ||
|
||
parser.add_argument('-a', | ||
'--adjectives', | ||
help='Number of adjectives', | ||
metavar='adjectives', | ||
type=int, | ||
default=2) | ||
|
||
parser.add_argument('-n', | ||
'--number', | ||
help='Number of insults', | ||
metavar='insults', | ||
type=int, | ||
default=3) | ||
|
||
parser.add_argument('-s', | ||
'--seed', | ||
help='Random seed', | ||
metavar='seed', | ||
type=int, | ||
default=None) | ||
|
||
args = parser.parse_args() | ||
|
||
if args.adjectives < 1: | ||
parser.error(f'--adjectives "{args.adjectives}" must be > 0') | ||
|
||
if args.number < 1: | ||
parser.error(f'--number "{args.number}" must be > 0') | ||
|
||
return args | ||
|
||
|
||
# -------------------------------------------------- | ||
def main(): | ||
"""Make a jazz noise here""" | ||
|
||
args = get_args() | ||
random.seed(args.seed) | ||
|
||
adjective_list = '''bankrupt base caterwauling corrupt cullionly detestable dishonest false | ||
filthsome filthy foolish foul gross heedless indistinguishable infected | ||
insatiate irksome lascivious lecherous loathsome lubbery old peevish | ||
rascaly rotten ruinous scurilous scurvy slanderous sodden-witted | ||
thin-faced toad-spotted unmannered vile wall-eyed'''.split() | ||
|
||
noun_list = '''Judas Satan ape ass barbermonger beggar block boy braggart butt | ||
carbuncle coward coxcomb cur dandy degenerate fiend fishmonger fool | ||
gull harpy jack jolthead knave liar lunatic maw milksop minion | ||
ratcatcher recreant rogue scold slave swine traitor varlet villain worm'''.split() | ||
|
||
for _ in range(args.number): | ||
print(f'You {", ".join(random.sample(adjective_list, args.adjectives))} {random.choice(noun_list)}!') | ||
|
||
|
||
# -------------------------------------------------- | ||
if __name__ == '__main__': | ||
main() |