Giter VIP home page Giter VIP logo

randfacts's Introduction

PyPI AUR version Downloads PyPI license Maintenance GitHub Issues GitHub Workflow Status GitHub followers GitHub Repo stars
Kofi Badge

Randfacts is a Python module that generates random facts. You can use randfacts.get_fact() to return a random fun fact. Disclaimer: Facts are not guaranteed to be true.

Installation

randfacts can either be installed via pip or via the AUR, whichever way you prefer.

Installation via pip:

$ pip3 install randfacts

Installation via AUR:

Via your AUR helper, like paru:

$ paru -S python-randfacts

Or manually

$ git clone https://aur.archlinux.org/python-randfacts.git && cd python-randfacts
$ makepkg -si

Usage and examples

import randfacts
x = randfacts.get_fact()
print(x)

The above example will print a random fact like: Penguins can't taste sweet or savory flavors, only sour and salty ones

This package has a filter option to filter out potentially inappropriate facts. The filter is on by default. To disable the filter, you can just set the filter_enabled parameter to False.

from randfacts import get_fact
print(get_fact(False))
# or
print(get_fact(filter_enabled=False))

get_fact also has a parameter that will make the function only return unsafe facts. This argument takes precedence over the filter_enabled argument. For example:

print(get_fact(only_unsafe=True))

If you want to access the list of facts directly, you can just import the safe_facts, unsafe_facts, or all_facts lists from the randfacts module.

Command line usage

randfacts can be executed via the command line with the following commands:

Normal execution; only SFW (safe for work) facts

$ python3 -m randfacts

The unsafe argument can be supplied to provide only NSFW (not safe for work) facts

$ python3 -m randfacts --unsafe

The mixed argument can be provided to provide both SFW and NSFW facts.

$ python3 -m randfacts --mixed

More help.

$ python3 -m randfacts --help

randfacts's People

Contributors

andubadea avatar karimk123 avatar networkpsych avatar notkar1m avatar pancakeswastaken avatar tabulatejarl8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

randfacts's Issues

I can't get facts from the module

Describe the bug
I made a new file and ran
`import randfacts

x = randfacts.get_fact()

print(x)`

It is giving me
return codecs.charmap_decode(input,self.errors,decoding_table)[0] UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 2678: character maps to <undefined>

Expected behavior
It should give me a fact

Please complete the following information:

  • OS: Windows 10
  • Python version: python 3.9.5
  • Versionn: 0.7.3

test.py failure to complete test 3/3

Bug info:
The bug is a FileNotFoundError that originates in test.py and is affecting line 43 possibly line 46 (line numbers are from
the current 0.2.7 master) in the file due to a blank state in the variable basedir.

Steps to reproduce the behavior:

  1. Install the randfacts master on a test machine that is UNIX based
  2. Install randfacts master into the system using setup.py
  3. cd to tests and do sudo python3 test.py
  4. See Error

Intended result:
The test was intended to be completed successfully with no issues and terminate with no problems.

Actual result:
SEE SCREENSHOT

Screenshot before "suppression":
Screen Shot 2021-01-28 at 8 22 04 AM

Machine info:

  • OS: MacOS Catalina 10.15.7
  • Python version: 3.8.5
  • Package Version: 0.2.7 (but was detected on a 0.2.8 dev build)

Extras:
The problem was "suppressed" by adding a try-except around the affected area.

ChatGPT 3.5

I believe ChatGPT 3.5 is relying heavily on this repository. OpenAI may even be catching queries for facts directly and intercepting it to reply almost directly from here.
one it tends to like is this one:

  • Did you know that the shortest war in history was between Zanzibar and Great Britain in 1896? The war lasted just 38 minutes.
  • The shortest war in recorded history was between Britain and Zanzibar on August 27, 1896. The war lasted only 38 minutes.
  • The shortest war in history was between Zanzibar and Britain in 1896 and lasted only 38 minutes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.