A fortune teller package, built with build using setuptools, uploaded to PyPI using twine, and distributed via pip.
Project description
Python Fortune Teller Package
Andrei Stoica Brandon Chen Charlie Xiang Sanjaya Bhatta
Description
Fortuneteller gives you a fortune for various aspect of your life in order to get you along on your way. If you need general life advice or guidance, a quote will be given if you are looking to learn or detach. If you are stuck on a computer science project or assignment, this package will help you estimate when it will be completed by and even attempt to help you debug by giving a random common error. An inspirational fortune could also be given as a quote from a famous figure. For a lighter mood, a funnier/light-hearted fortune could be given as well.
Functions and their Args
getLiveAdvice(type, seed=None)
Returns a line of life advice, either focused on learning (learning) or detaching (detach) depending on the argument passed in with an optional seed argument.
Args:
- type: The type of life advice to be returned taken as either the String "learning" or "detach".
- seed: An optional seed to generate the same random result which is taken as a String or Integer.
Returns:
- A String representing the learning or detach advice.
getCSFortune(question, debug, seed=None)
Receives a question in the form of a String with a boolean value on whether it is for debugging purposes. An optional seed argument could be given to generate the same random result. Outputs a fortune on whether you will succeed in doing anything computer science related or not. If debugging, a random potential error is given or nothing at all if it is beyond fixing.
Args:
- question: A computer science related question that the user wants to be answer taken as a String.
- debug: A boolean indicating whether the question is for debugging purposes in which a potential error is returned to assist in debugging.
- seed: An optional seed to generate the same random result which is taken as a String or Integer.
Returns:
- A String representing a solution to common computer science problems or an estimation of when your task will be completed if at all.
getInspiration(name)
Receives either a famous person's name or an empty string, and returns a random inspirational quote by the specified person. If the string is empty, returns a random inspirational quote by a random person.
Args:
- name: A name of a famous person whose quote will be returned and taken as a String.
Returns:
- A String representing a quote by a specific or random famous person. If empty, a random quote will be given. If the requested famous person isn't in our data then an appropriate message is returned.
funny(name)
Receives the name of a person and return a funny quote if the person is one of the 6 preset.
Args:
- name: A name of a person whose quote will be returned and taken as a String.
Returns:
- A String representing a funny quote said by a specific or random famous person. If empty, a random quote will be given. If the requested famous person isn't in our data then an appropriate message is returned.
How to Import and Use
- Create a virtual environment using
python -m venv venvand enter the virtual environment usingsource venv/bin/activateorsource venv/Scripts/activate. - Install requirements using
python install -r requirements.txt. - Use
pip install fortunetelleracs1029==1.0.0in the command line to create a pipenv-managed virtual environment and install the latest version of this package. - Activate the virtual environment using
pipenv shell. - Create a Python program and import this package using
from fortunetelleracs1029 import fortuneteller. - Call the functions using
fortuneteller.{{function name}}. - Run your Python program using
python3 my_program_filename.py. - Type
exitto exit the virtual environment.
Example:
from fortunetelleracs1029 import fortuneteller
fortuneteller.getLifeAdvice("learning")
fortuneteller.getLifeAdvice("detach")
fortuneteller.getLifeAdvice("learning", "super cool seed")
fortuneteller.getLifeAdvice("detach", 12345)
fortuneteller.getCSFortune("Will I finish this project?", False)
fortuneteller.getCSFortune("Why is my code not compiling?", True)
fortuneteller.getCSFortune("Will I finish this project?", False, "super cool seed two")
fortuneteller.getCSFortune("Why is my code not compiling?", True, 123456)
fortuneteller.getInspiration("Lemony Snicket")
fortuneteller.getInspiration("Amelia Earhart")
fortuneteller.getInspiration("")
fortuneteller.getInspiration("A person who does not exist")
fortuneteller.funny("Steven Wright")
fortuneteller.funny("Oscar Wilde")
fortuneteller.funny("")
fortuneteller.funny("A person who does not exist")
How to Contribute, Build and Test
- Clone the project using
git clone https://github.com/software-students-fall2022/python-package-exercise-project-3-team-16.git. - Create a virtual environment using
python -m venv venvand enter the virtual environment usingsource venv/bin/activateorsource venv/Scripts/activate. - Enter the project directory using
cd python-package-exercise-project-3-team-16. - Install requirements using
python install -r requirements.txt. - Use
pip install fortunetelleracs1029==1.0.0in the command line to create a pipenv-managed virtual environment and install the latest version of this package. - Activate the virtual environment using
pipenv shell. - Edit the file
test_fortuneteller.pyto create or build upon test cases. - Build the project by running
python -m build. - Run the tests from the main project directory using
python3 -m pytest. - Type
exitto exit the virtual environment.
Example Test:
def test_getCSFortune_seed(self):
"""
Make sure that the text returned by the getCSFortune() function is the same when given the same seed.
"""
actual = fortuneteller.getCSFortune("question", True, "super secret seed")
for i in range(100):
assert actual == fortuneteller.getCSFortune("question", True, "super secret seed")
actual = fortuneteller.getCSFortune("question", False, "super secret seed")
for i in range(100):
assert actual == fortuneteller.getCSFortune("question", False, "super secret seed")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fortunetelleracs1029-1.0.0.tar.gz.
File metadata
- Download URL: fortunetelleracs1029-1.0.0.tar.gz
- Upload date:
- Size: 44.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
922bbccf71ce9b171b0a980a1268dbc8e73bf3b7ea4d48ce7715ffc5ad750d9c
|
|
| MD5 |
c59a24bfa83e47f78a6f0194c8b93bcd
|
|
| BLAKE2b-256 |
a22cb91edf7915b56281c749b37fa5ceae787b035765e8f09b4a736b9000b5ea
|
File details
Details for the file fortunetelleracs1029-1.0.0-py3-none-any.whl.
File metadata
- Download URL: fortunetelleracs1029-1.0.0-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
515f967206026f1317d2e7ffd25963cc08119b40d5235f601c828a2df526c9cb
|
|
| MD5 |
6521dcb765a8939693f7459147104fb7
|
|
| BLAKE2b-256 |
8fbf5291660b82ce305b215403f61d339ce158dad3fe1651544b1f022569a05a
|