-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenums.py
More file actions
90 lines (83 loc) · 1.52 KB
/
enums.py
File metadata and controls
90 lines (83 loc) · 1.52 KB
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
from enum import Enum
class Genre(Enum):
ALTERNATIVE='Alternative' #Should be named as constants. Not sure if this is true.
BLUES='Blues'
CLASSICAL='Classical'
COUNTRY='Country'
ELECTRONIC='Electronic'
FOLK='Folk'
FUNK='Funk'
HIPHOP='Hip-Hop' #Python variables cannot be separated by space or hypens in naming!
HEAVYMETAL='Heavy Metal'
INSTRUMENTAL='Instrumental'
JAZZ='Jazz'
MUSICALTHEATRE='Musical Theatre'
POP='Pop'
PUNK='Punk'
RB='R&B'
REGGAE='Reggae'
ROCK='Rock n Roll'
SOUL='Soul'
OTHER='Other'
@classmethod
def choices(cls):
""" Methods decorated with @classmethod can be called statically without having an instance of the class."""
return [(choice.value, choice.value) for choice in cls]
# To explain replacing (choice.name, choice.value) with (choice.name, choice.value), it was in short the only way to define constants and still maintain the previous genres choices.
class State(Enum):
AL='AL'
AK='AK'
AZ='AZ'
AR='AR'
CA='CA'
CO='CO'
CT='CT'
DE='DE'
DC='DC'
FL='FL'
GA='GA'
HI='HI'
ID='ID'
IL='IL'
IN='IN'
IA='IA'
KS='KS'
KY='KY'
LA='LA'
ME='ME'
MT='MT'
MD='MD'
MA='MA'
MI='MI'
MN='MN'
MS='MS'
MO='MO'
NE='NE'
NV='NV'
NH='NH'
NJ='NJ'
NM='NM'
NY='NY'
NC='NC'
ND='ND'
OH='OH'
OK='OK'
OR='OR'
PA='PA'
RI='RI'
SC='SC'
SD='SD'
TN='TN'
TX='TX'
UT='UT'
VT='VT'
VA='VA'
WA='WA'
WV='WV'
WI='WI'
WY='WY'
@classmethod
def choices(cls):
return [(choice.name, choice.value) for choice in cls]
# value=[(choice.name, choice.value) for choice in State]
# print(value)