Giter VIP home page Giter VIP logo

countdoom's Introduction

🤯
Countdoom
or; How I Learned to Stop Worrying and Love the Clock 🕚

GitHub release Commits to be deployed Python Package Index Python versions Travis CI Documentation status CodeCov coverage Code Climate maintainability CodeFactor rating Code style: black License All contributors Tweet

Python package to fetch and digest the current Doomsday Clock world threat assessment from TheBulletin.org.

Free software released under MIT License, with source code available on GitHub, Python package distributed on PyPI, and documentation hosted on Read the Docs.

Be sure to ⭐️ or 🔱 this repo if you find it useful! 😃

Command-line interface output

Countdoom: a Doomsday Clock client.

Table of Contents 📑

  1. Features
  2. Installation
  3. Usage
  4. Contributors
  5. Related projects
  6. Thanks

🔝

Features CodeCov coverage Code Climate maintainability CodeFactor rating Code style: black

  • Fetches the current Doomsday Clock value from the Bulletin of the Atomic Scientists.
  • Converts the Doomsday Clock sentence into:
    • countdown seconds 60
    • countdown minutes 1
    • clock 11:59
    • time 23:59:00
  • Offers a command-line interface.
  • Uses Async IO for efficient Python integration.

🔝

Installation Python Package Index Python versions Python wheel

Countdoom is distributed on the Python Package Index (PyPI). The best way to install it is with pip:

Create a virtual environment (optional):

virtualenv countdoom-env

Install Countdoom:

pip install countdoom

Run Countdoom:

countdoom

To install from source, please refer to the online documentation 📘.

🔝

Usage 🕚

Example usage:

$ countdoom

 11 12   ️
10 \|      Countdoom: Doomsday Clock 🤯 🌊 ☢️ ☠️
9   @      World threat assessment from TheBulletin.org

 Sentence: IT IS 2 MINUTES TO MIDNIGHT
    Clock: 11:58
     Time: 23:58:00
  Minutes: 2
  Seconds: 120
Countdown: 120 seconds

Example usage using a single format (e.g. clock):

$ countdoom --format clock

11:58

Built-in help:

$ countdoom -h

 11 12   ️
10 \|      Countdoom: Doomsday Clock 🤯 🌊 ☢️ ☠️
9   @      World threat assessment from TheBulletin.org

usage: countdoom [--format {sentence,clock,time,minutes,countdown,all,json}]
                 [--timeout TIMEOUT] [--v] [-h]

optional arguments:
  --format {sentence,clock,time,countdown,all,json}
                        return data format (default: all).
  --timeout TIMEOUT     connection/request timeout in seconds (default: 10).
  --v, --version        show program's version number and exit
  -h, --help            show this help message and exit

"Be the change you want to see in the world." —Gandhi/Arleen Lorrance

For programmatic usage, please refer to the online documentation 📘.

🔝

Contributors ✨ All contributors CodeTriage helpers


René-Marc Simard

💻 📖 ⚠️

This project follows the all-contributors specification (emoji key available here). Found a bug, want to suggest an idea or share some improvements? Contributions of any kind are welcome! 😃

🔝

Related projects 👫

🔝

Thanks 💕

🔝

Don't forget to ⭐️ or 🔱 this repo! 😃
Built with ❤️ in Montréal.

countdoom's People

Contributors

renemarc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

countdoom's Issues

Bug: "ValueError: Invalid format string" when using countdoom from the command line

Bug Report

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Scripts\countdoom.exe\__main__.py", line 7, in <module>
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\site-packages\countdoom\cli.py", line 41, in cli
    loop.run_until_complete(main(args))
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\site-packages\countdoom\cli.py", line 73, in main
    data = await countdoom_client.fetch_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\site-packages\countdoom\client.py", line 131, in fetch_data
    'clock': self.clock(),
             ^^^^^^^^^^^^
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\site-packages\countdoom\client.py", line 85, in clock
    return self.countdown_to_time(self._countdown, clock_format)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Andrei\AppData\Local\Programs\Python\Python311\Lib\site-packages\countdoom\client.py", line 325, in countdown_to_time
    return (midnight - delta).strftime(time_format)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Invalid format string

Steps to Reproduce (unless obvious)

open cmd and type "countdoom" or run in python:

from typing import Dict, Union
import asyncio
from countdoom import CountdoomClient


async def async_get_doomsday_clock() -> Dict[str, Union[str, float, None]]:
    """
    Get current Doomsday Clock value using AsyncIO.

    :return: Dictionary of Doomsday Clock representation styles
    """
    client = CountdoomClient()
    data = await client.fetch_data()
    return data

async def main():
    doomsday_clock = await async_get_doomsday_clock()
    print("Doomsday Clock:", doomsday_clock)

asyncio.run(main())

Environment Info

Windows 10 22H2, python 3.11

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.