-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
__init__.py
262 lines (200 loc) · 6.52 KB
/
__init__.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
__all__ = ["ContactInfo", "PyUser", "User"]
from abc import ABCMeta, abstractmethod
from java.lang import Object
class ContactInfo(Object):
def __init__(self, contactType=None, value=None):
self.contactType = contactType
self.value = value
def getContactType(self):
pass
def getValue(self):
pass
def setContactType(self, contactType):
pass
def setValue(self, value):
pass
class User(ABCMeta):
def __new__(mcs, *args, **kwargs):
pass
@abstractmethod
def getContactInfo(cls):
pass
@abstractmethod
def getId(cls):
pass
@abstractmethod
def getPath(cls):
pass
@abstractmethod
def getProfileName(cls):
pass
@abstractmethod
def getRoles(cls):
pass
@abstractmethod
def getScheduleAdjustments(cls):
pass
class PyUser(User):
"""A User implementation that delegates to another user object, but
has some methods that are more scripting friendly.
"""
Badge = "badge"
DEFAULT_SCHEDULE_NAME = "Always"
FirstName = "John"
Language = "en_US"
LastName = "Doe"
Notes = "These are some notes."
Password = "password"
Schedule = "Always"
Username = "johdoe"
USERNAME_PATTERN = r"[\p{Alnum}][ @\w.\s\-]{1, 49}"
def addContactInfo(cls, *args):
"""Convenience method for scripting to add a new contactInfo
easily.
Usage:
1. addContactInfo(contactType: str, value: str)
2. addContactInfo(dict: contactDictionary)
Args:
args: Variable length argument list.
"""
print(cls, args)
def addRole(cls, role):
"""Convenience method for scripting to add a new role easily.
Only works if user type supports roles.
Args:
role (str): A new role to add. If empty or null, no
effect.
"""
print(cls, role)
def addRoles(cls, roles):
"""Adds the provided roles to this user.
Args:
roles (list[str]): A list of roles.
"""
print(cls, roles)
def addScheduleAdjustment(cls, start, end, available=True, note=None):
"""Convenience method for scripting to add a new schedule
adjustment easily.
Args:
start (Date): Date to start the schedule adjustment. Not
null.
end (Date): Date to end start the schedule adjustment.
Not null.
available (bool): True if the employee is available during
this period. Optional.
note (str): May be null or empty. Optional.
"""
print(cls, start, end, available, note)
def addScheduleAdjustments(cls, scheduleAdjustments):
"""Add Schedule Adjustments.
Args:
scheduleAdjustments (ScheduleAdjustment): ScheduleAdjustment
object.
"""
print(cls, scheduleAdjustments)
def contains(cls, prop):
"""Returns if this users contains a given property."""
pass
def get(cls, propertyName):
"""Returns a the value of the requested item.
Args:
propertyName (str): The user property to retrieve.
Returns:
str: The value of the requested property.
"""
print(cls)
return propertyName
def getContactInfo(cls):
"""Returns a sequence of ContactInfo objects.
Each of these objects will have a contactType and value property
representing the contact information, both strings.
Returns:
list[ContactInfo]: A sequence of ContactInfo objects.
"""
ci_email = ContactInfo("email", "johdoe@mycompany.com")
ci_phone = ContactInfo("phone", "+1 5551324567")
ci_sms = ContactInfo("sms", "+1 5557654321")
return [ci_email, ci_phone, ci_sms]
def getCount(cls):
"""Get count."""
print(cls)
return 1
def getId(cls):
"""An opaque identifier that can be used to identify this
user.
"""
pass
def getOrDefault(cls, prop):
"""Returns a default value if the requested item is not
present.
Args:
prop (Property): The user property to retrieve.
Returns:
object: The value of the requested property.
"""
print(cls, prop)
def getOrElse(cls, property, value):
"""Get the value for a given Property, or else fall back to
value if it's not present.
"""
pass
def getPath(cls):
"""Generate an path that unambiguously references this user."""
pass
def getProfileName(cls):
"""The name of the user management profile this user was
retrieved from.
"""
pass
def getProperties(cls):
"""Returns all properties for this user."""
pass
def getRoles(cls):
"""Returns all of the roles this user is a has."""
return ["Administrator", "Developer"]
def getScheduleAdjustments(cls):
"""Returns all of this user's upcoming schedule adjustments."""
pass
def getValues(cls):
"""Returns the opaque PropertyValue objects."""
pass
def isExtended(cls, prop):
"""Returns whether this property set contains a value for the
prop, and the prop was actually inherited.
"""
pass
def isInherited(cls, prop):
"""Indicates whether the property was inherited from a parent
type.
"""
pass
def iterator(cls):
"""Property iterator."""
pass
def merge(cls, other, localOnly):
"""Merges the values from other collection into this one."""
pass
def remove(cls, prop):
"""Remove a property for this user."""
pass
def removeContactInfo(cls, contactType, value):
"""Remove contact information for this user."""
pass
def removeRole(cls, role):
"""Remove a role for this user."""
pass
def removeScheduleAdjustment(cls, start, end, available=True, note=None):
"""Remove schedule adjustment for this user."""
pass
def set(cls, *args):
"""Set a property for this user."""
pass
def setContactInfo(cls, contactInfo):
"""Set contact information for this user."""
pass
def setRoles(cls, roles):
"""Set roles for this user."""
pass
def setScheduleAdjustments(cls, scheduleAdjustments):
"""Set schedule adjustments for this user."""
pass