partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | oauth_authentication_flow | A helper method to perform the OAuth2 authentication flow.
Authenticate and get the oauth token
:param str client_id: the client_id
:param str client_secret: the client_secret
:param list[str] scopes: a list of protocol user scopes to be converted
by the protocol or raw scopes
:param Protocol ... | O365/connection.py | def oauth_authentication_flow(client_id, client_secret, scopes=None,
protocol=None, **kwargs):
""" A helper method to perform the OAuth2 authentication flow.
Authenticate and get the oauth token
:param str client_id: the client_id
:param str client_secret: the client_secre... | def oauth_authentication_flow(client_id, client_secret, scopes=None,
protocol=None, **kwargs):
""" A helper method to perform the OAuth2 authentication flow.
Authenticate and get the oauth token
:param str client_id: the client_id
:param str client_secret: the client_secre... | [
"A",
"helper",
"method",
"to",
"perform",
"the",
"OAuth2",
"authentication",
"flow",
".",
"Authenticate",
"and",
"get",
"the",
"oauth",
"token"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L764-L805 | [
"def",
"oauth_authentication_flow",
"(",
"client_id",
",",
"client_secret",
",",
"scopes",
"=",
"None",
",",
"protocol",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"credentials",
"=",
"(",
"client_id",
",",
"client_secret",
")",
"protocol",
"=",
"protoc... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Protocol.get_scopes_for | Returns a list of scopes needed for each of the
scope_helpers provided, by adding the prefix to them if required
:param user_provided_scopes: a list of scopes or scope helpers
:type user_provided_scopes: list or tuple or str
:return: scopes with url prefix added
:rtype: list
... | O365/connection.py | def get_scopes_for(self, user_provided_scopes):
""" Returns a list of scopes needed for each of the
scope_helpers provided, by adding the prefix to them if required
:param user_provided_scopes: a list of scopes or scope helpers
:type user_provided_scopes: list or tuple or str
:r... | def get_scopes_for(self, user_provided_scopes):
""" Returns a list of scopes needed for each of the
scope_helpers provided, by adding the prefix to them if required
:param user_provided_scopes: a list of scopes or scope helpers
:type user_provided_scopes: list or tuple or str
:r... | [
"Returns",
"a",
"list",
"of",
"scopes",
"needed",
"for",
"each",
"of",
"the",
"scope_helpers",
"provided",
"by",
"adding",
"the",
"prefix",
"to",
"them",
"if",
"required"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L140-L165 | [
"def",
"get_scopes_for",
"(",
"self",
",",
"user_provided_scopes",
")",
":",
"if",
"user_provided_scopes",
"is",
"None",
":",
"# return all available scopes",
"user_provided_scopes",
"=",
"[",
"app_part",
"for",
"app_part",
"in",
"self",
".",
"_oauth_scopes",
"]",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Protocol._prefix_scope | Inserts the protocol scope prefix if required | O365/connection.py | def _prefix_scope(self, scope):
""" Inserts the protocol scope prefix if required"""
if self.protocol_scope_prefix:
if isinstance(scope, tuple):
return scope[0]
elif scope.startswith(self.protocol_scope_prefix):
return scope
else:
... | def _prefix_scope(self, scope):
""" Inserts the protocol scope prefix if required"""
if self.protocol_scope_prefix:
if isinstance(scope, tuple):
return scope[0]
elif scope.startswith(self.protocol_scope_prefix):
return scope
else:
... | [
"Inserts",
"the",
"protocol",
"scope",
"prefix",
"if",
"required"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L167-L180 | [
"def",
"_prefix_scope",
"(",
"self",
",",
"scope",
")",
":",
"if",
"self",
".",
"protocol_scope_prefix",
":",
"if",
"isinstance",
"(",
"scope",
",",
"tuple",
")",
":",
"return",
"scope",
"[",
"0",
"]",
"elif",
"scope",
".",
"startswith",
"(",
"self",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.set_proxy | Sets a proxy on the Session
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port, defaults to 8080
:param str proxy_username: the proxy username
:param str proxy_password: the proxy password | O365/connection.py | def set_proxy(self, proxy_server, proxy_port, proxy_username,
proxy_password):
""" Sets a proxy on the Session
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port, defaults to 8080
:param str proxy_username: the proxy username
:param... | def set_proxy(self, proxy_server, proxy_port, proxy_username,
proxy_password):
""" Sets a proxy on the Session
:param str proxy_server: the proxy server
:param int proxy_port: the proxy port, defaults to 8080
:param str proxy_username: the proxy username
:param... | [
"Sets",
"a",
"proxy",
"on",
"the",
"Session"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L342-L367 | [
"def",
"set_proxy",
"(",
"self",
",",
"proxy_server",
",",
"proxy_port",
",",
"proxy_username",
",",
"proxy_password",
")",
":",
"if",
"proxy_server",
"and",
"proxy_port",
":",
"if",
"proxy_username",
"and",
"proxy_password",
":",
"self",
".",
"proxy",
"=",
"{... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.check_token_file | Checks if the token file exists at the given position
:return: if file exists or not
:rtype: bool | O365/connection.py | def check_token_file(self):
""" Checks if the token file exists at the given position
:return: if file exists or not
:rtype: bool
"""
# TODO: remove this method in a future release
warnings.warn('This method will be removed in future versions',
Depr... | def check_token_file(self):
""" Checks if the token file exists at the given position
:return: if file exists or not
:rtype: bool
"""
# TODO: remove this method in a future release
warnings.warn('This method will be removed in future versions',
Depr... | [
"Checks",
"if",
"the",
"token",
"file",
"exists",
"at",
"the",
"given",
"position"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L369-L378 | [
"def",
"check_token_file",
"(",
"self",
")",
":",
"# TODO: remove this method in a future release",
"warnings",
".",
"warn",
"(",
"'This method will be removed in future versions'",
",",
"DeprecationWarning",
")",
"return",
"self",
".",
"token_backend",
".",
"check_token",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.get_authorization_url | Initializes the oauth authorization flow, getting the
authorization url that the user must approve.
:param list[str] requested_scopes: list of scopes to request access for
:param str redirect_uri: redirect url configured in registered app
:param kwargs: allow to pass unused params in co... | O365/connection.py | def get_authorization_url(self, requested_scopes=None,
redirect_uri=OAUTH_REDIRECT_URL, **kwargs):
""" Initializes the oauth authorization flow, getting the
authorization url that the user must approve.
:param list[str] requested_scopes: list of scopes to request a... | def get_authorization_url(self, requested_scopes=None,
redirect_uri=OAUTH_REDIRECT_URL, **kwargs):
""" Initializes the oauth authorization flow, getting the
authorization url that the user must approve.
:param list[str] requested_scopes: list of scopes to request a... | [
"Initializes",
"the",
"oauth",
"authorization",
"flow",
"getting",
"the",
"authorization",
"url",
"that",
"the",
"user",
"must",
"approve",
"."
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L380-L426 | [
"def",
"get_authorization_url",
"(",
"self",
",",
"requested_scopes",
"=",
"None",
",",
"redirect_uri",
"=",
"OAUTH_REDIRECT_URL",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: remove this warning in future releases",
"if",
"redirect_uri",
"==",
"OAUTH_REDIRECT_URL",
":",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.request_token | Authenticates for the specified url and gets the token, save the
token for future based if requested
:param str authorization_url: url given by the authorization flow
:param bool store_token: whether or not to store the token,
so u don't have to keep opening the auth link and
... | O365/connection.py | def request_token(self, authorization_url, store_token=True,
token_path=None, **kwargs):
""" Authenticates for the specified url and gets the token, save the
token for future based if requested
:param str authorization_url: url given by the authorization flow
:para... | def request_token(self, authorization_url, store_token=True,
token_path=None, **kwargs):
""" Authenticates for the specified url and gets the token, save the
token for future based if requested
:param str authorization_url: url given by the authorization flow
:para... | [
"Authenticates",
"for",
"the",
"specified",
"url",
"and",
"gets",
"the",
"token",
"save",
"the",
"token",
"for",
"future",
"based",
"if",
"requested"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L428-L471 | [
"def",
"request_token",
"(",
"self",
",",
"authorization_url",
",",
"store_token",
"=",
"True",
",",
"token_path",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"session",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
"\"Fist call '... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.get_session | Create a requests Session object
:param Path token_path: (Only oauth) full path to where the token
should be load from
:return: A ready to use requests session
:rtype: OAuth2Session | O365/connection.py | def get_session(self, token_path=None):
""" Create a requests Session object
:param Path token_path: (Only oauth) full path to where the token
should be load from
:return: A ready to use requests session
:rtype: OAuth2Session
"""
# TODO: remove token_path in fut... | def get_session(self, token_path=None):
""" Create a requests Session object
:param Path token_path: (Only oauth) full path to where the token
should be load from
:return: A ready to use requests session
:rtype: OAuth2Session
"""
# TODO: remove token_path in fut... | [
"Create",
"a",
"requests",
"Session",
"object"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L473-L507 | [
"def",
"get_session",
"(",
"self",
",",
"token_path",
"=",
"None",
")",
":",
"# TODO: remove token_path in future versions",
"if",
"token_path",
"is",
"not",
"None",
":",
"warnings",
".",
"warn",
"(",
"'\"token_path\" param will be removed in future versions.'",
"' Use a ... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.refresh_token | Refresh the OAuth authorization token.
This will be called automatically when the access token
expires, however, you can manually call this method to
request a new refresh token.
:return bool: Success / Failure | O365/connection.py | def refresh_token(self):
"""
Refresh the OAuth authorization token.
This will be called automatically when the access token
expires, however, you can manually call this method to
request a new refresh token.
:return bool: Success / Failure
"""
if self.se... | def refresh_token(self):
"""
Refresh the OAuth authorization token.
This will be called automatically when the access token
expires, however, you can manually call this method to
request a new refresh token.
:return bool: Success / Failure
"""
if self.se... | [
"Refresh",
"the",
"OAuth",
"authorization",
"token",
".",
"This",
"will",
"be",
"called",
"automatically",
"when",
"the",
"access",
"token",
"expires",
"however",
"you",
"can",
"manually",
"call",
"this",
"method",
"to",
"request",
"a",
"new",
"refresh",
"toke... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L509-L536 | [
"def",
"refresh_token",
"(",
"self",
")",
":",
"if",
"self",
".",
"session",
"is",
"None",
":",
"self",
".",
"session",
"=",
"self",
".",
"get_session",
"(",
")",
"token",
"=",
"self",
".",
"token_backend",
".",
"token",
"if",
"token",
"and",
"token",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection._check_delay | Checks if a delay is needed between requests and sleeps if True | O365/connection.py | def _check_delay(self):
""" Checks if a delay is needed between requests and sleeps if True """
if self._previous_request_at:
dif = round(time.time() - self._previous_request_at,
2) * 1000 # difference in miliseconds
if dif < self.requests_delay:
... | def _check_delay(self):
""" Checks if a delay is needed between requests and sleeps if True """
if self._previous_request_at:
dif = round(time.time() - self._previous_request_at,
2) * 1000 # difference in miliseconds
if dif < self.requests_delay:
... | [
"Checks",
"if",
"a",
"delay",
"is",
"needed",
"between",
"requests",
"and",
"sleeps",
"if",
"True"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L538-L546 | [
"def",
"_check_delay",
"(",
"self",
")",
":",
"if",
"self",
".",
"_previous_request_at",
":",
"dif",
"=",
"round",
"(",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"_previous_request_at",
",",
"2",
")",
"*",
"1000",
"# difference in miliseconds",
"if"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection._internal_request | Internal handling of requests. Handles Exceptions.
:param request_obj: a requests session.
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the reques... | O365/connection.py | def _internal_request(self, request_obj, url, method, **kwargs):
""" Internal handling of requests. Handles Exceptions.
:param request_obj: a requests session.
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: ex... | def _internal_request(self, request_obj, url, method, **kwargs):
""" Internal handling of requests. Handles Exceptions.
:param request_obj: a requests session.
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: ex... | [
"Internal",
"handling",
"of",
"requests",
".",
"Handles",
"Exceptions",
"."
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L548-L635 | [
"def",
"_internal_request",
"(",
"self",
",",
"request_obj",
",",
"url",
",",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"method",
"=",
"method",
".",
"lower",
"(",
")",
"if",
"method",
"not",
"in",
"self",
".",
"_allowed_methods",
":",
"raise",
"Val... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.naive_request | Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the... | O365/connection.py | def naive_request(self, url, method, **kwargs):
""" Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params... | def naive_request(self, url, method, **kwargs):
""" Makes a request to url using an without oauth authorization
session, but through a normal session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params... | [
"Makes",
"a",
"request",
"to",
"url",
"using",
"an",
"without",
"oauth",
"authorization",
"session",
"but",
"through",
"a",
"normal",
"session"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L637-L647 | [
"def",
"naive_request",
"(",
"self",
",",
"url",
",",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_internal_request",
"(",
"self",
".",
"naive_session",
",",
"url",
",",
"method",
",",
"*",
"*",
"kwargs",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.oauth_request | Makes a request to url using an oauth session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the request
:rtype: requests.Response | O365/connection.py | def oauth_request(self, url, method, **kwargs):
""" Makes a request to url using an oauth session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the... | def oauth_request(self, url, method, **kwargs):
""" Makes a request to url using an oauth session
:param str url: url to send request to
:param str method: type of request (get/put/post/patch/delete)
:param kwargs: extra params to send to the request api
:return: Response of the... | [
"Makes",
"a",
"request",
"to",
"url",
"using",
"an",
"oauth",
"session"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L649-L662 | [
"def",
"oauth_request",
"(",
"self",
",",
"url",
",",
"method",
",",
"*",
"*",
"kwargs",
")",
":",
"# oauth authentication",
"if",
"self",
".",
"session",
"is",
"None",
":",
"self",
".",
"session",
"=",
"self",
".",
"get_session",
"(",
")",
"return",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.get | Shorthand for self.oauth_request(url, 'get')
:param str url: url to send get oauth request to
:param dict params: request parameter to get the service data
:param kwargs: extra params to send to request api
:return: Response of the request
:rtype: requests.Response | O365/connection.py | def get(self, url, params=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'get')
:param str url: url to send get oauth request to
:param dict params: request parameter to get the service data
:param kwargs: extra params to send to request api
:return: Response of the ... | def get(self, url, params=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'get')
:param str url: url to send get oauth request to
:param dict params: request parameter to get the service data
:param kwargs: extra params to send to request api
:return: Response of the ... | [
"Shorthand",
"for",
"self",
".",
"oauth_request",
"(",
"url",
"get",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L664-L673 | [
"def",
"get",
"(",
"self",
",",
"url",
",",
"params",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"oauth_request",
"(",
"url",
",",
"'get'",
",",
"params",
"=",
"params",
",",
"*",
"*",
"kwargs",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.post | Shorthand for self.oauth_request(url, 'post')
:param str url: url to send post oauth request to
:param dict data: post data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
:rtype: requests.Response | O365/connection.py | def post(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'post')
:param str url: url to send post oauth request to
:param dict data: post data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
... | def post(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'post')
:param str url: url to send post oauth request to
:param dict data: post data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
... | [
"Shorthand",
"for",
"self",
".",
"oauth_request",
"(",
"url",
"post",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L675-L684 | [
"def",
"post",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"oauth_request",
"(",
"url",
",",
"'post'",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.put | Shorthand for self.oauth_request(url, 'put')
:param str url: url to send put oauth request to
:param dict data: put data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
:rtype: requests.Response | O365/connection.py | def put(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'put')
:param str url: url to send put oauth request to
:param dict data: put data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
... | def put(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'put')
:param str url: url to send put oauth request to
:param dict data: put data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
... | [
"Shorthand",
"for",
"self",
".",
"oauth_request",
"(",
"url",
"put",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L686-L695 | [
"def",
"put",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"oauth_request",
"(",
"url",
",",
"'put'",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Connection.patch | Shorthand for self.oauth_request(url, 'patch')
:param str url: url to send patch oauth request to
:param dict data: patch data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request
:rtype: requests.Response | O365/connection.py | def patch(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'patch')
:param str url: url to send patch oauth request to
:param dict data: patch data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request... | def patch(self, url, data=None, **kwargs):
""" Shorthand for self.oauth_request(url, 'patch')
:param str url: url to send patch oauth request to
:param dict data: patch data to update the service
:param kwargs: extra params to send to request api
:return: Response of the request... | [
"Shorthand",
"for",
"self",
".",
"oauth_request",
"(",
"url",
"patch",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/connection.py#L697-L706 | [
"def",
"patch",
"(",
"self",
",",
"url",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"oauth_request",
"(",
"url",
",",
"'patch'",
",",
"data",
"=",
"data",
",",
"*",
"*",
"kwargs",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | AttachableMixin.attachment_name | Name of the attachment
:getter: get attachment name
:setter: set new name for the attachment
:type: str | O365/utils/attachment.py | def attachment_name(self):
""" Name of the attachment
:getter: get attachment name
:setter: set new name for the attachment
:type: str
"""
if self.__attachment_name is not None:
return self.__attachment_name
if self.__attachment_name_property:
... | def attachment_name(self):
""" Name of the attachment
:getter: get attachment name
:setter: set new name for the attachment
:type: str
"""
if self.__attachment_name is not None:
return self.__attachment_name
if self.__attachment_name_property:
... | [
"Name",
"of",
"the",
"attachment"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L22-L41 | [
"def",
"attachment_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"__attachment_name",
"is",
"not",
"None",
":",
"return",
"self",
".",
"__attachment_name",
"if",
"self",
".",
"__attachment_name_property",
":",
"return",
"getattr",
"(",
"self",
",",
"self",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachment.to_api_data | Returns a dict to communicate with the server
:rtype: dict | O365/utils/attachment.py | def to_api_data(self):
""" Returns a dict to communicate with the server
:rtype: dict
"""
data = {'@odata.type': self._gk(
'{}_attachment_type'.format(self.attachment_type)),
self._cc('name'): self.name}
if self.attachment_type == 'file':
dat... | def to_api_data(self):
""" Returns a dict to communicate with the server
:rtype: dict
"""
data = {'@odata.type': self._gk(
'{}_attachment_type'.format(self.attachment_type)),
self._cc('name'): self.name}
if self.attachment_type == 'file':
dat... | [
"Returns",
"a",
"dict",
"to",
"communicate",
"with",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L140-L154 | [
"def",
"to_api_data",
"(",
"self",
")",
":",
"data",
"=",
"{",
"'@odata.type'",
":",
"self",
".",
"_gk",
"(",
"'{}_attachment_type'",
".",
"format",
"(",
"self",
".",
"attachment_type",
")",
")",
",",
"self",
".",
"_cc",
"(",
"'name'",
")",
":",
"self"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachment.save | Save the attachment locally to disk
:param str location: path string to where the file is to be saved.
:param str custom_name: a custom name to be saved as
:return: Success / Failure
:rtype: bool | O365/utils/attachment.py | def save(self, location=None, custom_name=None):
""" Save the attachment locally to disk
:param str location: path string to where the file is to be saved.
:param str custom_name: a custom name to be saved as
:return: Success / Failure
:rtype: bool
"""
if not se... | def save(self, location=None, custom_name=None):
""" Save the attachment locally to disk
:param str location: path string to where the file is to be saved.
:param str custom_name: a custom name to be saved as
:return: Success / Failure
:rtype: bool
"""
if not se... | [
"Save",
"the",
"attachment",
"locally",
"to",
"disk"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L156-L184 | [
"def",
"save",
"(",
"self",
",",
"location",
"=",
"None",
",",
"custom_name",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"content",
":",
"return",
"False",
"location",
"=",
"Path",
"(",
"location",
"or",
"''",
")",
"if",
"not",
"location",
".",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachment.attach | Attach this attachment to an existing api_object. This
BaseAttachment object must be an orphan BaseAttachment created for the
sole purpose of attach it to something and therefore run this method.
:param api_object: object to attach to
:param on_cloud: if the attachment is on cloud or no... | O365/utils/attachment.py | def attach(self, api_object, on_cloud=False):
""" Attach this attachment to an existing api_object. This
BaseAttachment object must be an orphan BaseAttachment created for the
sole purpose of attach it to something and therefore run this method.
:param api_object: object to attach to
... | def attach(self, api_object, on_cloud=False):
""" Attach this attachment to an existing api_object. This
BaseAttachment object must be an orphan BaseAttachment created for the
sole purpose of attach it to something and therefore run this method.
:param api_object: object to attach to
... | [
"Attach",
"this",
"attachment",
"to",
"an",
"existing",
"api_object",
".",
"This",
"BaseAttachment",
"object",
"must",
"be",
"an",
"orphan",
"BaseAttachment",
"created",
"for",
"the",
"sole",
"purpose",
"of",
"attach",
"it",
"to",
"something",
"and",
"therefore"... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L186-L228 | [
"def",
"attach",
"(",
"self",
",",
"api_object",
",",
"on_cloud",
"=",
"False",
")",
":",
"if",
"self",
".",
"on_cloud",
":",
"# item is already saved on the cloud.",
"return",
"True",
"# api_object must exist and if implements attachments",
"# then we can attach to it.",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments.to_api_data | Returns a dict to communicate with the server
:rtype: dict | O365/utils/attachment.py | def to_api_data(self):
""" Returns a dict to communicate with the server
:rtype: dict
"""
return [attachment.to_api_data() for attachment in self.__attachments if
attachment.on_cloud is False] | def to_api_data(self):
""" Returns a dict to communicate with the server
:rtype: dict
"""
return [attachment.to_api_data() for attachment in self.__attachments if
attachment.on_cloud is False] | [
"Returns",
"a",
"dict",
"to",
"communicate",
"with",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L290-L296 | [
"def",
"to_api_data",
"(",
"self",
")",
":",
"return",
"[",
"attachment",
".",
"to_api_data",
"(",
")",
"for",
"attachment",
"in",
"self",
".",
"__attachments",
"if",
"attachment",
".",
"on_cloud",
"is",
"False",
"]"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments.clear | Clear the attachments | O365/utils/attachment.py | def clear(self):
""" Clear the attachments """
for attachment in self.__attachments:
if attachment.on_cloud:
self.__removed_attachments.append(attachment)
self.__attachments = []
self._update_parent_attachments()
self._track_changes() | def clear(self):
""" Clear the attachments """
for attachment in self.__attachments:
if attachment.on_cloud:
self.__removed_attachments.append(attachment)
self.__attachments = []
self._update_parent_attachments()
self._track_changes() | [
"Clear",
"the",
"attachments"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L298-L305 | [
"def",
"clear",
"(",
"self",
")",
":",
"for",
"attachment",
"in",
"self",
".",
"__attachments",
":",
"if",
"attachment",
".",
"on_cloud",
":",
"self",
".",
"__removed_attachments",
".",
"append",
"(",
"attachment",
")",
"self",
".",
"__attachments",
"=",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments._update_parent_attachments | Tries to update the parent property 'has_attachments' | O365/utils/attachment.py | def _update_parent_attachments(self):
""" Tries to update the parent property 'has_attachments' """
try:
self._parent.has_attachments = bool(len(self.__attachments))
except AttributeError:
pass | def _update_parent_attachments(self):
""" Tries to update the parent property 'has_attachments' """
try:
self._parent.has_attachments = bool(len(self.__attachments))
except AttributeError:
pass | [
"Tries",
"to",
"update",
"the",
"parent",
"property",
"has_attachments"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L315-L320 | [
"def",
"_update_parent_attachments",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_parent",
".",
"has_attachments",
"=",
"bool",
"(",
"len",
"(",
"self",
".",
"__attachments",
")",
")",
"except",
"AttributeError",
":",
"pass"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments.add | Add more attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict | O365/utils/attachment.py | def add(self, attachments):
""" Add more attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if attachments:
if isinstance(attachments, (str, Path)):
attachments = [attachments]
... | def add(self, attachments):
""" Add more attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if attachments:
if isinstance(attachments, (str, Path)):
attachments = [attachments]
... | [
"Add",
"more",
"attachments"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L322-L351 | [
"def",
"add",
"(",
"self",
",",
"attachments",
")",
":",
"if",
"attachments",
":",
"if",
"isinstance",
"(",
"attachments",
",",
"(",
"str",
",",
"Path",
")",
")",
":",
"attachments",
"=",
"[",
"attachments",
"]",
"if",
"isinstance",
"(",
"attachments",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments.remove | Remove the specified attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict | O365/utils/attachment.py | def remove(self, attachments):
""" Remove the specified attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if isinstance(attachments, (list, tuple)):
attachments = ({attachment.name
... | def remove(self, attachments):
""" Remove the specified attachments
:param attachments: list of attachments
:type attachments: list[str] or list[Path] or str or Path or dict
"""
if isinstance(attachments, (list, tuple)):
attachments = ({attachment.name
... | [
"Remove",
"the",
"specified",
"attachments"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L353-L381 | [
"def",
"remove",
"(",
"self",
",",
"attachments",
")",
":",
"if",
"isinstance",
"(",
"attachments",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"attachments",
"=",
"(",
"{",
"attachment",
".",
"name",
"if",
"isinstance",
"(",
"attachment",
",",
"Bas... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments.download_attachments | Downloads this message attachments into memory.
Need a call to 'attachment.save' to save them on disk.
:return: Success / Failure
:rtype: bool | O365/utils/attachment.py | def download_attachments(self):
""" Downloads this message attachments into memory.
Need a call to 'attachment.save' to save them on disk.
:return: Success / Failure
:rtype: bool
"""
if not self._parent.has_attachments:
log.debug(
'Parent {} h... | def download_attachments(self):
""" Downloads this message attachments into memory.
Need a call to 'attachment.save' to save them on disk.
:return: Success / Failure
:rtype: bool
"""
if not self._parent.has_attachments:
log.debug(
'Parent {} h... | [
"Downloads",
"this",
"message",
"attachments",
"into",
"memory",
".",
"Need",
"a",
"call",
"to",
"attachment",
".",
"save",
"to",
"save",
"them",
"on",
"disk",
"."
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L383-L419 | [
"def",
"download_attachments",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_parent",
".",
"has_attachments",
":",
"log",
".",
"debug",
"(",
"'Parent {} has no attachments, skipping out early.'",
".",
"format",
"(",
"self",
".",
"_parent",
".",
"__class__",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | BaseAttachments._update_attachments_to_cloud | Push new, unsaved attachments to the cloud and remove removed
attachments. This method should not be called for non draft messages. | O365/utils/attachment.py | def _update_attachments_to_cloud(self):
""" Push new, unsaved attachments to the cloud and remove removed
attachments. This method should not be called for non draft messages.
"""
url = self.build_url(self._endpoints.get('attachments').format(
id=self._parent.object_id))
... | def _update_attachments_to_cloud(self):
""" Push new, unsaved attachments to the cloud and remove removed
attachments. This method should not be called for non draft messages.
"""
url = self.build_url(self._endpoints.get('attachments').format(
id=self._parent.object_id))
... | [
"Push",
"new",
"unsaved",
"attachments",
"to",
"the",
"cloud",
"and",
"remove",
"removed",
"attachments",
".",
"This",
"method",
"should",
"not",
"be",
"called",
"for",
"non",
"draft",
"messages",
"."
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/attachment.py#L421-L460 | [
"def",
"_update_attachments_to_cloud",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'attachments'",
")",
".",
"format",
"(",
"id",
"=",
"self",
".",
"_parent",
".",
"object_id",
")",
")",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Recipient._track_changes | Update the track_changes on the parent to reflect a
needed update on this field | O365/utils/utils.py | def _track_changes(self):
""" Update the track_changes on the parent to reflect a
needed update on this field """
if self._field and getattr(self._parent, '_track_changes',
None) is not None:
self._parent._track_changes.add(self._field) | def _track_changes(self):
""" Update the track_changes on the parent to reflect a
needed update on this field """
if self._field and getattr(self._parent, '_track_changes',
None) is not None:
self._parent._track_changes.add(self._field) | [
"Update",
"the",
"track_changes",
"on",
"the",
"parent",
"to",
"reflect",
"a",
"needed",
"update",
"on",
"this",
"field"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L116-L121 | [
"def",
"_track_changes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_field",
"and",
"getattr",
"(",
"self",
".",
"_parent",
",",
"'_track_changes'",
",",
"None",
")",
"is",
"not",
"None",
":",
"self",
".",
"_parent",
".",
"_track_changes",
".",
"add",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Recipients._track_changes | Update the track_changes on the parent to reflect a
needed update on this field | O365/utils/utils.py | def _track_changes(self):
""" Update the track_changes on the parent to reflect a
needed update on this field """
if self._field and getattr(self._parent, '_track_changes',
None) is not None and self.untrack is False:
self._parent._track_changes.add... | def _track_changes(self):
""" Update the track_changes on the parent to reflect a
needed update on this field """
if self._field and getattr(self._parent, '_track_changes',
None) is not None and self.untrack is False:
self._parent._track_changes.add... | [
"Update",
"the",
"track_changes",
"on",
"the",
"parent",
"to",
"reflect",
"a",
"needed",
"update",
"on",
"this",
"field"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L198-L203 | [
"def",
"_track_changes",
"(",
"self",
")",
":",
"if",
"self",
".",
"_field",
"and",
"getattr",
"(",
"self",
".",
"_parent",
",",
"'_track_changes'",
",",
"None",
")",
"is",
"not",
"None",
"and",
"self",
".",
"untrack",
"is",
"False",
":",
"self",
".",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Recipients.add | Add the supplied recipients to the exiting list
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict] | O365/utils/utils.py | def add(self, recipients):
""" Add the supplied recipients to the exiting list
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict]
"""
if recipients:
if ... | def add(self, recipients):
""" Add the supplied recipients to the exiting list
:param recipients: list of either address strings or
tuples (name, address) or dictionary elements
:type recipients: list[str] or list[tuple] or list[dict]
"""
if recipients:
if ... | [
"Add",
"the",
"supplied",
"recipients",
"to",
"the",
"exiting",
"list"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L210-L238 | [
"def",
"add",
"(",
"self",
",",
"recipients",
")",
":",
"if",
"recipients",
":",
"if",
"isinstance",
"(",
"recipients",
",",
"str",
")",
":",
"self",
".",
"_recipients",
".",
"append",
"(",
"Recipient",
"(",
"address",
"=",
"recipients",
",",
"parent",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Recipients.remove | Remove an address or multiple addresses
:param address: list of addresses to remove
:type address: str or list[str] | O365/utils/utils.py | def remove(self, address):
""" Remove an address or multiple addresses
:param address: list of addresses to remove
:type address: str or list[str]
"""
recipients = []
if isinstance(address, str):
address = {address} # set
elif isinstance(address, (li... | def remove(self, address):
""" Remove an address or multiple addresses
:param address: list of addresses to remove
:type address: str or list[str]
"""
recipients = []
if isinstance(address, str):
address = {address} # set
elif isinstance(address, (li... | [
"Remove",
"an",
"address",
"or",
"multiple",
"addresses"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L240-L257 | [
"def",
"remove",
"(",
"self",
",",
"address",
")",
":",
"recipients",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"address",
",",
"str",
")",
":",
"address",
"=",
"{",
"address",
"}",
"# set",
"elif",
"isinstance",
"(",
"address",
",",
"(",
"list",
",",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Recipients.get_first_recipient_with_address | Returns the first recipient found with a non blank address
:return: First Recipient
:rtype: Recipient | O365/utils/utils.py | def get_first_recipient_with_address(self):
""" Returns the first recipient found with a non blank address
:return: First Recipient
:rtype: Recipient
"""
recipients_with_address = [recipient for recipient in self._recipients
if recipient.addres... | def get_first_recipient_with_address(self):
""" Returns the first recipient found with a non blank address
:return: First Recipient
:rtype: Recipient
"""
recipients_with_address = [recipient for recipient in self._recipients
if recipient.addres... | [
"Returns",
"the",
"first",
"recipient",
"found",
"with",
"a",
"non",
"blank",
"address"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L259-L270 | [
"def",
"get_first_recipient_with_address",
"(",
"self",
")",
":",
"recipients_with_address",
"=",
"[",
"recipient",
"for",
"recipient",
"in",
"self",
".",
"_recipients",
"if",
"recipient",
".",
"address",
"]",
"if",
"recipients_with_address",
":",
"return",
"recipie... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | HandleRecipientsMixin._recipients_from_cloud | Transform a recipient from cloud data to object data | O365/utils/utils.py | def _recipients_from_cloud(self, recipients, field=None):
""" Transform a recipient from cloud data to object data """
recipients_data = []
for recipient in recipients:
recipients_data.append(
self._recipient_from_cloud(recipient, field=field))
return Recipien... | def _recipients_from_cloud(self, recipients, field=None):
""" Transform a recipient from cloud data to object data """
recipients_data = []
for recipient in recipients:
recipients_data.append(
self._recipient_from_cloud(recipient, field=field))
return Recipien... | [
"Transform",
"a",
"recipient",
"from",
"cloud",
"data",
"to",
"object",
"data"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L275-L281 | [
"def",
"_recipients_from_cloud",
"(",
"self",
",",
"recipients",
",",
"field",
"=",
"None",
")",
":",
"recipients_data",
"=",
"[",
"]",
"for",
"recipient",
"in",
"recipients",
":",
"recipients_data",
".",
"append",
"(",
"self",
".",
"_recipient_from_cloud",
"(... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | HandleRecipientsMixin._recipient_from_cloud | Transform a recipient from cloud data to object data | O365/utils/utils.py | def _recipient_from_cloud(self, recipient, field=None):
""" Transform a recipient from cloud data to object data """
if recipient:
recipient = recipient.get(self._cc('emailAddress'),
recipient if isinstance(recipient,
... | def _recipient_from_cloud(self, recipient, field=None):
""" Transform a recipient from cloud data to object data """
if recipient:
recipient = recipient.get(self._cc('emailAddress'),
recipient if isinstance(recipient,
... | [
"Transform",
"a",
"recipient",
"from",
"cloud",
"data",
"to",
"object",
"data"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L283-L295 | [
"def",
"_recipient_from_cloud",
"(",
"self",
",",
"recipient",
",",
"field",
"=",
"None",
")",
":",
"if",
"recipient",
":",
"recipient",
"=",
"recipient",
".",
"get",
"(",
"self",
".",
"_cc",
"(",
"'emailAddress'",
")",
",",
"recipient",
"if",
"isinstance"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | HandleRecipientsMixin._recipient_to_cloud | Transforms a Recipient object to a cloud dict | O365/utils/utils.py | def _recipient_to_cloud(self, recipient):
""" Transforms a Recipient object to a cloud dict """
data = None
if recipient:
data = {self._cc('emailAddress'): {
self._cc('address'): recipient.address}}
if recipient.name:
data[self._cc('emailAd... | def _recipient_to_cloud(self, recipient):
""" Transforms a Recipient object to a cloud dict """
data = None
if recipient:
data = {self._cc('emailAddress'): {
self._cc('address'): recipient.address}}
if recipient.name:
data[self._cc('emailAd... | [
"Transforms",
"a",
"Recipient",
"object",
"to",
"a",
"cloud",
"dict"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L297-L306 | [
"def",
"_recipient_to_cloud",
"(",
"self",
",",
"recipient",
")",
":",
"data",
"=",
"None",
"if",
"recipient",
":",
"data",
"=",
"{",
"self",
".",
"_cc",
"(",
"'emailAddress'",
")",
":",
"{",
"self",
".",
"_cc",
"(",
"'address'",
")",
":",
"recipient",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | ApiComponent._parse_resource | Parses and completes resource information | O365/utils/utils.py | def _parse_resource(resource):
""" Parses and completes resource information """
resource = resource.strip() if resource else resource
if resource in {ME_RESOURCE, USERS_RESOURCE}:
return resource
elif '@' in resource and not resource.startswith(USERS_RESOURCE):
#... | def _parse_resource(resource):
""" Parses and completes resource information """
resource = resource.strip() if resource else resource
if resource in {ME_RESOURCE, USERS_RESOURCE}:
return resource
elif '@' in resource and not resource.startswith(USERS_RESOURCE):
#... | [
"Parses",
"and",
"completes",
"resource",
"information"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L347-L358 | [
"def",
"_parse_resource",
"(",
"resource",
")",
":",
"resource",
"=",
"resource",
".",
"strip",
"(",
")",
"if",
"resource",
"else",
"resource",
"if",
"resource",
"in",
"{",
"ME_RESOURCE",
",",
"USERS_RESOURCE",
"}",
":",
"return",
"resource",
"elif",
"'@'",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | ApiComponent._parse_date_time_time_zone | Parses and convert to protocol timezone a dateTimeTimeZone resource
This resource is a dict with a date time and a windows timezone
This is a common structure on Microsoft apis so it's included here. | O365/utils/utils.py | def _parse_date_time_time_zone(self, date_time_time_zone):
""" Parses and convert to protocol timezone a dateTimeTimeZone resource
This resource is a dict with a date time and a windows timezone
This is a common structure on Microsoft apis so it's included here.
"""
if date_time_... | def _parse_date_time_time_zone(self, date_time_time_zone):
""" Parses and convert to protocol timezone a dateTimeTimeZone resource
This resource is a dict with a date time and a windows timezone
This is a common structure on Microsoft apis so it's included here.
"""
if date_time_... | [
"Parses",
"and",
"convert",
"to",
"protocol",
"timezone",
"a",
"dateTimeTimeZone",
"resource",
"This",
"resource",
"is",
"a",
"dict",
"with",
"a",
"date",
"time",
"and",
"a",
"windows",
"timezone",
"This",
"is",
"a",
"common",
"structure",
"on",
"Microsoft",
... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L378-L410 | [
"def",
"_parse_date_time_time_zone",
"(",
"self",
",",
"date_time_time_zone",
")",
":",
"if",
"date_time_time_zone",
"is",
"None",
":",
"return",
"None",
"local_tz",
"=",
"self",
".",
"protocol",
".",
"timezone",
"if",
"isinstance",
"(",
"date_time_time_zone",
","... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | ApiComponent._build_date_time_time_zone | Converts a datetime to a dateTimeTimeZone resource | O365/utils/utils.py | def _build_date_time_time_zone(self, date_time):
""" Converts a datetime to a dateTimeTimeZone resource """
timezone = date_time.tzinfo.zone if date_time.tzinfo is not None else None
return {
self._cc('dateTime'): date_time.strftime('%Y-%m-%dT%H:%M:%S'),
self._cc('timeZon... | def _build_date_time_time_zone(self, date_time):
""" Converts a datetime to a dateTimeTimeZone resource """
timezone = date_time.tzinfo.zone if date_time.tzinfo is not None else None
return {
self._cc('dateTime'): date_time.strftime('%Y-%m-%dT%H:%M:%S'),
self._cc('timeZon... | [
"Converts",
"a",
"datetime",
"to",
"a",
"dateTimeTimeZone",
"resource"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L412-L418 | [
"def",
"_build_date_time_time_zone",
"(",
"self",
",",
"date_time",
")",
":",
"timezone",
"=",
"date_time",
".",
"tzinfo",
".",
"zone",
"if",
"date_time",
".",
"tzinfo",
"is",
"not",
"None",
"else",
"None",
"return",
"{",
"self",
".",
"_cc",
"(",
"'dateTim... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.select | Adds the attribute to the $select parameter
:param str attributes: the attributes tuple to select.
If empty, the on_attribute previously set is added.
:rtype: Query | O365/utils/utils.py | def select(self, *attributes):
""" Adds the attribute to the $select parameter
:param str attributes: the attributes tuple to select.
If empty, the on_attribute previously set is added.
:rtype: Query
"""
if attributes:
for attribute in attributes:
... | def select(self, *attributes):
""" Adds the attribute to the $select parameter
:param str attributes: the attributes tuple to select.
If empty, the on_attribute previously set is added.
:rtype: Query
"""
if attributes:
for attribute in attributes:
... | [
"Adds",
"the",
"attribute",
"to",
"the",
"$select",
"parameter"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L585-L606 | [
"def",
"select",
"(",
"self",
",",
"*",
"attributes",
")",
":",
"if",
"attributes",
":",
"for",
"attribute",
"in",
"attributes",
":",
"attribute",
"=",
"self",
".",
"protocol",
".",
"convert_case",
"(",
"attribute",
")",
"if",
"attribute",
"and",
"isinstan... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.expand | Adds the relationships (e.g. "event" or "attachments")
that should be expanded with the $expand parameter
Important: The ApiComponent using this should know how to handle this relationships.
eg: Message knows how to handle attachments, and event (if it's an EventMessage).
Important: ... | O365/utils/utils.py | def expand(self, *relationships):
""" Adds the relationships (e.g. "event" or "attachments")
that should be expanded with the $expand parameter
Important: The ApiComponent using this should know how to handle this relationships.
eg: Message knows how to handle attachments, and event ... | def expand(self, *relationships):
""" Adds the relationships (e.g. "event" or "attachments")
that should be expanded with the $expand parameter
Important: The ApiComponent using this should know how to handle this relationships.
eg: Message knows how to handle attachments, and event ... | [
"Adds",
"the",
"relationships",
"(",
"e",
".",
"g",
".",
"event",
"or",
"attachments",
")",
"that",
"should",
"be",
"expanded",
"with",
"the",
"$expand",
"parameter",
"Important",
":",
"The",
"ApiComponent",
"using",
"this",
"should",
"know",
"how",
"to",
... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L609-L624 | [
"def",
"expand",
"(",
"self",
",",
"*",
"relationships",
")",
":",
"for",
"relationship",
"in",
"relationships",
":",
"if",
"relationship",
"==",
"'event'",
":",
"relationship",
"=",
"'{}/event'",
".",
"format",
"(",
"self",
".",
"protocol",
".",
"get_servic... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.search | Perform a search.
Not from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param str text: the text to search
:return: the Query instance | O365/utils/utils.py | def search(self, text):
"""
Perform a search.
Not from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param str text: the text to se... | def search(self, text):
"""
Perform a search.
Not from graph docs:
You can currently search only message and person collections.
A $search request returns up to 250 results.
You cannot use $filter or $orderby in a search request.
:param str text: the text to se... | [
"Perform",
"a",
"search",
".",
"Not",
"from",
"graph",
"docs",
":",
"You",
"can",
"currently",
"search",
"only",
"message",
"and",
"person",
"collections",
".",
"A",
"$search",
"request",
"returns",
"up",
"to",
"250",
"results",
".",
"You",
"cannot",
"use"... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L627-L645 | [
"def",
"search",
"(",
"self",
",",
"text",
")",
":",
"if",
"text",
"is",
"None",
":",
"self",
".",
"_search",
"=",
"None",
"else",
":",
"# filters an order are not allowed",
"self",
".",
"clear_filters",
"(",
")",
"self",
".",
"clear_order",
"(",
")",
"s... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.as_params | Returns the filters, orders, select, expands and search as query parameters
:rtype: dict | O365/utils/utils.py | def as_params(self):
""" Returns the filters, orders, select, expands and search as query parameters
:rtype: dict
"""
params = {}
if self.has_filters:
params['$filter'] = self.get_filters()
if self.has_order:
params['$orderby'] = self.get_order()
... | def as_params(self):
""" Returns the filters, orders, select, expands and search as query parameters
:rtype: dict
"""
params = {}
if self.has_filters:
params['$filter'] = self.get_filters()
if self.has_order:
params['$orderby'] = self.get_order()
... | [
"Returns",
"the",
"filters",
"orders",
"select",
"expands",
"and",
"search",
"as",
"query",
"parameters"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L647-L665 | [
"def",
"as_params",
"(",
"self",
")",
":",
"params",
"=",
"{",
"}",
"if",
"self",
".",
"has_filters",
":",
"params",
"[",
"'$filter'",
"]",
"=",
"self",
".",
"get_filters",
"(",
")",
"if",
"self",
".",
"has_order",
":",
"params",
"[",
"'$orderby'",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.get_filters | Returns the result filters
:rtype: str or None | O365/utils/utils.py | def get_filters(self):
""" Returns the result filters
:rtype: str or None
"""
if self._filters:
filters_list = self._filters
if isinstance(filters_list[-1], Enum):
filters_list = filters_list[:-1]
return ' '.join(
[fs.v... | def get_filters(self):
""" Returns the result filters
:rtype: str or None
"""
if self._filters:
filters_list = self._filters
if isinstance(filters_list[-1], Enum):
filters_list = filters_list[:-1]
return ' '.join(
[fs.v... | [
"Returns",
"the",
"result",
"filters"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L699-L712 | [
"def",
"get_filters",
"(",
"self",
")",
":",
"if",
"self",
".",
"_filters",
":",
"filters_list",
"=",
"self",
".",
"_filters",
"if",
"isinstance",
"(",
"filters_list",
"[",
"-",
"1",
"]",
",",
"Enum",
")",
":",
"filters_list",
"=",
"filters_list",
"[",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.get_order | Returns the result order by clauses
:rtype: str or None | O365/utils/utils.py | def get_order(self):
""" Returns the result order by clauses
:rtype: str or None
"""
# first get the filtered attributes in order as they must appear
# in the order_by first
if not self.has_order:
return None
filter_order_clauses = OrderedDict([(filte... | def get_order(self):
""" Returns the result order by clauses
:rtype: str or None
"""
# first get the filtered attributes in order as they must appear
# in the order_by first
if not self.has_order:
return None
filter_order_clauses = OrderedDict([(filte... | [
"Returns",
"the",
"result",
"order",
"by",
"clauses"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L714-L743 | [
"def",
"get_order",
"(",
"self",
")",
":",
"# first get the filtered attributes in order as they must appear",
"# in the order_by first",
"if",
"not",
"self",
".",
"has_order",
":",
"return",
"None",
"filter_order_clauses",
"=",
"OrderedDict",
"(",
"[",
"(",
"filter_attr"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.new | Combine with a new query
:param str attribute: attribute of new query
:param ChainOperator operation: operation to combine to new query
:rtype: Query | O365/utils/utils.py | def new(self, attribute, operation=ChainOperator.AND):
""" Combine with a new query
:param str attribute: attribute of new query
:param ChainOperator operation: operation to combine to new query
:rtype: Query
"""
if isinstance(operation, str):
operation = Cha... | def new(self, attribute, operation=ChainOperator.AND):
""" Combine with a new query
:param str attribute: attribute of new query
:param ChainOperator operation: operation to combine to new query
:rtype: Query
"""
if isinstance(operation, str):
operation = Cha... | [
"Combine",
"with",
"a",
"new",
"query"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L778-L790 | [
"def",
"new",
"(",
"self",
",",
"attribute",
",",
"operation",
"=",
"ChainOperator",
".",
"AND",
")",
":",
"if",
"isinstance",
"(",
"operation",
",",
"str",
")",
":",
"operation",
"=",
"ChainOperator",
"(",
"operation",
")",
"self",
".",
"_chain",
"=",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.clear | Clear everything
:rtype: Query | O365/utils/utils.py | def clear(self):
""" Clear everything
:rtype: Query
"""
self._filters = []
self._order_by = OrderedDict()
self._selects = set()
self._negation = False
self._attribute = None
self._chain = None
self._search = None
return self | def clear(self):
""" Clear everything
:rtype: Query
"""
self._filters = []
self._order_by = OrderedDict()
self._selects = set()
self._negation = False
self._attribute = None
self._chain = None
self._search = None
return self | [
"Clear",
"everything"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L801-L814 | [
"def",
"clear",
"(",
"self",
")",
":",
"self",
".",
"_filters",
"=",
"[",
"]",
"self",
".",
"_order_by",
"=",
"OrderedDict",
"(",
")",
"self",
".",
"_selects",
"=",
"set",
"(",
")",
"self",
".",
"_negation",
"=",
"False",
"self",
".",
"_attribute",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.chain | Start a chain operation
:param ChainOperator, str operation: how to combine with a new one
:rtype: Query | O365/utils/utils.py | def chain(self, operation=ChainOperator.AND):
""" Start a chain operation
:param ChainOperator, str operation: how to combine with a new one
:rtype: Query
"""
if isinstance(operation, str):
operation = ChainOperator(operation)
self._chain = operation
... | def chain(self, operation=ChainOperator.AND):
""" Start a chain operation
:param ChainOperator, str operation: how to combine with a new one
:rtype: Query
"""
if isinstance(operation, str):
operation = ChainOperator(operation)
self._chain = operation
... | [
"Start",
"a",
"chain",
"operation"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L826-L835 | [
"def",
"chain",
"(",
"self",
",",
"operation",
"=",
"ChainOperator",
".",
"AND",
")",
":",
"if",
"isinstance",
"(",
"operation",
",",
"str",
")",
":",
"operation",
"=",
"ChainOperator",
"(",
"operation",
")",
"self",
".",
"_chain",
"=",
"operation",
"ret... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.remove_filter | Removes a filter given the attribute name | O365/utils/utils.py | def remove_filter(self, filter_attr):
""" Removes a filter given the attribute name """
filter_attr = self._get_mapping(filter_attr)
new_filters = []
remove_chain = False
for flt in self._filters:
if isinstance(flt, tuple):
if flt[0] == filter_attr:
... | def remove_filter(self, filter_attr):
""" Removes a filter given the attribute name """
filter_attr = self._get_mapping(filter_attr)
new_filters = []
remove_chain = False
for flt in self._filters:
if isinstance(flt, tuple):
if flt[0] == filter_attr:
... | [
"Removes",
"a",
"filter",
"given",
"the",
"attribute",
"name"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L847-L866 | [
"def",
"remove_filter",
"(",
"self",
",",
"filter_attr",
")",
":",
"filter_attr",
"=",
"self",
".",
"_get_mapping",
"(",
"filter_attr",
")",
"new_filters",
"=",
"[",
"]",
"remove_chain",
"=",
"False",
"for",
"flt",
"in",
"self",
".",
"_filters",
":",
"if",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query._parse_filter_word | Converts the word parameter into the correct format | O365/utils/utils.py | def _parse_filter_word(self, word):
""" Converts the word parameter into the correct format """
if isinstance(word, str):
word = "'{}'".format(word)
elif isinstance(word, dt.date):
if isinstance(word, dt.datetime):
if word.tzinfo is None:
... | def _parse_filter_word(self, word):
""" Converts the word parameter into the correct format """
if isinstance(word, str):
word = "'{}'".format(word)
elif isinstance(word, dt.date):
if isinstance(word, dt.datetime):
if word.tzinfo is None:
... | [
"Converts",
"the",
"word",
"parameter",
"into",
"the",
"correct",
"format"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L879-L907 | [
"def",
"_parse_filter_word",
"(",
"self",
",",
"word",
")",
":",
"if",
"isinstance",
"(",
"word",
",",
"str",
")",
":",
"word",
"=",
"\"'{}'\"",
".",
"format",
"(",
"word",
")",
"elif",
"isinstance",
"(",
"word",
",",
"dt",
".",
"date",
")",
":",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.logical_operator | Apply a logical operator
:param str operation: how to combine with a new one
:param word: other parameter for the operation
(a = b) would be like a.logical_operator('eq', 'b')
:rtype: Query | O365/utils/utils.py | def logical_operator(self, operation, word):
""" Apply a logical operator
:param str operation: how to combine with a new one
:param word: other parameter for the operation
(a = b) would be like a.logical_operator('eq', 'b')
:rtype: Query
"""
word = self._parse_... | def logical_operator(self, operation, word):
""" Apply a logical operator
:param str operation: how to combine with a new one
:param word: other parameter for the operation
(a = b) would be like a.logical_operator('eq', 'b')
:rtype: Query
"""
word = self._parse_... | [
"Apply",
"a",
"logical",
"operator"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L916-L928 | [
"def",
"logical_operator",
"(",
"self",
",",
"operation",
",",
"word",
")",
":",
"word",
"=",
"self",
".",
"_parse_filter_word",
"(",
"word",
")",
"self",
".",
"_add_filter",
"(",
"*",
"self",
".",
"_prepare_sentence",
"(",
"self",
".",
"_attribute",
",",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.function | Apply a function on given word
:param str function_name: function to apply
:param str word: word to apply function on
:rtype: Query | O365/utils/utils.py | def function(self, function_name, word):
""" Apply a function on given word
:param str function_name: function to apply
:param str word: word to apply function on
:rtype: Query
"""
word = self._parse_filter_word(word)
self._add_filter(
*self._prepare... | def function(self, function_name, word):
""" Apply a function on given word
:param str function_name: function to apply
:param str word: word to apply function on
:rtype: Query
"""
word = self._parse_filter_word(word)
self._add_filter(
*self._prepare... | [
"Apply",
"a",
"function",
"on",
"given",
"word"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L991-L1003 | [
"def",
"function",
"(",
"self",
",",
"function_name",
",",
"word",
")",
":",
"word",
"=",
"self",
".",
"_parse_filter_word",
"(",
"word",
")",
"self",
".",
"_add_filter",
"(",
"*",
"self",
".",
"_prepare_function",
"(",
"function_name",
",",
"self",
".",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.iterable | Performs a filter with the OData 'iterable_name' keyword
on the collection
For example:
q.iterable('any', collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filter such as:
emailAddresses/any(a:a/address eq 'ge... | O365/utils/utils.py | def iterable(self, iterable_name, *, collection, attribute, word, func=None,
operation=None):
""" Performs a filter with the OData 'iterable_name' keyword
on the collection
For example:
q.iterable('any', collection='email_addresses', attribute='address',
operati... | def iterable(self, iterable_name, *, collection, attribute, word, func=None,
operation=None):
""" Performs a filter with the OData 'iterable_name' keyword
on the collection
For example:
q.iterable('any', collection='email_addresses', attribute='address',
operati... | [
"Performs",
"a",
"filter",
"with",
"the",
"OData",
"iterable_name",
"keyword",
"on",
"the",
"collection"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L1033-L1081 | [
"def",
"iterable",
"(",
"self",
",",
"iterable_name",
",",
"*",
",",
"collection",
",",
"attribute",
",",
"word",
",",
"func",
"=",
"None",
",",
"operation",
"=",
"None",
")",
":",
"if",
"func",
"is",
"None",
"and",
"operation",
"is",
"None",
":",
"r... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.any | Performs a filter with the OData 'any' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filter such as:
emailAddresses/any(a:a/address eq 'george@best.com')
:par... | O365/utils/utils.py | def any(self, *, collection, attribute, word, func=None, operation=None):
""" Performs a filter with the OData 'any' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filte... | def any(self, *, collection, attribute, word, func=None, operation=None):
""" Performs a filter with the OData 'any' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filte... | [
"Performs",
"a",
"filter",
"with",
"the",
"OData",
"any",
"keyword",
"on",
"the",
"collection"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L1084-L1106 | [
"def",
"any",
"(",
"self",
",",
"*",
",",
"collection",
",",
"attribute",
",",
"word",
",",
"func",
"=",
"None",
",",
"operation",
"=",
"None",
")",
":",
"return",
"self",
".",
"iterable",
"(",
"'any'",
",",
"collection",
"=",
"collection",
",",
"att... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.all | Performs a filter with the OData 'all' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filter such as:
emailAddresses/all(a:a/address eq 'george@best.com')
:par... | O365/utils/utils.py | def all(self, *, collection, attribute, word, func=None, operation=None):
""" Performs a filter with the OData 'all' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filte... | def all(self, *, collection, attribute, word, func=None, operation=None):
""" Performs a filter with the OData 'all' keyword on the collection
For example:
q.any(collection='email_addresses', attribute='address',
operation='eq', word='george@best.com')
will transform to a filte... | [
"Performs",
"a",
"filter",
"with",
"the",
"OData",
"all",
"keyword",
"on",
"the",
"collection"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L1109-L1131 | [
"def",
"all",
"(",
"self",
",",
"*",
",",
"collection",
",",
"attribute",
",",
"word",
",",
"func",
"=",
"None",
",",
"operation",
"=",
"None",
")",
":",
"return",
"self",
".",
"iterable",
"(",
"'all'",
",",
"collection",
"=",
"collection",
",",
"att... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Query.order_by | Applies a order_by clause
:param str attribute: attribute to apply on
:param bool ascending: should it apply ascending order or descending
:rtype: Query | O365/utils/utils.py | def order_by(self, attribute=None, *, ascending=True):
""" Applies a order_by clause
:param str attribute: attribute to apply on
:param bool ascending: should it apply ascending order or descending
:rtype: Query
"""
attribute = self._get_mapping(attribute) or self._attri... | def order_by(self, attribute=None, *, ascending=True):
""" Applies a order_by clause
:param str attribute: attribute to apply on
:param bool ascending: should it apply ascending order or descending
:rtype: Query
"""
attribute = self._get_mapping(attribute) or self._attri... | [
"Applies",
"a",
"order_by",
"clause"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/utils.py#L1134-L1148 | [
"def",
"order_by",
"(",
"self",
",",
"attribute",
"=",
"None",
",",
"*",
",",
"ascending",
"=",
"True",
")",
":",
"attribute",
"=",
"self",
".",
"_get_mapping",
"(",
"attribute",
")",
"or",
"self",
".",
"_attribute",
"if",
"attribute",
":",
"self",
"."... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Planner.get_my_tasks | Returns a list of open planner tasks assigned to me
:rtype: tasks | O365/planner.py | def get_my_tasks(self, *args):
""" Returns a list of open planner tasks assigned to me
:rtype: tasks
"""
url = self.build_url(self._endpoints.get('get_my_tasks'))
response = self.con.get(url)
if not response:
return None
data = response.json()
... | def get_my_tasks(self, *args):
""" Returns a list of open planner tasks assigned to me
:rtype: tasks
"""
url = self.build_url(self._endpoints.get('get_my_tasks'))
response = self.con.get(url)
if not response:
return None
data = response.json()
... | [
"Returns",
"a",
"list",
"of",
"open",
"planner",
"tasks",
"assigned",
"to",
"me"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/planner.py#L112-L129 | [
"def",
"get_my_tasks",
"(",
"self",
",",
"*",
"args",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_my_tasks'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"get",
"(",
"url",
")",
"if... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | get_iana_tz | Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given
windows TimeZone
:param windows_tz: windows format timezone usually returned by
microsoft api response
:return:
:rtype: | O365/utils/windows_tz.py | def get_iana_tz(windows_tz):
""" Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given
windows TimeZone
:param windows_tz: windows format timezone usually returned by
microsoft api response
:return:
:rtype:
"""
timezone = WIN_TO_IANA.get(windows_tz)
if timezone is None:... | def get_iana_tz(windows_tz):
""" Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given
windows TimeZone
:param windows_tz: windows format timezone usually returned by
microsoft api response
:return:
:rtype:
"""
timezone = WIN_TO_IANA.get(windows_tz)
if timezone is None:... | [
"Returns",
"a",
"valid",
"pytz",
"TimeZone",
"(",
"Iana",
"/",
"Olson",
"Timezones",
")",
"from",
"a",
"given",
"windows",
"TimeZone"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/windows_tz.py#L477-L497 | [
"def",
"get_iana_tz",
"(",
"windows_tz",
")",
":",
"timezone",
"=",
"WIN_TO_IANA",
".",
"get",
"(",
"windows_tz",
")",
"if",
"timezone",
"is",
"None",
":",
"# Nope, that didn't work. Try adding \"Standard Time\",",
"# it seems to work a lot of times:",
"timezone",
"=",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | get_windows_tz | Returns a valid windows TimeZone from a given pytz TimeZone
(Iana/Olson Timezones)
Note: Windows Timezones are SHIT!... no ... really THEY ARE
HOLY FUCKING SHIT!. | O365/utils/windows_tz.py | def get_windows_tz(iana_tz):
""" Returns a valid windows TimeZone from a given pytz TimeZone
(Iana/Olson Timezones)
Note: Windows Timezones are SHIT!... no ... really THEY ARE
HOLY FUCKING SHIT!.
"""
timezone = IANA_TO_WIN.get(
iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
... | def get_windows_tz(iana_tz):
""" Returns a valid windows TimeZone from a given pytz TimeZone
(Iana/Olson Timezones)
Note: Windows Timezones are SHIT!... no ... really THEY ARE
HOLY FUCKING SHIT!.
"""
timezone = IANA_TO_WIN.get(
iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz)
... | [
"Returns",
"a",
"valid",
"windows",
"TimeZone",
"from",
"a",
"given",
"pytz",
"TimeZone",
"(",
"Iana",
"/",
"Olson",
"Timezones",
")",
"Note",
":",
"Windows",
"Timezones",
"are",
"SHIT!",
"...",
"no",
"...",
"really",
"THEY",
"ARE",
"HOLY",
"FUCKING",
"SHI... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/utils/windows_tz.py#L500-L512 | [
"def",
"get_windows_tz",
"(",
"iana_tz",
")",
":",
"timezone",
"=",
"IANA_TO_WIN",
".",
"get",
"(",
"iana_tz",
".",
"zone",
"if",
"isinstance",
"(",
"iana_tz",
",",
"tzinfo",
")",
"else",
"iana_tz",
")",
"if",
"timezone",
"is",
"None",
":",
"raise",
"pyt... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointListItem.update_fields | Update the value for a field(s) in the listitem
:param update: A dict of {'field name': newvalue} | O365/sharepoint.py | def update_fields(self, updates):
"""
Update the value for a field(s) in the listitem
:param update: A dict of {'field name': newvalue}
"""
for field in updates:
if self._valid_field(field):
self._track_changes.add(field)
else:
... | def update_fields(self, updates):
"""
Update the value for a field(s) in the listitem
:param update: A dict of {'field name': newvalue}
"""
for field in updates:
if self._valid_field(field):
self._track_changes.add(field)
else:
... | [
"Update",
"the",
"value",
"for",
"a",
"field",
"(",
"s",
")",
"in",
"the",
"listitem"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L136-L153 | [
"def",
"update_fields",
"(",
"self",
",",
"updates",
")",
":",
"for",
"field",
"in",
"updates",
":",
"if",
"self",
".",
"_valid_field",
"(",
"field",
")",
":",
"self",
".",
"_track_changes",
".",
"add",
"(",
"field",
")",
"else",
":",
"raise",
"ValueEr... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointListItem.save_updates | Save the updated fields to the cloud | O365/sharepoint.py | def save_updates(self):
"""Save the updated fields to the cloud"""
if not self._track_changes:
return True # there's nothing to update
url = self.build_url(self._endpoints.get('update_list_item').format(item_id=self.object_id))
update = {field: value for field, value in se... | def save_updates(self):
"""Save the updated fields to the cloud"""
if not self._track_changes:
return True # there's nothing to update
url = self.build_url(self._endpoints.get('update_list_item').format(item_id=self.object_id))
update = {field: value for field, value in se... | [
"Save",
"the",
"updated",
"fields",
"to",
"the",
"cloud"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L155-L169 | [
"def",
"save_updates",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_track_changes",
":",
"return",
"True",
"# there's nothing to update",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'update_list_item'",
")",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointList.get_items | Returns a collection of Sharepoint Items
:rtype: list[SharepointListItem] | O365/sharepoint.py | def get_items(self):
""" Returns a collection of Sharepoint Items
:rtype: list[SharepointListItem]
"""
url = self.build_url(self._endpoints.get('get_items'))
response = self.con.get(url)
if not response:
return []
data = response.json()
re... | def get_items(self):
""" Returns a collection of Sharepoint Items
:rtype: list[SharepointListItem]
"""
url = self.build_url(self._endpoints.get('get_items'))
response = self.con.get(url)
if not response:
return []
data = response.json()
re... | [
"Returns",
"a",
"collection",
"of",
"Sharepoint",
"Items"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L247-L263 | [
"def",
"get_items",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_items'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"get",
"(",
"url",
")",
"if",
"not",
"response",
":... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointList.get_item_by_id | Returns a sharepoint list item based on id | O365/sharepoint.py | def get_item_by_id(self, item_id):
""" Returns a sharepoint list item based on id"""
url = self.build_url(self._endpoints.get('get_item_by_id').format(item_id=item_id))
response = self.con.get(url)
if not response:
return []
data = response.json()
return ... | def get_item_by_id(self, item_id):
""" Returns a sharepoint list item based on id"""
url = self.build_url(self._endpoints.get('get_item_by_id').format(item_id=item_id))
response = self.con.get(url)
if not response:
return []
data = response.json()
return ... | [
"Returns",
"a",
"sharepoint",
"list",
"item",
"based",
"on",
"id"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L265-L277 | [
"def",
"get_item_by_id",
"(",
"self",
",",
"item_id",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_item_by_id'",
")",
".",
"format",
"(",
"item_id",
"=",
"item_id",
")",
")",
"response",
"=",
"s... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointList.get_list_columns | Returns the sharepoint list columns | O365/sharepoint.py | def get_list_columns(self):
""" Returns the sharepoint list columns """
url = self.build_url(self._endpoints.get('get_list_columns'))
response = self.con.get(url)
if not response:
return []
data = response.json()
return [self.list_column_constructor(paren... | def get_list_columns(self):
""" Returns the sharepoint list columns """
url = self.build_url(self._endpoints.get('get_list_columns'))
response = self.con.get(url)
if not response:
return []
data = response.json()
return [self.list_column_constructor(paren... | [
"Returns",
"the",
"sharepoint",
"list",
"columns"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L279-L292 | [
"def",
"get_list_columns",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_list_columns'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"get",
"(",
"url",
")",
"if",
"not",
"r... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointList.create_list_item | Create new list item
:param new_data: dictionary of {'col_name': col_value}
:rtype: SharepointListItem | O365/sharepoint.py | def create_list_item(self, new_data):
"""Create new list item
:param new_data: dictionary of {'col_name': col_value}
:rtype: SharepointListItem
"""
url = self.build_url(self._endpoints.get('get_items'))
response = self.con.post(url, {'fields': new_data})
if no... | def create_list_item(self, new_data):
"""Create new list item
:param new_data: dictionary of {'col_name': col_value}
:rtype: SharepointListItem
"""
url = self.build_url(self._endpoints.get('get_items'))
response = self.con.post(url, {'fields': new_data})
if no... | [
"Create",
"new",
"list",
"item"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L294-L310 | [
"def",
"create_list_item",
"(",
"self",
",",
"new_data",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_items'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"post",
"(",
"url",
",",
"{",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | SharepointList.delete_list_item | Delete an existing list item
:param item_id: Id of the item to be delted | O365/sharepoint.py | def delete_list_item(self, item_id):
""" Delete an existing list item
:param item_id: Id of the item to be delted
"""
url = self.build_url(self._endpoints.get('get_item_by_id').format(item_id=item_id))
response = self.con.delete(url)
return bool(response) | def delete_list_item(self, item_id):
""" Delete an existing list item
:param item_id: Id of the item to be delted
"""
url = self.build_url(self._endpoints.get('get_item_by_id').format(item_id=item_id))
response = self.con.delete(url)
return bool(response) | [
"Delete",
"an",
"existing",
"list",
"item"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L312-L322 | [
"def",
"delete_list_item",
"(",
"self",
",",
"item_id",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_item_by_id'",
")",
".",
"format",
"(",
"item_id",
"=",
"item_id",
")",
")",
"response",
"=",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Site.list_document_libraries | Returns a collection of document libraries for this site
(a collection of Drive instances)
:param int limit: max no. of items to get. Over 999 uses batch.
:param query: applies a OData filter to the request
:type query: Query or str
:param order_by: orders the result set based o... | O365/sharepoint.py | def list_document_libraries(self, limit=None, *, query=None, order_by=None,
batch=None):
""" Returns a collection of document libraries for this site
(a collection of Drive instances)
:param int limit: max no. of items to get. Over 999 uses batch.
:param ... | def list_document_libraries(self, limit=None, *, query=None, order_by=None,
batch=None):
""" Returns a collection of document libraries for this site
(a collection of Drive instances)
:param int limit: max no. of items to get. Over 999 uses batch.
:param ... | [
"Returns",
"a",
"collection",
"of",
"document",
"libraries",
"for",
"this",
"site",
"(",
"a",
"collection",
"of",
"Drive",
"instances",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L411-L427 | [
"def",
"list_document_libraries",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"*",
",",
"query",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"batch",
"=",
"None",
")",
":",
"return",
"self",
".",
"site_storage",
".",
"get_drives",
"(",
"limit",
"=... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Site.get_subsites | Returns a list of subsites defined for this site
:rtype: list[Site] | O365/sharepoint.py | def get_subsites(self):
""" Returns a list of subsites defined for this site
:rtype: list[Site]
"""
url = self.build_url(
self._endpoints.get('get_subsites').format(id=self.object_id))
response = self.con.get(url)
if not response:
return []
... | def get_subsites(self):
""" Returns a list of subsites defined for this site
:rtype: list[Site]
"""
url = self.build_url(
self._endpoints.get('get_subsites').format(id=self.object_id))
response = self.con.get(url)
if not response:
return []
... | [
"Returns",
"a",
"list",
"of",
"subsites",
"defined",
"for",
"this",
"site"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L429-L445 | [
"def",
"get_subsites",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_subsites'",
")",
".",
"format",
"(",
"id",
"=",
"self",
".",
"object_id",
")",
")",
"response",
"=",
"self",
".... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Site.get_lists | Returns a collection of lists within this site
:rtype: list[SharepointList] | O365/sharepoint.py | def get_lists(self):
""" Returns a collection of lists within this site
:rtype: list[SharepointList]
"""
url = self.build_url(self._endpoints.get('get_lists'))
response = self.con.get(url)
if not response:
return []
data = response.json()
r... | def get_lists(self):
""" Returns a collection of lists within this site
:rtype: list[SharepointList]
"""
url = self.build_url(self._endpoints.get('get_lists'))
response = self.con.get(url)
if not response:
return []
data = response.json()
r... | [
"Returns",
"a",
"collection",
"of",
"lists",
"within",
"this",
"site"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L447-L460 | [
"def",
"get_lists",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'get_lists'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"get",
"(",
"url",
")",
"if",
"not",
"response",
":... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Site.get_list_by_name | Returns a sharepoint list based on the display name of the list | O365/sharepoint.py | def get_list_by_name(self, display_name):
"""
Returns a sharepoint list based on the display name of the list
"""
if not display_name:
raise ValueError('Must provide a valid list display name')
url = self.build_url(self._endpoints.get('get_list_by_name').format(disp... | def get_list_by_name(self, display_name):
"""
Returns a sharepoint list based on the display name of the list
"""
if not display_name:
raise ValueError('Must provide a valid list display name')
url = self.build_url(self._endpoints.get('get_list_by_name').format(disp... | [
"Returns",
"a",
"sharepoint",
"list",
"based",
"on",
"the",
"display",
"name",
"of",
"the",
"list"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L462-L478 | [
"def",
"get_list_by_name",
"(",
"self",
",",
"display_name",
")",
":",
"if",
"not",
"display_name",
":",
"raise",
"ValueError",
"(",
"'Must provide a valid list display name'",
")",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Sharepoint.search_site | Search a sharepoint host for sites with the provided keyword
:param keyword: a keyword to search sites
:rtype: list[Site] | O365/sharepoint.py | def search_site(self, keyword):
""" Search a sharepoint host for sites with the provided keyword
:param keyword: a keyword to search sites
:rtype: list[Site]
"""
if not keyword:
raise ValueError('Must provide a valid keyword')
url = self.build_url(
... | def search_site(self, keyword):
""" Search a sharepoint host for sites with the provided keyword
:param keyword: a keyword to search sites
:rtype: list[Site]
"""
if not keyword:
raise ValueError('Must provide a valid keyword')
url = self.build_url(
... | [
"Search",
"a",
"sharepoint",
"host",
"for",
"sites",
"with",
"the",
"provided",
"keyword"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L518-L539 | [
"def",
"search_site",
"(",
"self",
",",
"keyword",
")",
":",
"if",
"not",
"keyword",
":",
"raise",
"ValueError",
"(",
"'Must provide a valid keyword'",
")",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'search'",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Sharepoint.get_site | Returns a sharepoint site
:param args: It accepts multiple ways of retrieving a site:
get_site(host_name): the host_name: host_name ej.
'contoso.sharepoint.com' or 'root'
get_site(site_id): the site_id: a comma separated string of
(host_name, site_collection_id, site_id)
... | O365/sharepoint.py | def get_site(self, *args):
""" Returns a sharepoint site
:param args: It accepts multiple ways of retrieving a site:
get_site(host_name): the host_name: host_name ej.
'contoso.sharepoint.com' or 'root'
get_site(site_id): the site_id: a comma separated string of
(ho... | def get_site(self, *args):
""" Returns a sharepoint site
:param args: It accepts multiple ways of retrieving a site:
get_site(host_name): the host_name: host_name ej.
'contoso.sharepoint.com' or 'root'
get_site(site_id): the site_id: a comma separated string of
(ho... | [
"Returns",
"a",
"sharepoint",
"site"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/sharepoint.py#L548-L588 | [
"def",
"get_site",
"(",
"self",
",",
"*",
"args",
")",
":",
"num_args",
"=",
"len",
"(",
"args",
")",
"if",
"num_args",
"==",
"1",
":",
"site",
"=",
"args",
"[",
"0",
"]",
"elif",
"num_args",
"==",
"2",
":",
"host_name",
",",
"path_to_site",
"=",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.get_folders | Returns a list of child folders matching the query
:param int limit: max no. of folders to get. Over 999 uses batch.
:param query: applies a filter to the request such as
"displayName eq 'HelloFolder'"
:type query: Query or str
:param order_by: orders the result set based on th... | O365/mailbox.py | def get_folders(self, limit=None, *, query=None, order_by=None, batch=None):
""" Returns a list of child folders matching the query
:param int limit: max no. of folders to get. Over 999 uses batch.
:param query: applies a filter to the request such as
"displayName eq 'HelloFolder'"
... | def get_folders(self, limit=None, *, query=None, order_by=None, batch=None):
""" Returns a list of child folders matching the query
:param int limit: max no. of folders to get. Over 999 uses batch.
:param query: applies a filter to the request such as
"displayName eq 'HelloFolder'"
... | [
"Returns",
"a",
"list",
"of",
"child",
"folders",
"matching",
"the",
"query"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L82-L132 | [
"def",
"get_folders",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"*",
",",
"query",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"batch",
"=",
"None",
")",
":",
"if",
"self",
".",
"root",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.get_message | Get one message from the query result.
A shortcut to get_messages with limit=1
:param object_id: the message id to be retrieved.
:param query: applies a filter to the request such as
"displayName eq 'HelloFolder'"
:type query: Query or str
:param bool download_attachmen... | O365/mailbox.py | def get_message(self, object_id=None, query=None, *, download_attachments=False):
""" Get one message from the query result.
A shortcut to get_messages with limit=1
:param object_id: the message id to be retrieved.
:param query: applies a filter to the request such as
"displayN... | def get_message(self, object_id=None, query=None, *, download_attachments=False):
""" Get one message from the query result.
A shortcut to get_messages with limit=1
:param object_id: the message id to be retrieved.
:param query: applies a filter to the request such as
"displayN... | [
"Get",
"one",
"message",
"from",
"the",
"query",
"result",
".",
"A",
"shortcut",
"to",
"get_messages",
"with",
"limit",
"=",
"1",
":",
"param",
"object_id",
":",
"the",
"message",
"id",
"to",
"be",
"retrieved",
".",
":",
"param",
"query",
":",
"applies",... | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L134-L164 | [
"def",
"get_message",
"(",
"self",
",",
"object_id",
"=",
"None",
",",
"query",
"=",
"None",
",",
"*",
",",
"download_attachments",
"=",
"False",
")",
":",
"if",
"object_id",
"is",
"not",
"None",
"and",
"query",
"is",
"not",
"None",
":",
"raise",
"Valu... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.get_messages | Downloads messages from this folder
:param int limit: limits the result set. Over 999 uses batch.
:param query: applies a filter to the request such as
"displayName eq 'HelloFolder'"
:type query: Query or str
:param order_by: orders the result set based on this condition
... | O365/mailbox.py | def get_messages(self, limit=25, *, query=None, order_by=None, batch=None,
download_attachments=False):
"""
Downloads messages from this folder
:param int limit: limits the result set. Over 999 uses batch.
:param query: applies a filter to the request such as
... | def get_messages(self, limit=25, *, query=None, order_by=None, batch=None,
download_attachments=False):
"""
Downloads messages from this folder
:param int limit: limits the result set. Over 999 uses batch.
:param query: applies a filter to the request such as
... | [
"Downloads",
"messages",
"from",
"this",
"folder"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L166-L224 | [
"def",
"get_messages",
"(",
"self",
",",
"limit",
"=",
"25",
",",
"*",
",",
"query",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"batch",
"=",
"None",
",",
"download_attachments",
"=",
"False",
")",
":",
"if",
"self",
".",
"root",
":",
"url",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.get_folder | Get a folder by it's id or name
:param str folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param str folder_name: the folder name to be retrieved.
Must be a child of this folder.
:return: a single folder
:rtype: mailbox.Folder or None | O365/mailbox.py | def get_folder(self, *, folder_id=None, folder_name=None):
""" Get a folder by it's id or name
:param str folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param str folder_name: the folder name to be retrieved.
Must be a child of this folder.
... | def get_folder(self, *, folder_id=None, folder_name=None):
""" Get a folder by it's id or name
:param str folder_id: the folder_id to be retrieved.
Can be any folder Id (child or not)
:param str folder_name: the folder name to be retrieved.
Must be a child of this folder.
... | [
"Get",
"a",
"folder",
"by",
"it",
"s",
"id",
"or",
"name"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L253-L302 | [
"def",
"get_folder",
"(",
"self",
",",
"*",
",",
"folder_id",
"=",
"None",
",",
"folder_name",
"=",
"None",
")",
":",
"if",
"folder_id",
"and",
"folder_name",
":",
"raise",
"RuntimeError",
"(",
"'Provide only one of the options'",
")",
"if",
"not",
"folder_id"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.refresh_folder | Re-download folder data
Inbox Folder will be unable to download its own data (no folder_id)
:param bool update_parent_if_changed: updates self.parent with new
parent Folder if changed
:return: Refreshed or Not
:rtype: bool | O365/mailbox.py | def refresh_folder(self, update_parent_if_changed=False):
""" Re-download folder data
Inbox Folder will be unable to download its own data (no folder_id)
:param bool update_parent_if_changed: updates self.parent with new
parent Folder if changed
:return: Refreshed or Not
... | def refresh_folder(self, update_parent_if_changed=False):
""" Re-download folder data
Inbox Folder will be unable to download its own data (no folder_id)
:param bool update_parent_if_changed: updates self.parent with new
parent Folder if changed
:return: Refreshed or Not
... | [
"Re",
"-",
"download",
"folder",
"data",
"Inbox",
"Folder",
"will",
"be",
"unable",
"to",
"download",
"its",
"own",
"data",
"(",
"no",
"folder_id",
")"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L304-L332 | [
"def",
"refresh_folder",
"(",
"self",
",",
"update_parent_if_changed",
"=",
"False",
")",
":",
"folder_id",
"=",
"getattr",
"(",
"self",
",",
"'folder_id'",
",",
"None",
")",
"if",
"self",
".",
"root",
"or",
"folder_id",
"is",
"None",
":",
"return",
"False... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.get_parent_folder | Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None | O365/mailbox.py | def get_parent_folder(self):
""" Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None
"""
if self.root:
return None
if self.parent:
return self.parent
... | def get_parent_folder(self):
""" Get the parent folder from attribute self.parent or
getting it from the cloud
:return: Parent Folder
:rtype: mailbox.Folder or None
"""
if self.root:
return None
if self.parent:
return self.parent
... | [
"Get",
"the",
"parent",
"folder",
"from",
"attribute",
"self",
".",
"parent",
"or",
"getting",
"it",
"from",
"the",
"cloud"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L334-L348 | [
"def",
"get_parent_folder",
"(",
"self",
")",
":",
"if",
"self",
".",
"root",
":",
"return",
"None",
"if",
"self",
".",
"parent",
":",
"return",
"self",
".",
"parent",
"if",
"self",
".",
"parent_id",
":",
"self",
".",
"parent",
"=",
"self",
".",
"get... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.update_folder_name | Change this folder name
:param str name: new name to change to
:param bool update_folder_data: whether or not to re-fetch the data
:return: Updated or Not
:rtype: bool | O365/mailbox.py | def update_folder_name(self, name, update_folder_data=True):
""" Change this folder name
:param str name: new name to change to
:param bool update_folder_data: whether or not to re-fetch the data
:return: Updated or Not
:rtype: bool
"""
if self.root:
... | def update_folder_name(self, name, update_folder_data=True):
""" Change this folder name
:param str name: new name to change to
:param bool update_folder_data: whether or not to re-fetch the data
:return: Updated or Not
:rtype: bool
"""
if self.root:
... | [
"Change",
"this",
"folder",
"name"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L350-L383 | [
"def",
"update_folder_name",
"(",
"self",
",",
"name",
",",
"update_folder_data",
"=",
"True",
")",
":",
"if",
"self",
".",
"root",
":",
"return",
"False",
"if",
"not",
"name",
":",
"return",
"False",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.copy_folder | Copy this folder and it's contents to into another folder
:param to_folder: the destination Folder/folder_id to copy into
:type to_folder: mailbox.Folder or str
:return: The new folder after copying
:rtype: mailbox.Folder or None | O365/mailbox.py | def copy_folder(self, to_folder):
""" Copy this folder and it's contents to into another folder
:param to_folder: the destination Folder/folder_id to copy into
:type to_folder: mailbox.Folder or str
:return: The new folder after copying
:rtype: mailbox.Folder or None
"""... | def copy_folder(self, to_folder):
""" Copy this folder and it's contents to into another folder
:param to_folder: the destination Folder/folder_id to copy into
:type to_folder: mailbox.Folder or str
:return: The new folder after copying
:rtype: mailbox.Folder or None
"""... | [
"Copy",
"this",
"folder",
"and",
"it",
"s",
"contents",
"to",
"into",
"another",
"folder"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L405-L432 | [
"def",
"copy_folder",
"(",
"self",
",",
"to_folder",
")",
":",
"to_folder_id",
"=",
"to_folder",
".",
"folder_id",
"if",
"isinstance",
"(",
"to_folder",
",",
"Folder",
")",
"else",
"to_folder",
"if",
"self",
".",
"root",
"or",
"not",
"self",
".",
"folder_i... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.move_folder | Move this folder to another folder
:param to_folder: the destination Folder/folder_id to move into
:type to_folder: mailbox.Folder or str
:param bool update_parent_if_changed: updates self.parent with the
new parent Folder if changed
:return: The new folder after copying
... | O365/mailbox.py | def move_folder(self, to_folder, *, update_parent_if_changed=True):
""" Move this folder to another folder
:param to_folder: the destination Folder/folder_id to move into
:type to_folder: mailbox.Folder or str
:param bool update_parent_if_changed: updates self.parent with the
n... | def move_folder(self, to_folder, *, update_parent_if_changed=True):
""" Move this folder to another folder
:param to_folder: the destination Folder/folder_id to move into
:type to_folder: mailbox.Folder or str
:param bool update_parent_if_changed: updates self.parent with the
n... | [
"Move",
"this",
"folder",
"to",
"another",
"folder"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L434-L468 | [
"def",
"move_folder",
"(",
"self",
",",
"to_folder",
",",
"*",
",",
"update_parent_if_changed",
"=",
"True",
")",
":",
"to_folder_id",
"=",
"to_folder",
".",
"folder_id",
"if",
"isinstance",
"(",
"to_folder",
",",
"Folder",
")",
"else",
"to_folder",
"if",
"s... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.new_message | Creates a new draft message under this folder
:return: new Message
:rtype: Message | O365/mailbox.py | def new_message(self):
""" Creates a new draft message under this folder
:return: new Message
:rtype: Message
"""
draft_message = self.message_constructor(parent=self, is_draft=True)
if self.root:
draft_message.folder_id = OutlookWellKnowFolderNames.DRAFTS.... | def new_message(self):
""" Creates a new draft message under this folder
:return: new Message
:rtype: Message
"""
draft_message = self.message_constructor(parent=self, is_draft=True)
if self.root:
draft_message.folder_id = OutlookWellKnowFolderNames.DRAFTS.... | [
"Creates",
"a",
"new",
"draft",
"message",
"under",
"this",
"folder"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L470-L484 | [
"def",
"new_message",
"(",
"self",
")",
":",
"draft_message",
"=",
"self",
".",
"message_constructor",
"(",
"parent",
"=",
"self",
",",
"is_draft",
"=",
"True",
")",
"if",
"self",
".",
"root",
":",
"draft_message",
".",
"folder_id",
"=",
"OutlookWellKnowFold... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Folder.delete_message | Deletes a stored message
:param message: message/message_id to delete
:type message: Message or str
:return: Success / Failure
:rtype: bool | O365/mailbox.py | def delete_message(self, message):
""" Deletes a stored message
:param message: message/message_id to delete
:type message: Message or str
:return: Success / Failure
:rtype: bool
"""
message_id = message.object_id if isinstance(message,
... | def delete_message(self, message):
""" Deletes a stored message
:param message: message/message_id to delete
:type message: Message or str
:return: Success / Failure
:rtype: bool
"""
message_id = message.object_id if isinstance(message,
... | [
"Deletes",
"a",
"stored",
"message"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L486-L506 | [
"def",
"delete_message",
"(",
"self",
",",
"message",
")",
":",
"message_id",
"=",
"message",
".",
"object_id",
"if",
"isinstance",
"(",
"message",
",",
"Message",
")",
"else",
"message",
"if",
"message_id",
"is",
"None",
":",
"raise",
"RuntimeError",
"(",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.inbox_folder | Shortcut to get Inbox Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def inbox_folder(self):
""" Shortcut to get Inbox Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Inbox',
folder_id=OutlookWellKnowFolderNames
.INBOX.value) | def inbox_folder(self):
""" Shortcut to get Inbox Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Inbox',
folder_id=OutlookWellKnowFolderNames
.INBOX.value) | [
"Shortcut",
"to",
"get",
"Inbox",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L515-L522 | [
"def",
"inbox_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'Inbox'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"INBOX",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.junk_folder | Shortcut to get Junk Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def junk_folder(self):
""" Shortcut to get Junk Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Junk',
folder_id=OutlookWellKnowFolderNames
.JUNK.value) | def junk_folder(self):
""" Shortcut to get Junk Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Junk',
folder_id=OutlookWellKnowFolderNames
.JUNK.value) | [
"Shortcut",
"to",
"get",
"Junk",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L524-L531 | [
"def",
"junk_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'Junk'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"JUNK",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.deleted_folder | Shortcut to get DeletedItems Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def deleted_folder(self):
""" Shortcut to get DeletedItems Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='DeletedItems',
folder_id=OutlookWellKnowFolderNames
.DELE... | def deleted_folder(self):
""" Shortcut to get DeletedItems Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='DeletedItems',
folder_id=OutlookWellKnowFolderNames
.DELE... | [
"Shortcut",
"to",
"get",
"DeletedItems",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L533-L540 | [
"def",
"deleted_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'DeletedItems'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"DELETED",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.drafts_folder | Shortcut to get Drafts Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def drafts_folder(self):
""" Shortcut to get Drafts Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Drafts',
folder_id=OutlookWellKnowFolderNames
.DRAFTS.value) | def drafts_folder(self):
""" Shortcut to get Drafts Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Drafts',
folder_id=OutlookWellKnowFolderNames
.DRAFTS.value) | [
"Shortcut",
"to",
"get",
"Drafts",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L542-L549 | [
"def",
"drafts_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'Drafts'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"DRAFTS",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.sent_folder | Shortcut to get SentItems Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def sent_folder(self):
""" Shortcut to get SentItems Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='SentItems',
folder_id=OutlookWellKnowFolderNames
.SENT.value) | def sent_folder(self):
""" Shortcut to get SentItems Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='SentItems',
folder_id=OutlookWellKnowFolderNames
.SENT.value) | [
"Shortcut",
"to",
"get",
"SentItems",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L551-L558 | [
"def",
"sent_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'SentItems'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"SENT",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | MailBox.outbox_folder | Shortcut to get Outbox Folder instance
:rtype: mailbox.Folder | O365/mailbox.py | def outbox_folder(self):
""" Shortcut to get Outbox Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Outbox',
folder_id=OutlookWellKnowFolderNames
.OUTBOX.value) | def outbox_folder(self):
""" Shortcut to get Outbox Folder instance
:rtype: mailbox.Folder
"""
return self.folder_constructor(parent=self, name='Outbox',
folder_id=OutlookWellKnowFolderNames
.OUTBOX.value) | [
"Shortcut",
"to",
"get",
"Outbox",
"Folder",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/mailbox.py#L560-L567 | [
"def",
"outbox_folder",
"(",
"self",
")",
":",
"return",
"self",
".",
"folder_constructor",
"(",
"parent",
"=",
"self",
",",
"name",
"=",
"'Outbox'",
",",
"folder_id",
"=",
"OutlookWellKnowFolderNames",
".",
"OUTBOX",
".",
"value",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | WorkbookSession.create_session | Request a new session id | O365/excel.py | def create_session(self):
""" Request a new session id """
url = self.build_url(self._endpoints.get('create_session'))
response = self.con.post(url, data={'persistChanges': self.persist})
if not response:
raise RuntimeError('Could not create session as requested by the user.... | def create_session(self):
""" Request a new session id """
url = self.build_url(self._endpoints.get('create_session'))
response = self.con.post(url, data={'persistChanges': self.persist})
if not response:
raise RuntimeError('Could not create session as requested by the user.... | [
"Request",
"a",
"new",
"session",
"id"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L81-L91 | [
"def",
"create_session",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'create_session'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"post",
"(",
"url",
",",
"data",
"=",
"{",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | WorkbookSession.close_session | Close the current session | O365/excel.py | def close_session(self):
""" Close the current session """
if self.session_id:
url = self.build_url(self._endpoints.get('close_session'))
response = self.con.post(url, headers={'workbook-session-id': self.session_id})
return bool(response)
return False | def close_session(self):
""" Close the current session """
if self.session_id:
url = self.build_url(self._endpoints.get('close_session'))
response = self.con.post(url, headers={'workbook-session-id': self.session_id})
return bool(response)
return False | [
"Close",
"the",
"current",
"session"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L102-L109 | [
"def",
"close_session",
"(",
"self",
")",
":",
"if",
"self",
".",
"session_id",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'close_session'",
")",
")",
"response",
"=",
"self",
".",
"con",
".",
"post",
... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | WorkbookSession.prepare_request | If session is in use, prepares the request headers and
checks if the session is expired. | O365/excel.py | def prepare_request(self, kwargs):
""" If session is in use, prepares the request headers and
checks if the session is expired.
"""
if self.session_id is not None:
actual = dt.datetime.now()
if (self.last_activity + self.inactivity_limit) < actual:
... | def prepare_request(self, kwargs):
""" If session is in use, prepares the request headers and
checks if the session is expired.
"""
if self.session_id is not None:
actual = dt.datetime.now()
if (self.last_activity + self.inactivity_limit) < actual:
... | [
"If",
"session",
"is",
"in",
"use",
"prepares",
"the",
"request",
"headers",
"and",
"checks",
"if",
"the",
"session",
"is",
"expired",
"."
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L111-L134 | [
"def",
"prepare_request",
"(",
"self",
",",
"kwargs",
")",
":",
"if",
"self",
".",
"session_id",
"is",
"not",
"None",
":",
"actual",
"=",
"dt",
".",
"datetime",
".",
"now",
"(",
")",
"if",
"(",
"self",
".",
"last_activity",
"+",
"self",
".",
"inactiv... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormatFont._load_data | Loads the data into this instance | O365/excel.py | def _load_data(self):
""" Loads the data into this instance """
url = self.parent.build_url(self.parent._endpoints.get('format'))
response = self.parent.session.get(url)
if not response:
return False
data = response.json()
self._bold = data.get('bold', False)... | def _load_data(self):
""" Loads the data into this instance """
url = self.parent.build_url(self.parent._endpoints.get('format'))
response = self.parent.session.get(url)
if not response:
return False
data = response.json()
self._bold = data.get('bold', False)... | [
"Loads",
"the",
"data",
"into",
"this",
"instance"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L172-L188 | [
"def",
"_load_data",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"parent",
".",
"build_url",
"(",
"self",
".",
"parent",
".",
"_endpoints",
".",
"get",
"(",
"'format'",
")",
")",
"response",
"=",
"self",
".",
"parent",
".",
"session",
".",
"get",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormatFont.to_api_data | Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict | O365/excel.py | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self.parent._cc # alias
data = {
cc('bold'): self._bold,
cc('c... | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self.parent._cc # alias
data = {
cc('bold'): self._bold,
cc('c... | [
"Returns",
"a",
"dict",
"to",
"communicate",
"with",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L190-L210 | [
"def",
"to_api_data",
"(",
"self",
",",
"restrict_keys",
"=",
"None",
")",
":",
"cc",
"=",
"self",
".",
"parent",
".",
"_cc",
"# alias",
"data",
"=",
"{",
"cc",
"(",
"'bold'",
")",
":",
"self",
".",
"_bold",
",",
"cc",
"(",
"'color'",
")",
":",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormat.to_api_data | Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict | O365/excel.py | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self._cc # alias
data = {
cc('column_width'): self._column_width,
... | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self._cc # alias
data = {
cc('column_width'): self._column_width,
... | [
"Returns",
"a",
"dict",
"to",
"communicate",
"with",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L374-L393 | [
"def",
"to_api_data",
"(",
"self",
",",
"restrict_keys",
"=",
"None",
")",
":",
"cc",
"=",
"self",
".",
"_cc",
"# alias",
"data",
"=",
"{",
"cc",
"(",
"'column_width'",
")",
":",
"self",
".",
"_column_width",
",",
"cc",
"(",
"'horizontal_alignment'",
")"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormat.update | Updates this range format | O365/excel.py | def update(self):
""" Updates this range format """
if self._track_changes:
data = self.to_api_data(restrict_keys=self._track_changes)
if data:
response = self.session.patch(self.build_url(''), data=data)
if not response:
return... | def update(self):
""" Updates this range format """
if self._track_changes:
data = self.to_api_data(restrict_keys=self._track_changes)
if data:
response = self.session.patch(self.build_url(''), data=data)
if not response:
return... | [
"Updates",
"this",
"range",
"format"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L395-L423 | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"self",
".",
"_track_changes",
":",
"data",
"=",
"self",
".",
"to_api_data",
"(",
"restrict_keys",
"=",
"self",
".",
"_track_changes",
")",
"if",
"data",
":",
"response",
"=",
"self",
".",
"session",
".",
"... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormat._load_background_color | Loads the data related to the fill color | O365/excel.py | def _load_background_color(self):
""" Loads the data related to the fill color """
url = self.build_url(self._endpoints.get('fill'))
response = self.session.get(url)
if not response:
return None
data = response.json()
self._background_color = data.get('color',... | def _load_background_color(self):
""" Loads the data related to the fill color """
url = self.build_url(self._endpoints.get('fill'))
response = self.session.get(url)
if not response:
return None
data = response.json()
self._background_color = data.get('color',... | [
"Loads",
"the",
"data",
"related",
"to",
"the",
"fill",
"color"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L440-L447 | [
"def",
"_load_background_color",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'fill'",
")",
")",
"response",
"=",
"self",
".",
"session",
".",
"get",
"(",
"url",
")",
"if",
"not",
"res... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | RangeFormat.auto_fit_columns | Changes the width of the columns of the current range
to achieve the best fit, based on the current data in the columns | O365/excel.py | def auto_fit_columns(self):
""" Changes the width of the columns of the current range
to achieve the best fit, based on the current data in the columns
"""
url = self.build_url(self._endpoints.get('auto_fit_columns'))
return bool(self.session.post(url)) | def auto_fit_columns(self):
""" Changes the width of the columns of the current range
to achieve the best fit, based on the current data in the columns
"""
url = self.build_url(self._endpoints.get('auto_fit_columns'))
return bool(self.session.post(url)) | [
"Changes",
"the",
"width",
"of",
"the",
"columns",
"of",
"the",
"current",
"range",
"to",
"achieve",
"the",
"best",
"fit",
"based",
"on",
"the",
"current",
"data",
"in",
"the",
"columns"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L449-L454 | [
"def",
"auto_fit_columns",
"(",
"self",
")",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"'auto_fit_columns'",
")",
")",
"return",
"bool",
"(",
"self",
".",
"session",
".",
"post",
"(",
"url",
")",
")"
] | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Range.to_api_data | Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict | O365/excel.py | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self._cc # alias
data = {
cc('column_hidden'): self._column_hidden,
... | def to_api_data(self, restrict_keys=None):
""" Returns a dict to communicate with the server
:param restrict_keys: a set of keys to restrict the returned data to
:rtype: dict
"""
cc = self._cc # alias
data = {
cc('column_hidden'): self._column_hidden,
... | [
"Returns",
"a",
"dict",
"to",
"communicate",
"with",
"the",
"server"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L615-L636 | [
"def",
"to_api_data",
"(",
"self",
",",
"restrict_keys",
"=",
"None",
")",
":",
"cc",
"=",
"self",
".",
"_cc",
"# alias",
"data",
"=",
"{",
"cc",
"(",
"'column_hidden'",
")",
":",
"self",
".",
"_column_hidden",
",",
"cc",
"(",
"'row_hidden'",
")",
":",... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
train | Range._get_range | Helper that returns another range | O365/excel.py | def _get_range(self, endpoint, *args, method='GET', **kwargs):
""" Helper that returns another range"""
if args:
url = self.build_url(self._endpoints.get(endpoint).format(*args))
else:
url = self.build_url(self._endpoints.get(endpoint))
if not kwargs:
... | def _get_range(self, endpoint, *args, method='GET', **kwargs):
""" Helper that returns another range"""
if args:
url = self.build_url(self._endpoints.get(endpoint).format(*args))
else:
url = self.build_url(self._endpoints.get(endpoint))
if not kwargs:
... | [
"Helper",
"that",
"returns",
"another",
"range"
] | O365/python-o365 | python | https://github.com/O365/python-o365/blob/02a71cf3775cc6a3c042e003365d6a07c8c75a73/O365/excel.py#L638-L652 | [
"def",
"_get_range",
"(",
"self",
",",
"endpoint",
",",
"*",
"args",
",",
"method",
"=",
"'GET'",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"args",
":",
"url",
"=",
"self",
".",
"build_url",
"(",
"self",
".",
"_endpoints",
".",
"get",
"(",
"endpoint... | 02a71cf3775cc6a3c042e003365d6a07c8c75a73 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.