-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro_unicode.py
executable file
·34 lines (28 loc) · 1.1 KB
/
astro_unicode.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# vim: set fileencoding=utf-8> :
import unicodedata
def to_unicode(ascii):
name = ascii.strip().upper()
if name == 'MARS':
return unicodedata.lookup('MALE SIGN')
elif name == 'VENUS':
return unicodedata.lookup('FEMALE SIGN')
elif name == 'MOON':
# There are two moons: first and last quarter
# First quarter matches the alchemical moon symbol
return unicodedata.lookup('FIRST QUARTER MOON')
elif name in ('DENEB', 'VEGA', 'ALTAIR'):
# Summer triangle
return unicodedata.lookup('WHITE UP-POINTING TRIANGLE')
elif name in ('RIGEL', 'ALDEBARAn', 'CAPELLA', 'POLLUX', 'PROCYON', 'SIRIUS', 'BETELGUESE'):
# Winter Hexagon plus Betelguese
# Orion's shoulder Betelguese is in the middle, and with Procyon and Siruis makes the winter triangle
return unicodedata.lookup('WHITE HEXAGON')
try:
return unicodedata.lookup(name)
except KeyError:
return None
if __name__ == '__main__':
import sys
symbols = [to_unicode(w) for w in sys.argv[1:]]
print u' '.join(symbols)