forked from mattgd/UnitConverter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathunit_dictionary.py
122 lines (117 loc) · 2.95 KB
/
unit_dictionary.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import math
class dictionary:
# Metric and Imperial systems
__metric_dict = {
'E': 1000000000000000000,
'P': 1000000000000000,
'T': 1000000000000,
'G': 1000000000,
'M': 1000000,
'k': 1000,
'h': 100,
'da': 10,
None: 1,
'd': .1,
'c': .01,
'm': .001,
'μ': .000001,
'n': .000000001,
'p': .000000000001,
'f': .000000000000001,
'a': .000000000000000001
}
__imperial_dist_dict = {
'lea': 190080,
'mi': 63360,
'fu': 7920,
'ch': 792,
'rod': 198,
'yd': 36,
'ft': 12,
'li': 7.92,
'in': 1,
'th': .001
}
__imperial_vol_dict = {
'gal': 128,
'qt': 32,
'pt': 16,
'gi': 4,
'floz': 1
}
__imperial_mass_dict = {
't': 2240,
'cwt': 112,
'qr': 28,
'qtr': 28,
'st': 14,
'lb': 1,
'oz': .0625,
'dr': .00390625,
'gr': .00014285714
}
# Time
# __time_dict = {
# 'Ys': math.pow(10, 24),
# 'Zs': math.pow(10, 21),
# 'Es': math.pow(10, 18),
# 'Ps': math.pow(10, 15),
# 'Ts': math.pow(10, 12),
# 'Gs': math.pow(10, 9),
# ('yr', 'yrs', 'year', 'years'): 31540000,
# ('mo', 'mos', 'month', 'months'): 2628000,
# 'Ms': math.pow(10, 6),
# ('wk', 'week', 'weeks'): 604800,
# 'day': 86400,
# ('hr', 'hour', 'hours'): 3600,
# 'ks': 1000,
# ('min', 'minutes'): 60,
# ('s', 'sec', 'second', 'seconds'): 1,
# 'ds': .1,
# 'cs': .01,
# 'ms': .001,
# 'µs': math.pow(10, -6),
# 'ns': math.pow(10, -9),
# 'ps': math.pow(10, -12),
# 'fs': math.pow(10, -15),
# 'as': math.pow(10, -18),
# 'zs': math.pow(10, -21),
# 'ys': math.pow(10, -24)
# }
__time_dict = {
'Ys': math.pow(10, 24),
'Zs': math.pow(10, 21),
'Es': math.pow(10, 18),
'Ps': math.pow(10, 15),
'Ts': math.pow(10, 12),
'Gs': math.pow(10, 9),
'yr': 31540000,
'mo': 2628000,
'Ms': math.pow(10, 6),
'wk': 604800,
'day': 86400,
'hr': 3600,
'ks': 1000,
'min': 60,
's': 1,
'ds': .1,
'cs': .01,
'ms': .001,
'µs': math.pow(10, -6),
'ns': math.pow(10, -9),
'ps': math.pow(10, -12),
'fs': math.pow(10, -15),
'as': math.pow(10, -18),
'zs': math.pow(10, -21),
'ys': math.pow(10, -24)
}
def metric_dict(self):
return self.__metric_dict
def imperial_dist_dict(self):
return self.__imperial_dist_dict
def imperial_vol_dict(self):
return self.__imperial_vol_dict
def imperial_mass_dict(self):
return self.__imperial_mass_dict
def time_dict(self):
return self.__time_dict