Office365-REST-Python-Client 2.5.1__py3-none-any.whl → 2.5.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/METADATA +6 -6
  2. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/RECORD +265 -259
  3. office365/base_item.py +12 -20
  4. office365/communications/onlinemeetings/collection.py +1 -1
  5. office365/communications/onlinemeetings/online_meeting.py +20 -35
  6. office365/communications/presences/presence.py +18 -7
  7. office365/delta_collection.py +10 -1
  8. office365/delta_path.py +1 -1
  9. office365/directory/administrative_unit.py +6 -7
  10. office365/directory/applications/application.py +24 -18
  11. office365/directory/applications/roles/assignment.py +13 -1
  12. office365/directory/applications/roles/collection.py +13 -0
  13. office365/directory/applications/roles/role.py +6 -1
  14. office365/directory/audit/directory.py +8 -7
  15. office365/directory/audit/log_root.py +3 -0
  16. office365/directory/audit/signins/signin.py +19 -29
  17. office365/directory/authentication/authentication.py +1 -0
  18. office365/directory/authentication/methods/details.py +8 -6
  19. office365/directory/authentication/methods/phone.py +3 -1
  20. office365/directory/extensions/extension_property.py +7 -9
  21. office365/directory/groups/collection.py +10 -3
  22. office365/directory/groups/group.py +19 -19
  23. office365/directory/groups/lifecycle_policy.py +8 -7
  24. office365/directory/identities/provider.py +5 -6
  25. office365/directory/insights/usage_details.py +8 -3
  26. office365/directory/internal/paths/me.py +1 -1
  27. office365/directory/invitations/collection.py +1 -1
  28. office365/directory/invitations/invitation.py +6 -6
  29. office365/directory/object_collection.py +2 -3
  30. office365/directory/permissions/email_identity.py +7 -0
  31. office365/directory/permissions/grants/resource_specific.py +10 -9
  32. office365/directory/permissions/identity.py +3 -0
  33. office365/directory/permissions/identity_set.py +3 -0
  34. office365/directory/policies/base.py +4 -4
  35. office365/directory/policies/root.py +6 -4
  36. office365/directory/protection/information.py +3 -3
  37. office365/directory/rolemanagement/application.py +2 -0
  38. office365/directory/rolemanagement/role.py +11 -10
  39. office365/directory/rolemanagement/template.py +9 -8
  40. office365/directory/rolemanagement/unified_role_assignment.py +5 -4
  41. office365/directory/rolemanagement/unified_role_definition.py +6 -4
  42. office365/directory/security/security.py +3 -0
  43. office365/directory/serviceprincipals/collection.py +20 -4
  44. office365/directory/serviceprincipals/service_principal.py +79 -12
  45. office365/directory/users/activities/activity.py +5 -4
  46. office365/directory/users/user.py +29 -34
  47. office365/entity.py +2 -2
  48. office365/entity_collection.py +12 -5
  49. office365/graph_client.py +90 -8
  50. office365/intune/audit/event.py +4 -3
  51. office365/intune/devices/enrollment/configuration.py +6 -4
  52. office365/intune/devices/managed.py +9 -12
  53. office365/onedrive/analytics/item_activity_stat.py +4 -3
  54. office365/onedrive/columns/column_link.py +4 -4
  55. office365/onedrive/columns/definition.py +29 -32
  56. office365/onedrive/columns/definition_collection.py +1 -1
  57. office365/onedrive/contenttypes/content_type.py +16 -18
  58. office365/onedrive/documentsets/version.py +7 -3
  59. office365/onedrive/driveitems/driveItem.py +48 -49
  60. office365/onedrive/drives/drive.py +7 -2
  61. office365/onedrive/internal/paths/children.py +2 -2
  62. office365/onedrive/internal/paths/root.py +1 -1
  63. office365/onedrive/internal/paths/shared.py +1 -1
  64. office365/onedrive/internal/paths/site.py +3 -3
  65. office365/onedrive/internal/paths/url.py +2 -2
  66. office365/onedrive/listitems/list_item.py +2 -0
  67. office365/onedrive/lists/list.py +7 -4
  68. office365/onedrive/permissions/collection.py +28 -7
  69. office365/onedrive/permissions/permission.py +5 -7
  70. office365/onedrive/permissions/sharing_link.py +1 -1
  71. office365/onedrive/sharepoint.py +1 -0
  72. office365/onedrive/shares/collection.py +2 -5
  73. office365/onedrive/shares/drive_item.py +4 -0
  74. office365/onedrive/sites/site.py +6 -0
  75. office365/onedrive/termstore/groups/collection.py +3 -8
  76. office365/onedrive/termstore/groups/group.py +8 -0
  77. office365/onedrive/termstore/sets/collection.py +2 -6
  78. office365/onedrive/termstore/sets/name.py +5 -0
  79. office365/onedrive/termstore/sets/set.py +7 -0
  80. office365/onedrive/termstore/store.py +10 -13
  81. office365/onedrive/versions/drive_item.py +3 -1
  82. office365/onedrive/workbooks/ranges/range.py +9 -13
  83. office365/onedrive/workbooks/ranges/view.py +1 -0
  84. office365/onedrive/workbooks/tables/rows/row.py +3 -0
  85. office365/onedrive/workbooks/tables/table.py +7 -4
  86. office365/onedrive/workbooks/worksheets/worksheet.py +12 -4
  87. office365/onenote/entity_hierarchy_model.py +4 -0
  88. office365/onenote/internal/multipart_page_query.py +4 -5
  89. office365/onenote/notebooks/notebook.py +4 -0
  90. office365/onenote/pages/collection.py +3 -2
  91. office365/onenote/resources/resource.py +5 -4
  92. office365/onenote/sectiongroups/section_group.py +10 -7
  93. office365/onenote/sections/section.py +1 -1
  94. office365/outlook/calendar/attendees/base.py +2 -1
  95. office365/outlook/calendar/calendar.py +18 -10
  96. office365/outlook/calendar/events/collection.py +0 -2
  97. office365/outlook/calendar/group.py +7 -8
  98. office365/outlook/calendar/meetingtimes/suggestion.py +8 -4
  99. office365/outlook/calendar/meetingtimes/time_slot.py +3 -0
  100. office365/outlook/calendar/permissions/collection.py +1 -1
  101. office365/outlook/calendar/rooms/__init__.py +0 -0
  102. office365/outlook/calendar/rooms/list.py +27 -0
  103. office365/outlook/calendar/rooms/room.py +8 -0
  104. office365/outlook/calendar/schedule/information.py +0 -1
  105. office365/outlook/contacts/collection.py +0 -8
  106. office365/outlook/contacts/contact.py +14 -14
  107. office365/outlook/contacts/folder.py +3 -0
  108. office365/outlook/mail/attachments/attachment.py +31 -31
  109. office365/outlook/mail/attachments/collection.py +34 -6
  110. office365/outlook/mail/conversation.py +6 -4
  111. office365/outlook/mail/folders/collection.py +0 -7
  112. office365/outlook/mail/folders/folder.py +50 -18
  113. office365/outlook/mail/messages/collection.py +0 -1
  114. office365/outlook/mail/messages/message.py +58 -68
  115. office365/outlook/mail/physical_address.py +11 -5
  116. office365/outlook/mail/recipient.py +3 -1
  117. office365/outlook/mail/recurrence_range.py +14 -6
  118. office365/outlook/user.py +1 -0
  119. office365/planner/planner.py +9 -12
  120. office365/planner/plans/collection.py +17 -18
  121. office365/planner/plans/container.py +11 -0
  122. office365/planner/plans/plan.py +21 -10
  123. office365/runtime/auth/authentication_context.py +3 -3
  124. office365/runtime/auth/providers/acs_token_provider.py +7 -9
  125. office365/runtime/auth/providers/saml_token_provider.py +5 -2
  126. office365/runtime/client_object.py +6 -15
  127. office365/runtime/client_object_collection.py +36 -35
  128. office365/runtime/client_result.py +6 -7
  129. office365/runtime/client_runtime_context.py +10 -16
  130. office365/runtime/client_value_collection.py +3 -10
  131. office365/runtime/compat.py +2 -0
  132. office365/runtime/odata/query_options.py +1 -3
  133. office365/runtime/odata/reader.py +1 -1
  134. office365/runtime/odata/request.py +2 -4
  135. office365/runtime/odata/type.py +17 -0
  136. office365/runtime/odata/v4/upload_session_request.py +27 -30
  137. office365/runtime/paths/appid.py +1 -1
  138. office365/runtime/{odata/url_builder.py → paths/builder.py} +24 -9
  139. office365/runtime/paths/item.py +3 -1
  140. office365/runtime/paths/resource_path.py +12 -16
  141. office365/runtime/paths/service_operation.py +8 -7
  142. office365/runtime/paths/v3/__init__.py +0 -0
  143. office365/runtime/paths/{key.py → v3/entity.py} +5 -5
  144. office365/runtime/paths/v4/__init__.py +0 -0
  145. office365/runtime/paths/{entity.py → v4/entity.py} +13 -11
  146. office365/runtime/queries/function.py +1 -1
  147. office365/runtime/types/event_handler.py +1 -3
  148. office365/search/entity.py +15 -8
  149. office365/search/external/external.py +1 -0
  150. office365/search/sort_property.py +3 -0
  151. office365/sharepoint/attachments/attachment.py +3 -1
  152. office365/sharepoint/attachments/collection.py +3 -0
  153. office365/sharepoint/changes/change.py +12 -1
  154. office365/sharepoint/changes/collection.py +1 -1
  155. office365/sharepoint/changes/list.py +3 -0
  156. office365/sharepoint/changes/token.py +4 -0
  157. office365/sharepoint/changes/type.py +23 -23
  158. office365/sharepoint/changes/web.py +7 -3
  159. office365/sharepoint/client_context.py +21 -18
  160. office365/sharepoint/clientsidecomponent/hostedapps/manager.py +3 -3
  161. office365/sharepoint/contenttypes/content_type.py +47 -56
  162. office365/sharepoint/contenttypes/content_type_id.py +1 -1
  163. office365/sharepoint/documentmanagement/document_id.py +2 -2
  164. office365/sharepoint/documentmanagement/document_set.py +6 -7
  165. office365/sharepoint/entity_collection.py +9 -0
  166. office365/sharepoint/features/feature.py +6 -8
  167. office365/sharepoint/fields/collection.py +6 -5
  168. office365/sharepoint/fields/field.py +28 -46
  169. office365/sharepoint/fields/related_field_collection.py +1 -1
  170. office365/sharepoint/fields/user_value.py +3 -3
  171. office365/sharepoint/files/checked_out_file.py +4 -2
  172. office365/sharepoint/files/checked_out_file_collection.py +1 -1
  173. office365/sharepoint/files/collection.py +84 -14
  174. office365/sharepoint/files/file.py +118 -110
  175. office365/sharepoint/files/versions/collection.py +5 -3
  176. office365/sharepoint/files/versions/event.py +6 -3
  177. office365/sharepoint/files/versions/version.py +31 -18
  178. office365/sharepoint/folders/collection.py +5 -10
  179. office365/sharepoint/folders/folder.py +41 -24
  180. office365/sharepoint/forms/collection.py +1 -1
  181. office365/sharepoint/forms/form.py +4 -4
  182. office365/sharepoint/internal/paths/static_operation.py +9 -0
  183. office365/sharepoint/internal/paths/web.py +20 -0
  184. office365/sharepoint/listitems/collection.py +4 -0
  185. office365/sharepoint/listitems/listitem.py +37 -38
  186. office365/sharepoint/listitems/versions/collection.py +1 -1
  187. office365/sharepoint/listitems/versions/version.py +18 -11
  188. office365/sharepoint/lists/collection.py +1 -2
  189. office365/sharepoint/lists/list.py +106 -153
  190. office365/sharepoint/marketplace/app_metadata_collection.py +3 -1
  191. office365/sharepoint/navigation/node.py +16 -15
  192. office365/sharepoint/navigation/node_collection.py +9 -3
  193. office365/sharepoint/permissions/base_permissions.py +11 -6
  194. office365/sharepoint/permissions/roles/assignments/collection.py +8 -12
  195. office365/sharepoint/permissions/roles/definitions/definition.py +3 -1
  196. office365/sharepoint/permissions/securable_object.py +38 -31
  197. office365/sharepoint/portal/groups/service.py +12 -16
  198. office365/sharepoint/portal/groups/site_manager.py +0 -1
  199. office365/sharepoint/principal/groups/group.py +24 -30
  200. office365/sharepoint/principal/principal.py +21 -19
  201. office365/sharepoint/principal/users/collection.py +5 -0
  202. office365/sharepoint/principal/users/user.py +20 -26
  203. office365/sharepoint/publishing/pages/collection.py +1 -4
  204. office365/sharepoint/publishing/pages/metadata.py +38 -51
  205. office365/sharepoint/publishing/pages/metadata_collection.py +5 -2
  206. office365/sharepoint/publishing/pages/page.py +12 -21
  207. office365/sharepoint/publishing/pages/reposts/repost.py +5 -9
  208. office365/sharepoint/publishing/pages/service.py +36 -49
  209. office365/sharepoint/pushnotifications/collection.py +3 -1
  210. office365/sharepoint/recyclebin/item.py +11 -9
  211. office365/sharepoint/recyclebin/item_collection.py +1 -1
  212. office365/sharepoint/search/service.py +8 -6
  213. office365/sharepoint/sharing/links/info.py +5 -2
  214. office365/sharepoint/sharing/links/share_response.py +3 -0
  215. office365/sharepoint/sharing/links/share_settings.py +3 -0
  216. office365/sharepoint/sharing/object_sharing_information.py +25 -19
  217. office365/sharepoint/sharing/object_sharing_information_user.py +10 -19
  218. office365/sharepoint/sharing/result.py +18 -41
  219. office365/sharepoint/sharing/role.py +20 -0
  220. office365/sharepoint/sharing/role_type.py +1 -0
  221. office365/sharepoint/sharing/user_sharing_result.py +12 -0
  222. office365/sharepoint/sites/language.py +6 -0
  223. office365/sharepoint/sites/language_collection.py +3 -0
  224. office365/sharepoint/sites/site.py +65 -86
  225. office365/sharepoint/storagemetrics/storage_metrics.py +5 -6
  226. office365/sharepoint/taxonomy/item.py +11 -10
  227. office365/sharepoint/taxonomy/stores/store.py +8 -8
  228. office365/sharepoint/taxonomy/terms/label.py +3 -0
  229. office365/sharepoint/taxonomy/terms/term.py +31 -0
  230. office365/sharepoint/tenant/administration/collaboration/insights_overview.py +10 -0
  231. office365/sharepoint/tenant/administration/hubsites/collection.py +1 -2
  232. office365/sharepoint/tenant/administration/hubsites/hub_site.py +20 -24
  233. office365/sharepoint/tenant/administration/internal/permission_grant.py +7 -0
  234. office365/sharepoint/tenant/administration/sites/properties.py +55 -44
  235. office365/sharepoint/tenant/administration/tenant.py +69 -69
  236. office365/sharepoint/types/resource_path.py +2 -2
  237. office365/sharepoint/ui/applicationpages/peoplepicker/query_parameters.py +1 -1
  238. office365/sharepoint/usercustomactions/collection.py +1 -2
  239. office365/sharepoint/userprofiles/my_site_links.py +4 -4
  240. office365/sharepoint/userprofiles/people_manager.py +1 -3
  241. office365/sharepoint/userprofiles/user_profile.py +9 -11
  242. office365/sharepoint/utilities/principal_info.py +12 -0
  243. office365/sharepoint/viva/employee_engagement.py +1 -1
  244. office365/sharepoint/webparts/definition_collection.py +1 -1
  245. office365/sharepoint/webs/collection.py +8 -0
  246. office365/sharepoint/webs/template_collection.py +3 -5
  247. office365/sharepoint/webs/web.py +75 -95
  248. office365/subscriptions/collection.py +1 -1
  249. office365/subscriptions/subscription.py +13 -11
  250. office365/teams/apps/app.py +1 -0
  251. office365/teams/channels/channel.py +1 -3
  252. office365/teams/collection.py +12 -16
  253. office365/teams/info.py +7 -4
  254. office365/teams/members/conversation_collection.py +1 -3
  255. office365/teams/operations/async_operation.py +3 -5
  256. office365/teams/schedule/groups/group.py +3 -0
  257. office365/teams/team.py +18 -20
  258. office365/todo/attachments/base.py +7 -9
  259. office365/todo/linked_resource.py +6 -6
  260. office365/todo/tasks/list.py +1 -0
  261. office365/todo/tasks/task.py +3 -0
  262. office365/onedrive/internal/queries/resumable_file_upload.py +0 -36
  263. office365/outlook/internal/queries/attachment_upload.py +0 -53
  264. office365/runtime/odata/path_builder.py +0 -23
  265. office365/sharepoint/internal/key_value.py +0 -28
  266. office365/sharepoint/internal/queries/create_file.py +0 -20
  267. office365/sharepoint/internal/queries/upload_session.py +0 -103
  268. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/LICENSE +0 -0
  269. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/WHEEL +0 -0
  270. {Office365_REST_Python_Client-2.5.1.dist-info → Office365_REST_Python_Client-2.5.3.dist-info}/top_level.txt +0 -0
  271. /office365/planner/plans/{plan_details.py → details.py} +0 -0
