MCPcopy Index your code
hub / github.com/O365/python-o365 / __init__

Method __init__

O365/drive.py:131–173  ·  view source on GitHub ↗

:param parent: parent for this operation i.e. the source of the copied item :type parent: Drive :param Connection con: connection to use if no parent specified :param target: The target drive for the copy operation :type target: Drive :param Protocol

(self, *, parent=None, con=None, target=None, **kwargs)

Source from the content-addressed store, hash-verified

129 }
130
131 def __init__(self, *, parent=None, con=None, target=None, **kwargs):
132 """
133
134 :param parent: parent for this operation i.e. the source of the copied item
135 :type parent: Drive
136 :param Connection con: connection to use if no parent specified
137 :param target: The target drive for the copy operation
138 :type target: Drive
139 :param Protocol protocol: protocol to use if no parent specified
140 (kwargs)
141 :param str main_resource: use this resource instead of parent resource
142 (kwargs)
143 :param str monitor_url:
144 :param str item_id:
145 """
146 if parent and con:
147 raise ValueError('Need a parent or a connection but not both')
148 self.con = parent.con if parent else con
149 self.parent = parent # parent will be always a Drive
150 self.target = target or parent
151
152 # Choose the main_resource passed in kwargs over parent main_resource
153 main_resource = kwargs.pop('main_resource', None) or (
154 getattr(parent, 'main_resource', None) if parent else None)
155
156 super().__init__(
157 protocol=parent.protocol if parent else kwargs.get('protocol'),
158 main_resource=main_resource)
159
160 self.monitor_url = kwargs.get('monitor_url', None)
161 self.item_id = kwargs.get('item_id', None)
162 if self.monitor_url is None and self.item_id is None:
163 raise ValueError('Must provide a valid monitor_url or item_id')
164 if self.monitor_url is not None and self.item_id is not None:
165 raise ValueError(
166 'Must provide a valid monitor_url or item_id, but not both')
167
168 if self.item_id:
169 self.status = 'completed'
170 self.completion_percentage = 100.0
171 else:
172 self.status = 'inProgress'
173 self.completion_percentage = 0.0
174
175 def _request_status(self):
176 """ Checks the api endpoint to check if the async job progress """

Callers

nothing calls this directly

Calls 2

__init__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected