Skip to main content

Non-official Mathematicians Of The Day output from website

Project description

MOTD

Retrieve famous 'Mathematicians Of The Day' from http://mathshistory.st-andrews.ac.uk/Day_files/Year.html

Disclaimer: This package is not supported by the University of St-Andrews. This is not an official package!

Output's format is JSON.

0.2

Modify to English words command and method names

Usage as a library

Minimal example

>>> import motd
>>> motd.motd()
<motd.motd.motd object at 0x7fd2675eb550>
>>> motd.motd().out()
'{"30/12": [{"year": 1869, "fname": "Emilie", "name": "MARTIN", "event": "birth"}, {"year": 1897, "fname": "Stanis\\u0142aw", "name": "SAKS", "event": "birth"}, {"year": 1691, "fname": "Robert", "name": "BOYLE", "event": "death"}, {"year": 1932, "fname": "Eliakim", "name": "MOORE", "event": "death"}, {"year": 1947, "fname": "Alfred North", "name": "WHITEHEAD", "event": "death"}, {"year": 1956, "fname": "Heinrich", "name": "SCHOLZ", "event": "death"}, {"year": 1978, "fname": "Mark Aronovich", "name": "NAIMARK", "event": "death"}, {"year": 1982, "fname": "Philip", "name": "HALL", "event": "death"}]}'
>>> 

Options

The constructor admits two optional arguments:

  • day specifying date using a string formated as DD/MM (default is the current system day)
  • delta specifying the number of days before (negative integer) or after (positivie integer) day value. (default is 0)
>>> import motd
>>> motd.motd('01/01').out()
'{"01/01": [{"year": 1803, "fname": "Guglielmo", "name": "LIBRI", "event": "birth"}, ...
>>> import motd
>>> motd.motd(delta=1).out()
'{"31/12": [{"year": 1856, "fname": "William", "name": "THOMSON", "event": "birth"}, ...
>>> import motd
>>> motd.motd('01/01', delta=-2).out()
'{"30/12": [{"year": 1869, "fname": "Emilie", "name": "MARTIN", "event": "birth"}, ...
>>> import motd
>>> motd.motd(day='01/01', delta=-2).out()
'{"30/12": [{"year": 1869, "fname": "Emilie", "name": "MARTIN", "event": "birth"}, ...

Usage in standalone app (code below)

How-to use it

  1. Copy next code content in a motd file.

  2. Change eventually the shebang line and make the file executable chmod 755 motd

  3. Move it in a path known by your shell. For example: ~/.local/bin

  4. Session example

$ motd
1869 birth Emilie MARTIN
1897 birth Stanisław SAKS
1691 death Robert BOYLE
1932 death Eliakim MOORE
1947 death Alfred North WHITEHEAD
1956 death Heinrich SCHOLZ
1978 death Mark Aronovich NAIMARK
1982 death Philip HALL
$ motd -d 01/01
1803 birth Guglielmo LIBRI
1878 birth Agner ERLANG
1886 birth Alexander Barrie GRIEVE
1894 birth Satyendranath BOSE
1905 birth Stanisław MAZUR
1912 birth Boris Vladimirovich GNEDENKO
1923 birth Daniel GORENSTEIN
1924 birth Jacques DIXMIER
1931 birth Sergei Ivanovich ADIAN
1748 death Johann BERNOULLI
1787 death Anastácio da CUNHA
...
$ motd -d 01/01 -1
1856 birth William THOMSON
1872 birth Volodymyr LEVYTSKY
1896 birth Carl SIEGEL
1916 birth Douglas NORTHCOTT
1937 birth Vladimir MAZ'YA
1945 birth Leonard ADLEMAN
1952 birth Vaughan JONES
1610 death Ludolph Van CEULEN
1659 death János APÁCZAI
1679 death Giovanni Alfonso BORELLI
1719 death John FLAMSTEED
1894 death Thomas STIELTJES
1912 death Robert FERGUSON
1944 death Nikolai Evgrafovich KOCHIN
1956 death Edwin P ADAMS
1962 death Charles Galton DARWIN
1982 death Kurt FRIEDRICHS

Further you can pipe with sort command.

You can also change source code of the app to output different lines.

Standalone app code

#!/usr/bin/python3
__author__ = "David COBAC"
__date__ = 20191230

import motd
import json
import argparse


parseur_args = argparse.ArgumentParser(
    description="""Mathematicians Of The Day from website
    http://mathshistory.st-andrews.ac.uk/Day_files/Year.html
    not an official package""")

parseur_args.add_argument('-d', '--day', help='DD/MM')
parseur_args.add_argument('delta',
                          nargs='?',
                          default='+0')

args = parseur_args.parse_args()

m = motd.motd(args.day, args.delta)
dico = json.loads(m.sortie())
for k in dico:
    # print(k)
    for entree in dico[k]:
        s = str(entree['year'])
        s += " "
        s += entree['event']
        s += " "
        s += entree['fname']
        s += " "
        s += entree['name']
        #
        print(s)

about

motd is rather an attempt to publish on the PyPi packages index than a fully completed python project, I do not recommend to use it for professionnal purpose. You have to consider this package as an experiment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

motd-0.3.0.tar.gz (84.0 kB view details)

Uploaded Source

Built Distribution

motd-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file motd-0.3.0.tar.gz.

File metadata

  • Download URL: motd-0.3.0.tar.gz
  • Upload date:
  • Size: 84.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for motd-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4ec56bd4b50317bae25d66c83da65365e279ee6f55322ac2e5d8b337f734fefc
MD5 e059f56d2d35b9798525868787bffa58
BLAKE2b-256 b535e9b21cf550a84f69f9c30a40af1be5d93589722315d9ba89dbee73d613ce

See more details on using hashes here.

File details

Details for the file motd-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: motd-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for motd-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 478f15087fba6df3949a34fffe0570059a16cdadb446ce11d2253a7df96cc4f8
MD5 2bfdcc5e78d65ee38d880abc525f5bf6
BLAKE2b-256 963c815eb47d9b49bf73eabdde9dc945a1da3136fc6666a36e0ba0b7cfeaa3b2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page