@@ -1,9 +1,17 @@
1
+ from typing import TYPE_CHECKING
2
+
1
3
  from office365.directory.permissions.identity import Identity
2
4
  from office365.entity import Entity
3
5
  from office365.entity_collection import EntityCollection
4
6
  from office365.onedrive.permissions.permission import Permission
5
7
  from office365.runtime.queries.create_entity import CreateEntityQuery
6
8
 
9
+ if TYPE_CHECKING:
10
+ from office365.directory.applications.application import Application
11
+ from office365.directory.groups.group import Group
12
+ from office365.directory.users.user import User
13
+ from office365.intune.devices.device import Device
14
+
7
15
 
8
16
  class PermissionCollection(EntityCollection[Permission]):
9
17
  """Permission's collection"""
@@ -12,6 +20,7 @@ class PermissionCollection(EntityCollection[Permission]):
12
20
  super(PermissionCollection, self).__init__(context, Permission, resource_path)
13
21
 
14
22
  def add(self, roles, identity=None, identity_type=None):
23
+ # type: (list[str], Application|User|Group|Device|str, str) -> Permission
15
24
  """
16
25
  Create a new permission object.
17
26
 
@@ -21,6 +30,7 @@ class PermissionCollection(EntityCollection[Permission]):
21
30
  """
