1- from officers . types import OfficerPositionEnum
1+ from enum import StrEnum
22
33
4- class OfficerPosition :
4+ class OfficerPositionEnum ( StrEnum ) :
55 PRESIDENT = "president"
66 VICE_PRESIDENT = "vice-president"
77 TREASURER = "treasurer"
@@ -25,12 +25,13 @@ class OfficerPosition:
2525 WEBMASTER = "webmaster"
2626 SOCIAL_MEDIA_MANAGER = "social media manager"
2727
28+ class OfficerPosition :
2829 @staticmethod
2930 def position_list () -> list [OfficerPositionEnum ]:
3031 return _OFFICER_POSITION_LIST
3132
3233 @staticmethod
33- def length_in_semesters (position : str ) -> int | None :
34+ def length_in_semesters (position : OfficerPositionEnum ) -> int | None :
3435 # TODO (#101): ask the committee to maintain a json file with all the important details from the constitution
3536 """How many semester position is active for, according to the CSSS Constitution"""
3637 if position not in _LENGTH_MAP :
@@ -40,7 +41,7 @@ def length_in_semesters(position: str) -> int | None:
4041 return _LENGTH_MAP [position ]
4142
4243 @staticmethod
43- def to_email (position : str ) -> str | None :
44+ def to_email (position : OfficerPositionEnum ) -> str | None :
4445 return _EMAIL_MAP .get (position , None )
4546
4647 @staticmethod
@@ -50,13 +51,13 @@ def num_active(position: str) -> int | None:
5051 """
5152 # None means there can be any number active
5253 if (
53- position == OfficerPosition .EXECUTIVE_AT_LARGE
54- or position == OfficerPosition .FIRST_YEAR_REPRESENTATIVE
54+ position == OfficerPositionEnum .EXECUTIVE_AT_LARGE
55+ or position == OfficerPositionEnum .FIRST_YEAR_REPRESENTATIVE
5556 ):
5657 return 2
5758 elif (
58- position == OfficerPosition .FROSH_WEEK_CHAIR
59- or position == OfficerPosition .SOCIAL_MEDIA_MANAGER
59+ position == OfficerPositionEnum .FROSH_WEEK_CHAIR
60+ or position == OfficerPositionEnum .SOCIAL_MEDIA_MANAGER
6061 ):
6162 return None
6263 else :
@@ -68,90 +69,90 @@ def is_signer(position: str) -> bool:
6869 If the officer is a signing authority of the CSSS
6970 """
7071 return (
71- position == OfficerPosition .PRESIDENT
72- or position == OfficerPosition .VICE_PRESIDENT
73- or position == OfficerPosition .TREASURER
74- or position == OfficerPosition .DIRECTOR_OF_RESOURCES
75- or position == OfficerPosition .DIRECTOR_OF_EVENTS
72+ position == OfficerPositionEnum .PRESIDENT
73+ or position == OfficerPositionEnum .VICE_PRESIDENT
74+ or position == OfficerPositionEnum .TREASURER
75+ or position == OfficerPositionEnum .DIRECTOR_OF_RESOURCES
76+ or position == OfficerPositionEnum .DIRECTOR_OF_EVENTS
7677 )
7778
7879 @staticmethod
7980 def expected_positions () -> list [str ]:
8081 # TODO (#93): use this function in the daily cronjobs
8182 return [
82- OfficerPosition .PRESIDENT ,
83- OfficerPosition .VICE_PRESIDENT ,
84- OfficerPosition .TREASURER ,
85-
86- OfficerPosition .DIRECTOR_OF_RESOURCES ,
87- OfficerPosition .DIRECTOR_OF_EVENTS ,
88- OfficerPosition .DIRECTOR_OF_EDUCATIONAL_EVENTS ,
89- OfficerPosition .ASSISTANT_DIRECTOR_OF_EVENTS ,
90- OfficerPosition .DIRECTOR_OF_COMMUNICATIONS ,
91- #OfficerPosition .DIRECTOR_OF_OUTREACH, # TODO (#101): when https://github.com/CSSS/documents/pull/9/files merged
92- OfficerPosition .DIRECTOR_OF_MULTIMEDIA ,
93- OfficerPosition .DIRECTOR_OF_ARCHIVES ,
94- OfficerPosition .EXECUTIVE_AT_LARGE ,
83+ OfficerPositionEnum .PRESIDENT ,
84+ OfficerPositionEnum .VICE_PRESIDENT ,
85+ OfficerPositionEnum .TREASURER ,
86+
87+ OfficerPositionEnum .DIRECTOR_OF_RESOURCES ,
88+ OfficerPositionEnum .DIRECTOR_OF_EVENTS ,
89+ OfficerPositionEnum .DIRECTOR_OF_EDUCATIONAL_EVENTS ,
90+ OfficerPositionEnum .ASSISTANT_DIRECTOR_OF_EVENTS ,
91+ OfficerPositionEnum .DIRECTOR_OF_COMMUNICATIONS ,
92+ #OfficerPositionEnum .DIRECTOR_OF_OUTREACH, # TODO (#101): when https://github.com/CSSS/documents/pull/9/files merged
93+ OfficerPositionEnum .DIRECTOR_OF_MULTIMEDIA ,
94+ OfficerPositionEnum .DIRECTOR_OF_ARCHIVES ,
95+ OfficerPositionEnum .EXECUTIVE_AT_LARGE ,
9596 # TODO (#101): expect these only during fall & spring semesters.
96- #OfficerPosition .FIRST_YEAR_REPRESENTATIVE,
97+ #OfficerPositionEnum .FIRST_YEAR_REPRESENTATIVE,
9798
9899 #ElectionsOfficer,
99- OfficerPosition .SFSS_COUNCIL_REPRESENTATIVE ,
100- OfficerPosition .FROSH_WEEK_CHAIR ,
100+ OfficerPositionEnum .SFSS_COUNCIL_REPRESENTATIVE ,
101+ OfficerPositionEnum .FROSH_WEEK_CHAIR ,
101102
102- OfficerPosition .SYSTEM_ADMINISTRATOR ,
103- OfficerPosition .WEBMASTER ,
103+ OfficerPositionEnum .SYSTEM_ADMINISTRATOR ,
104+ OfficerPositionEnum .WEBMASTER ,
104105 ]
105106
106107_EMAIL_MAP = {
107- OfficerPosition .
PRESIDENT :
"[email protected] " ,
108- OfficerPosition .
VICE_PRESIDENT :
"[email protected] " ,
109- OfficerPosition .
TREASURER :
"[email protected] " ,
110-
111- OfficerPosition .
DIRECTOR_OF_RESOURCES :
"[email protected] " ,
112- OfficerPosition .
DIRECTOR_OF_EVENTS :
"[email protected] " ,
113- OfficerPosition .
DIRECTOR_OF_EDUCATIONAL_EVENTS :
"[email protected] " ,
114- OfficerPosition .
ASSISTANT_DIRECTOR_OF_EVENTS :
"[email protected] " ,
115- OfficerPosition .
DIRECTOR_OF_COMMUNICATIONS :
"[email protected] " ,
116- #OfficerPosition .DIRECTOR_OF_OUTREACH,
117- OfficerPosition .
DIRECTOR_OF_MULTIMEDIA :
"[email protected] " ,
118- OfficerPosition .
DIRECTOR_OF_ARCHIVES :
"[email protected] " ,
119- OfficerPosition .
EXECUTIVE_AT_LARGE :
"[email protected] " ,
120- OfficerPosition .
FIRST_YEAR_REPRESENTATIVE :
"[email protected] " ,
121-
122- OfficerPosition .
ELECTIONS_OFFICER :
"[email protected] " ,
123- OfficerPosition .
SFSS_COUNCIL_REPRESENTATIVE :
"[email protected] " ,
124- OfficerPosition .
FROSH_WEEK_CHAIR :
"[email protected] " ,
125-
126- OfficerPosition .
SYSTEM_ADMINISTRATOR :
"[email protected] " ,
127- OfficerPosition .
WEBMASTER :
"[email protected] " ,
128- OfficerPosition .SOCIAL_MEDIA_MANAGER : "N/A" ,
108+ OfficerPositionEnum .
PRESIDENT :
"[email protected] " ,
109+ OfficerPositionEnum .
VICE_PRESIDENT :
"[email protected] " ,
110+ OfficerPositionEnum .
TREASURER :
"[email protected] " ,
111+
112+ OfficerPositionEnum .
DIRECTOR_OF_RESOURCES :
"[email protected] " ,
113+ OfficerPositionEnum .
DIRECTOR_OF_EVENTS :
"[email protected] " ,
114+ OfficerPositionEnum .
DIRECTOR_OF_EDUCATIONAL_EVENTS :
"[email protected] " ,
115+ OfficerPositionEnum .
ASSISTANT_DIRECTOR_OF_EVENTS :
"[email protected] " ,
116+ OfficerPositionEnum .
DIRECTOR_OF_COMMUNICATIONS :
"[email protected] " ,
117+ #OfficerPositionEnum .DIRECTOR_OF_OUTREACH,
118+ OfficerPositionEnum .
DIRECTOR_OF_MULTIMEDIA :
"[email protected] " ,
119+ OfficerPositionEnum .
DIRECTOR_OF_ARCHIVES :
"[email protected] " ,
120+ OfficerPositionEnum .
EXECUTIVE_AT_LARGE :
"[email protected] " ,
121+ OfficerPositionEnum .
FIRST_YEAR_REPRESENTATIVE :
"[email protected] " ,
122+
123+ OfficerPositionEnum .
ELECTIONS_OFFICER :
"[email protected] " ,
124+ OfficerPositionEnum .
SFSS_COUNCIL_REPRESENTATIVE :
"[email protected] " ,
125+ OfficerPositionEnum .
FROSH_WEEK_CHAIR :
"[email protected] " ,
126+
127+ OfficerPositionEnum .
SYSTEM_ADMINISTRATOR :
"[email protected] " ,
128+ OfficerPositionEnum .
WEBMASTER :
"[email protected] " ,
129+ OfficerPositionEnum .SOCIAL_MEDIA_MANAGER : "N/A" ,
129130}
130131
131132# None, means that the length of the position does not have a set length in semesters
132133_LENGTH_MAP = {
133- OfficerPosition .PRESIDENT : 3 ,
134- OfficerPosition .VICE_PRESIDENT : 3 ,
135- OfficerPosition .TREASURER : 3 ,
136-
137- OfficerPosition .DIRECTOR_OF_RESOURCES : 3 ,
138- OfficerPosition .DIRECTOR_OF_EVENTS : 3 ,
139- OfficerPosition .DIRECTOR_OF_EDUCATIONAL_EVENTS : 3 ,
140- OfficerPosition .ASSISTANT_DIRECTOR_OF_EVENTS : 3 ,
141- OfficerPosition .DIRECTOR_OF_COMMUNICATIONS : 3 ,
142- #OfficerPosition .DIRECTOR_OF_OUTREACH: 3,
143- OfficerPosition .DIRECTOR_OF_MULTIMEDIA : 3 ,
144- OfficerPosition .DIRECTOR_OF_ARCHIVES : 3 ,
145- OfficerPosition .EXECUTIVE_AT_LARGE : 1 ,
146- OfficerPosition .FIRST_YEAR_REPRESENTATIVE : 2 ,
147-
148- OfficerPosition .ELECTIONS_OFFICER : None ,
149- OfficerPosition .SFSS_COUNCIL_REPRESENTATIVE : 3 ,
150- OfficerPosition .FROSH_WEEK_CHAIR : None ,
151-
152- OfficerPosition .SYSTEM_ADMINISTRATOR : None ,
153- OfficerPosition .WEBMASTER : None ,
154- OfficerPosition .SOCIAL_MEDIA_MANAGER : None ,
134+ OfficerPositionEnum .PRESIDENT : 3 ,
135+ OfficerPositionEnum .VICE_PRESIDENT : 3 ,
136+ OfficerPositionEnum .TREASURER : 3 ,
137+
138+ OfficerPositionEnum .DIRECTOR_OF_RESOURCES : 3 ,
139+ OfficerPositionEnum .DIRECTOR_OF_EVENTS : 3 ,
140+ OfficerPositionEnum .DIRECTOR_OF_EDUCATIONAL_EVENTS : 3 ,
141+ OfficerPositionEnum .ASSISTANT_DIRECTOR_OF_EVENTS : 3 ,
142+ OfficerPositionEnum .DIRECTOR_OF_COMMUNICATIONS : 3 ,
143+ #OfficerPositionEnum .DIRECTOR_OF_OUTREACH: 3,
144+ OfficerPositionEnum .DIRECTOR_OF_MULTIMEDIA : 3 ,
145+ OfficerPositionEnum .DIRECTOR_OF_ARCHIVES : 3 ,
146+ OfficerPositionEnum .EXECUTIVE_AT_LARGE : 1 ,
147+ OfficerPositionEnum .FIRST_YEAR_REPRESENTATIVE : 2 ,
148+
149+ OfficerPositionEnum .ELECTIONS_OFFICER : None ,
150+ OfficerPositionEnum .SFSS_COUNCIL_REPRESENTATIVE : 3 ,
151+ OfficerPositionEnum .FROSH_WEEK_CHAIR : None ,
152+
153+ OfficerPositionEnum .SYSTEM_ADMINISTRATOR : None ,
154+ OfficerPositionEnum .WEBMASTER : None ,
155+ OfficerPositionEnum .SOCIAL_MEDIA_MANAGER : None ,
155156}
156157
157158_OFFICER_POSITION_LIST = [
0 commit comments