22
31
 
23
32
  return_type = Permission(self.context)
33
+ self.add_child(return_type)
24
34
 
25
35
  known_identities = {
26
36
  "application": self.context.applications,
@@ -41,7 +51,7 @@ class PermissionCollection(EntityCollection[Permission]):
41
51
  raise ValueError("Unknown identity type")
42
52
  identity = known_identity[identity]
43
53
 
44
- def _create():
54
+ def _add():
45
55
  payload = {
46
56
  "roles": roles,
47
57
  "grantedToIdentities": [
@@ -53,20 +63,31 @@ class PermissionCollection(EntityCollection[Permission]):
53
63
  ],
54
64
  }
55
65
 
56
- self.add_child(return_type)
57
66
  qry = CreateEntityQuery(self, payload, return_type)
58
67
  self.context.add_query(qry)
59
68
 
60
- identity.ensure_properties(["displayName"], _create)
69
+ identity.ensure_properties(["displayName"], _add)
61
70
  return return_type
62
71
 
72
+ def delete(self, roles, identity):
73
+ # type: (list[str], Application|User|Group|Device) -> Permission
74
+ """Deletes the permission."""
75
+
76
+ def _delete(col):
77
+ pass
78
+
79
+ def _identity_loaded():
80
+ self.get_all(page_loaded=_delete)
81
+
82
+ identity.ensure_property("id", _identity_loaded)
83
+ return self
84
+
63
85
  def delete_all(self):
64
- """
65
- Remove all access to resource
66
- """
86
+ """Remove all access to resource"""
67
87
 
68
88
  def _after_loaded(return_type):
69
- for permission in return_type: # type: Permission
89
+ # type: (PermissionCollection) -> None
90
+ for permission in return_type:
70
91
  permission.delete_object()
71
92
 
72
93
  self.context.load(self, after_loaded=_after_loaded)
@@ -1,6 +1,7 @@
1
+ from typing import Optional
2
+
1
3
  from office365.directory.permissions.identity_set import IdentitySet
2
4
  from office365.entity import Entity
3
- from office365.entity_collection import EntityCollection
4
5
  from office365.onedrive.drives.recipient import DriveRecipient
5
6
  from office365.onedrive.listitems.item_reference import ItemReference
6
7
  from office365.onedrive.permissions.sharepoint_identity_set import SharePointIdentitySet
@@ -89,18 +90,15 @@ class Permission(Entity):
89
90
 
90
91
  @property
91
92
  def share_id(self):
92
- """A unique token that can be used to access this shared item via the shares API. Read-only.
93
-
94
- :rtype: str
95
- """
93
+ # type: () -> Optional[str]
94
+ """A unique token that can be used to access this shared item via the shares API. Read-only."""
96
95
  return self.properties.get("shareId", None)
97
96
 
98
97
  @property
99
98
  def has_password(self):
99
+ # type: () -> Optional[bool]
100
100
  """This indicates whether password is set for this permission, it's only showing in response.
101
101
  Optional and Read-only and for OneDrive Personal only.
102
-
103
- :rtype: bool
104
102
  """
105
103
  return self.properties.get("hasPassword", None)
106
104
 
@@ -34,4 +34,4 @@ class SharingLink(ClientValue):
34
34
  self.application = application
35
35
 
36
36
  def __repr__(self):
37
- return self.webUrl
37
+ return self.webUrl or ""
@@ -8,6 +8,7 @@ class Sharepoint(Entity):
8
8
 
9
9
  @property
10
10
  def settings(self):
11
+ # type: () -> SharepointSettings
11
12
  """Represents the tenant-level settings for SharePoint and OneDrive."""
12
13
  return self.properties.get(
13
14
  "settings",
@@ -8,9 +8,6 @@ class SharesCollection(EntityCollection[SharedDriveItem]):
8
8
  super(SharesCollection, self).__init__(context, SharedDriveItem, resource_path)
9
9
 
10
10
  def by_url(self, url):
11
- """
12
- Address shared item by absolute url
13
-
14
- :type url: str
15
- """
11
+ # type: (str) -> SharedDriveItem
12
+ """Address shared item by absolute url"""
16
13
  return SharedDriveItem(self.context, SharedPath(url, self.resource_path))
@@ -15,6 +15,7 @@ class SharedDriveItem(BaseItem):
15
15
 
16
16
  @property
17
17
  def items(self):
18
+ # type: () -> EntityCollection[DriveItem]
18
19
  """All driveItems contained in the sharing root. This collection cannot be enumerated."""
19
20
  return self.properties.get(
20
21
  "items",
@@ -25,6 +26,7 @@ class SharedDriveItem(BaseItem):
25
26
 
26
27
  @property
27
28
  def list_item(self):
29
+ # type: () -> ListItem
28
30
  """Used to access the underlying listItem"""
29
31
  return self.properties.get(
30
32
  "listItem",
@@ -33,6 +35,7 @@ class SharedDriveItem(BaseItem):
33
35
 
34
36
  @property
35
37
  def list(self):
38
+ # type: () -> List
36
39
  """Used to access the underlying list"""
37
40
  return self.properties.get(
38
41
  "list", List(self.context, ResourcePath("list", self.resource_path))
@@ -40,6 +43,7 @@ class SharedDriveItem(BaseItem):
40
43
 
41
44
  @property
42
45
  def drive_item(self):
46
+ # type: () -> DriveItem
43
47
  """Used to access the underlying driveItem"""
44
48
  return self.properties.get(
45
49
  "driveItem",
@@ -24,6 +24,12 @@ from office365.runtime.queries.service_operation import ServiceOperationQuery
24
24
  class Site(BaseItem):
25
25
  """The site resource provides metadata and relationships for a SharePoint site."""
26
26
 
27
+ def __str__(self):
28
+ return self.name
29
+
30
+ def __repr__(self):
31
+ return self.name or self.web_url or self.id or self.entity_type_name
32
+
27
33
  def get_by_path(self, path):
28
34
  # type: (str) -> Site
29
35
  """
@@ -2,24 +2,19 @@ from office365.entity_collection import EntityCollection
2
2
  from office365.onedrive.termstore.groups.group import Group
3
3
 
4
4
 
5
- class GroupCollection(EntityCollection):
5
+ class GroupCollection(EntityCollection[Group]):
6
6
  def __init__(self, context, resource_path=None):
7
7
  super(GroupCollection, self).__init__(context, Group, resource_path)
8
8
 
9
9
  def add(self, display_name):
10
10
  """
11
11
  Create a new group object in a term store.
12
-
13
12
  :param str display_name: Name of the group to be created.
14
- :rtype: Group
15
13
  """
16
14
  props = {"displayName": display_name}
17
15
  return super(GroupCollection, self).add(**props)
18
16
 
19
17
  def get_by_name(self, name):
20
- """Returns the group with the specified name.
21
-
22
- :param str name: Group name
23
- :rtype: Group
24
- """
18
+ # type: (str) -> Group
19
+ """Returns the group with the specified name."""
25
20
  return self.single("displayName eq '{0}'".format(name))
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.onedrive.termstore.sets.collection import SetCollection
3
5
  from office365.runtime.paths.resource_path import ResourcePath
@@ -6,18 +8,24 @@ from office365.runtime.paths.resource_path import ResourcePath
6
8
  class Group(Entity):
7
9
  """Term Group"""
8
10
 
11
+ def __str__(self):
12
+ return self.display_name
13
+
9
14
  @property
10
15
  def display_name(self):
16
+ # type: () -> Optional[str]
11
17
  """Name of the group."""
12
18
  return self.properties.get("displayName", None)
13
19
 
14
20
  @property
15
21
  def parent_site_id(self):
22
+ # type: () -> Optional[str]
16
23
  """ID of the parent site of this group."""
17
24
  return self.properties.get("parentSiteId", None)
18
25
 
19
26
  @property
20
27
  def sets(self):
28
+ # type: () -> SetCollection
21
29
  """Collection of all sets available in the term store."""
22
30
  return self.properties.get(
23
31
  "sets",
@@ -14,12 +14,8 @@ class SetCollection(EntityCollection[Set]):
14
14
  self._parent_group = parent_group
15
15
 
16
16
  def get_by_name(self, name):
17
- """
18
- Returns the TermSet specified by its name.
19
-
20
- :param str name: Term set name
21
- :rtype: Set
22
- """
17
+ # type: (str) -> Set
18
+ """Returns the TermSet specified by its name."""
23
19
  return self.single("displayName eq '{0}'".format(name))
24
20
 
25
21
  def add(self, name, parent_group=None):
@@ -1,3 +1,5 @@
1
+ import json
2
+
1
3
  from office365.runtime.client_value import ClientValue
2
4
 
3
5
 
@@ -15,3 +17,6 @@ class LocalizedName(ClientValue):
15
17
  super(LocalizedName, self).__init__()
16
18
  self.name = name
17
19
  self.languageTag = language_tag
20
+
21
+ def __repr__(self):
22
+ return json.dumps(self.to_json())
@@ -14,8 +14,12 @@ class Set(Entity):
14
14
  terms. A group can contain multiple sets.
15
15
  """
16
16
 
17
+ def __repr__(self):
18
+ return repr(self.localized_names)
19
+
17
20
  @property
18
21
  def children(self):
22
+ # type: () -> TermCollection
19
23
  """Children terms of set in term store."""
20
24
  return self.properties.get(
21
25
  "children",
@@ -28,6 +32,7 @@ class Set(Entity):
28
32
 
29
33
  @property
30
34
  def localized_names(self):
35
+ # type: () -> ClientValueCollection[LocalizedName]
31
36
  """"""
32
37
  return self.properties.get(
33
38
  "localizedNames", ClientValueCollection(LocalizedName)
@@ -45,6 +50,7 @@ class Set(Entity):
45
50
 
46
51
  @property
47
52
  def relations(self):
53
+ # type: () -> EntityCollection[Relation]
48
54
  """Indicates which terms have been pinned or reused directly under the set."""
49
55
  return self.properties.get(
50
56
  "relations",
@@ -55,6 +61,7 @@ class Set(Entity):
55
61
 
56
62
  @property
57
63
  def terms(self):
64
+ # type: () -> TermCollection
58
65
  """All the terms under the set."""
59
66
  return self.properties.get(
60
67
  "terms",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.termstore.groups.collection import GroupCollection
@@ -15,17 +17,13 @@ class Store(Entity):
15
17
  """Returns a collection containing a flat list of all TermSet objects."""
16
18
  return_type = EntityCollection(self.context, Set)
17
19
 
18
- def _sets_loaded(group_sets):
19
- """
20
- :type group_sets: EntityCollection
21
- """
22
- [return_type.add_child(s) for s in group_sets]
20
+ def _sets_loaded(sets):
21
+ # type: (SetCollection) -> None
22
+ [return_type.add_child(s) for s in sets]
23
23
 
24
24
  def _groups_loaded(groups):
25
- """
26
- :type groups: EntityCollection
27
- """
28
- for g in groups: # type: Group
25
+ # type: (GroupCollection) -> None
26
+ for g in groups:
29
27
  self.context.load(g.sets, after_loaded=_sets_loaded)
30
28
 
31
29
  self.context.load(self.groups, after_loaded=_groups_loaded)
@@ -34,10 +32,8 @@ class Store(Entity):
34
32
 
35
33
  @property
36
34
  def default_language_tag(self):
37
- """Default language of the term store.
38
-
39
- :rtype: str
40
- """
35
+ # type: () -> Optional[str]
36
+ """Default language of the term store."""
41
37
  return self.properties.get("defaultLanguageTag", None)
42
38
 
43
39
  @property
@@ -47,6 +43,7 @@ class Store(Entity):
47
43
 
48
44
  @property
49
45
  def groups(self):
46
+ # type: () -> GroupCollection
50
47
  """Collection of all groups available in the term store."""
51
48
  return self.properties.get(
52
49
  "groups",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.onedrive.versions.base_item import BaseItemVersion
2
4
  from office365.runtime.queries.service_operation import ServiceOperationQuery
3
5
 
@@ -23,8 +25,8 @@ class DriveItemVersion(BaseItemVersion):
23
25
 
24
26
  @property
25
27
  def size(self):
28
+ # type: () -> Optional[int]
26
29
  """
27
30
  Indicates the size of the content stream for this version of the item.
28
- :rtype: int
29
31
  """
30
32
  return self.properties.get("size", None)
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.onedrive.workbooks.ranges.format import WorkbookRangeFormat
3
5
  from office365.onedrive.workbooks.ranges.sort import WorkbookRangeSort
@@ -18,35 +20,29 @@ class WorkbookRange(Entity):
18
20
 
19
21
  @property
20
22
  def address(self):
23
+ # type: () -> Optional[str]
21
24
  """
22
25
  Represents the range reference in A1-style. Address value will contain the Sheet reference
23
26
  (e.g. Sheet1!A1:B4)
24
- :rtype: str or None
25
27
  """
26
28
  return self.properties.get("address", None)
27
29
 
28
30
  @property
29
31
  def address_local(self):
30
- """
31
- Represents range reference for the specified range in the language of the user. Read-only.
32
- :rtype: str or None
33
- """
32
+ # type: () -> Optional[str]
33
+ """Represents range reference for the specified range in the language of the user."""
34
34
  return self.properties.get("addressLocal", None)
35
35
 
36
36
  @property
37
37
  def cell_count(self):
38
- """
39
- Number of cells in the range. Read-only.
40
- :rtype: int or None
41
- """
38
+ # type: () -> Optional[int]
39
+ """Number of cells in the range. Read-only."""
42
40
  return self.properties.get("cellCount", None)
43
41
 
44
42
  @property
45
43
  def column_count(self):
46
- """
47
- Represents the total number of columns in the range. Read-only.
48
- :rtype: int or None
49
- """
44
+ # type: () -> Optional[int]
45
+ """Represents the total number of columns in the range. Read-only."""
50
46
  return self.properties.get("columnCount", None)
51
47
 
52
48
  @property
@@ -8,6 +8,7 @@ class WorkbookRangeView(Entity):
8
8
 
9
9
  @property
10
10
  def rows(self):
11
+ # type: () -> EntityCollection[WorkbookRangeView]
11
12
  """Represents a collection of range views associated with the range."""
12
13
  return self.properties.get(
13
14
  "rows",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
 
3
5
 
@@ -6,6 +8,7 @@ class WorkbookTableRow(Entity):
6
8
 
7
9
  @property
8
10
  def index(self):
11
+ # type: () -> Optional[int]
9
12
  """Returns the index number of the row within the rows collection of the table. Zero-indexed."""
10
13
  return self.properties.get("index", None)
11
14
 
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.onedrive.workbooks.ranges.range import WorkbookRange
3
5
  from office365.onedrive.workbooks.tables.columns.collection import (
@@ -49,11 +51,13 @@ class WorkbookTable(Entity):
49
51
 
50
52
  @property
51
53
  def name(self):
54
+ # type: () -> Optional[str]
52
55
  """Name of the table."""
53
- return self.properties.get("name", str())
56
+ return self.properties.get("name", None)
54
57
 
55
58
  @property
56
59
  def columns(self):
60
+ # type: () -> WorkbookTableColumnCollection
57
61
  """
58
62
  Represents a collection of all the columns in the table.
59
63
  """
@@ -66,9 +70,8 @@ class WorkbookTable(Entity):
66
70
 
67
71
  @property
68
72
  def rows(self):
69
- """
70
- Represents a collection of all the rows in the table.
71
- """
73
+ # type: () -> WorkbookTableRowCollection
74
+ """Represents a collection of all the rows in the table."""
72
75
  return self.properties.get(
73
76
  "rows",
74
77
  WorkbookTableRowCollection(
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.entity import Entity
2
4
  from office365.entity_collection import EntityCollection
3
5
  from office365.onedrive.workbooks.charts.chart import WorkbookChart
@@ -18,8 +20,12 @@ class WorkbookWorksheet(Entity):
18
20
  def __repr__(self):
19
21
  return self.name
20
22
 
23
+ def __str__(self):
24
+ return self.name
25
+
21
26
  @property
22
27
  def charts(self):
28
+ # type: () -> EntityCollection[WorkbookChart]
23
29
  """Returns collection of charts that are part of the worksheet"""
24
30
  return self.properties.get(
25
31
  "charts",
@@ -30,14 +36,13 @@ class WorkbookWorksheet(Entity):
30
36
 
31
37
  @property
32
38
  def name(self):
33
- """
34
- The display name of the worksheet.
35
- :rtype: str or None
36
- """
39
+ # type: () -> Optional[str]
40
+ """The display name of the worksheet."""
37
41
  return self.properties.get("name", None)
38
42
 
39
43
  @property
40
44
  def names(self):
45
+ # type: () -> EntityCollection[WorkbookNamedItem]
41
46
  """Returns collection of names that are associated with the worksheet"""
42
47
  return self.properties.get(
43
48
  "names",
@@ -50,6 +55,7 @@ class WorkbookWorksheet(Entity):
50
55
 
51
56
  @property
52
57
  def tables(self):
58
+ # type: () -> WorkbookTableCollection
53
59
  """Collection of tables that are part of the worksheet."""
54
60
  return self.properties.get(
55
61
  "tables",
@@ -60,6 +66,7 @@ class WorkbookWorksheet(Entity):
60
66
 
61
67
  @property
62
68
  def pivot_tables(self):
69
+ # type: () -> EntityCollection[WorkbookPivotTable]
63
70
  """Collection of PivotTables that are part of the worksheet."""
64
71
  return self.properties.get(
65
72
  "pivotTables",
@@ -72,6 +79,7 @@ class WorkbookWorksheet(Entity):
72
79
 
73
80
  @property
74
81
  def protection(self):
82
+ # type: () -> WorkbookWorksheetProtection
75
83
  """Returns sheet protection object for a worksheet."""
76
84
  return self.properties.get(
77
85
  "protection",
@@ -1,3 +1,5 @@
1
+ from typing import Optional
2
+
1
3
  from office365.directory.permissions.identity_set import IdentitySet
2
4
  from office365.onenote.entity_schema_object_model import OnenoteEntitySchemaObjectModel
3
5
 
@@ -5,11 +7,13 @@ from office365.onenote.entity_schema_object_model import OnenoteEntitySchemaObje
5
7
  class OnenoteEntityHierarchyModel(OnenoteEntitySchemaObjectModel):
6
8
  @property
7
9
  def display_name(self):
10
+ # type: () -> Optional[str]
8
11
  """The name of the section."""
9
12
  return self.properties.get("displayName", None)
10
13
 
11
14
  @property
12
15
  def created_by(self):
16
+ # type: () -> IdentitySet
13
17
  """Identity of the user, device, and application which created the item. Read-only."""
14
18
  return self.properties.get("createdBy", IdentitySet())
15
19
 
@@ -1,4 +1,5 @@
1
1
  from email.message import Message
2
+ from typing import AnyStr
2
3
 
3
4
  from office365.runtime.compat import get_mime_type, message_as_bytes_or_string
4
5
  from office365.runtime.http.http_method import HttpMethod
@@ -7,9 +8,7 @@ from office365.runtime.queries.client_query import ClientQuery
7
8
 
8
9
 
9
10
  def _message_to_payload(message):
10
- """
11
- :type message: Message
12
- """
11
+ # type: (Message) -> AnyStr
13
12
  lf = b"\n"
14
13
  crlf = b"\r\n"
15
14
  payload = message_as_bytes_or_string(message)
@@ -48,7 +47,7 @@ class OneNotePageCreateQuery(ClientQuery):
48
47
  )
49
48
  main_message.set_boundary(boundary)
50
49
 
51
- c_type, enc = get_mime_type(self._presentation.name)
50
+ c_type, _enc = get_mime_type(self._presentation.name)
52
51
  presentation_message = Message()
53
52
  presentation_message.add_header("Content-Type", c_type)
54
53
  presentation_message.add_header(
@@ -59,7 +58,7 @@ class OneNotePageCreateQuery(ClientQuery):
59
58
 
60
59
  for name, file in self._files.items():
61
60
  file_message = Message()
62
- c_type, enc = get_mime_type(file.name)
61
+ c_type, _enc = get_mime_type(file.name)
63
62
  file_message.add_header("Content-Type", c_type)
64
63
  file_message.add_header(
65
64
  "Content-Disposition", 'form-data; name="{0}"'.format(name)
@@ -1,3 +1,5 @@
1
+ from typing import TYPE_CHECKING
2
+
1
3
  from office365.entity_collection import EntityCollection
2
4
  from office365.onenote.entity_hierarchy_model import OnenoteEntityHierarchyModel
3
5
  from office365.onenote.sections.section import OnenoteSection
@@ -9,6 +11,7 @@ class Notebook(OnenoteEntityHierarchyModel):
9
11
 
10
12
  @property
11
13
  def sections(self):
14
+ # type: () -> EntityCollection[OnenoteSection]
12
15
  """
13
16
  Retrieve a list of onenoteSection objects from the specified notebook.
14
17
  """
@@ -26,6 +29,7 @@ class Notebook(OnenoteEntityHierarchyModel):
26
29
  """
27
30
  Retrieve a list of onenoteSection objects from the specified notebook.
28
31
  """
32
+
29
33
  from office365.onenote.sectiongroups.section_group import SectionGroup
30
34
 
31
35
  return self.properties.get(
@@ -1,3 +1,5 @@
1
+ from typing import IO
2
+
1
3
  from office365.entity_collection import EntityCollection
2
4
  from office365.onenote.internal.multipart_page_query import OneNotePageCreateQuery
3
5
  from office365.onenote.pages.page import OnenotePage
@@ -10,12 +12,11 @@ class OnenotePageCollection(EntityCollection[OnenotePage]):
10
12
  super(OnenotePageCollection, self).__init__(context, OnenotePage, resource_path)
11
13
 
12
14
  def add(self, presentation_file, attachment_files=None):
15
+ # type: (IO, dict) -> OnenotePage
13
16
  """
14
17
  Create a new OneNote page.
15
-
16
18
  :param typing.IO presentation_file: Presentation file
17
19
  :param dict or None attachment_files: Attachment files
18
- :rtype: OnenotePage
19
20
  """
20
21
  qry = OneNotePageCreateQuery(self, presentation_file, attachment_files)
21
22
  self.context.add_query(qry)
@@ -1,3 +1,5 @@
1
+ from typing import AnyStr, Optional
2
+
1
3
  from office365.onenote.entity_base_model import OnenoteEntityBaseModel
2
4
  from office365.runtime.client_result import ClientResult
3
5
  from office365.runtime.queries.function import FunctionQuery
@@ -7,6 +9,7 @@ class OnenoteResource(OnenoteEntityBaseModel):
7
9
  """An image or other file resource on a OneNote page."""
8
10
 
9
11
  def get_content(self):
12
+ # type: () -> ClientResult[AnyStr]
10
13
  """Retrieve the binary data of a file or image resource object."""
11
14
  return_type = ClientResult(self.context)
12
15
  qry = FunctionQuery(self, "content", None, return_type)
@@ -15,8 +18,6 @@ class OnenoteResource(OnenoteEntityBaseModel):
15
18
 
16
19
  @property
17
20
  def content_url(self):
18
- """The URL for downloading the content
19
-
20
- :rtype: str or None
21
- """
21
+ # type: () -> Optional[str]
22
+ """The URL for downloading the content"""
22
23
  return self.properties.get("contentUrl", None)