index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
47,163
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/utils/json_utils_test.py
29,34
27,41
test_dump_and_recover
JsonUtilsTest
34,41
34,41
class JsonUtilsTest(parameterized.TestCase): @parameterized.parameters( dict(shape=[3, 0]), dict(shape=[3, 5]), ) def test_dump_and_recover(self, shape): FILL_FUNC_BODY
class JsonUtilsTest(parameterized.TestCase): @parameterized.parameters( dict(shape=[3, 0]), dict(shape=[3, 5]), ) def test_dump_and_recover(self, shape): FILL_FUNC_BODY
original = {'a': np.zeros(shape), 'b': 3} dumped = json.dumps(original, cls=json_utils.NumpyEncoder) loaded = json.loads(dumped, cls=json_utils.NumpyDecoder) np.testing.assert_array_equal(original['a'], loaded['a']) self.assertEqual(original['b'], loaded['b'])
original = {'a': np.zeros(shape), 'b': 3} dumped = json.dumps(original, cls=json_utils.NumpyEncoder) loaded = json.loads(dumped, cls=json_utils.NumpyDecoder) np.testing.assert_array_equal(original['a'], loaded['a']) self.assertEqual(original['b'], loaded['b'])
18
75
113
188
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,164
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/admin_sdk/directory/quickstart.py
27,28
1,72
main
31,69
28,69
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Admin SDK Directory API. Prints the emails and names of the first 10 users in the domain. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path....
134
348
443
791
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,165
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/admin_sdk/reports/quickstart.py
27,28
1,78
main
31,75
28,75
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Admin SDK Reports API. Prints the time, email, and name of the last 10 login events in the domain. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if...
137
360
481
841
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,166
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/admin_sdk/reseller/quickstart.py
27,28
1,73
main
31,70
28,70
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Calls the Admin SDK Reseller API. Prints the customer ID, SKU ID, and plan name of the first 10 subscriptions managed by the domain. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # t...
130
355
448
803
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,167
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/apps_script/execute/execute.py
23,24
1,73
main
25,70
24,70
""" Copyright Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
# pylint: disable=maybe-no-member script_id = "1VFBDoJFy6yb9z7-luOwRv3fCmeNOzILPnR4QVmR0bGJ7gQ3QMPpCW-yt" creds, _ = google.auth.default() service = build("script", "v1", credentials=creds) # Create an execution request object. request = {"function": "getFoldersUnderRoot"} try: # Make the API reque...
"""Runs the sample.""" # pylint: disable=maybe-no-member script_id = "1VFBDoJFy6yb9z7-luOwRv3fCmeNOzILPnR4QVmR0bGJ7gQ3QMPpCW-yt" creds, _ = google.auth.default() service = build("script", "v1", credentials=creds) # Create an execution request object. request = {"function": "getFoldersUnderRoot"} try:...
200
235
604
839
""" Copyright Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright Google Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,168
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/apps_script/quickstart/quickstart.py
46,47
1,100
main
48,97
47,97
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Calls the Apps Script API.""" creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES)...
162
458
538
996
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,169
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/calendar/quickstart/quickstart.py
29,30
1,87
main
33,84
30,84
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Google Calendar API. Prints the start and name of the next 10 events on the user's calendar. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.pa...
165
353
544
897
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,170
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/quickstart/quickstart.py
28,29
1,73
main
32,70
29,70
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Classroom API. Prints the names of the first 10 courses the user has access to. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("to...
133
352
428
780
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,171
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/base_test.py
28,30
26,63
setUpClass
BaseTest
30,37
30,37
class BaseTest(unittest.TestCase): @classmethod def setUpClass(cls): FILL_FUNC_BODY @classmethod def tearDownClass(cls): # Restore STDOUT. sys.stdout = cls.stdout @classmethod def create_credentials(cls): cls.credentials = GoogleCredentials.get_application_default() scope = ["https://www.go...
class BaseTest(unittest.TestCase): @classmethod def setUpClass(cls): FILL_FUNC_BODY @classmethod def tearDownClass(cls): # Restore STDOUT. sys.stdout = cls.stdout @classmethod def create_credentials(cls): cls.credentials = GoogleCredentials.get_application_default() scope = ["https://www.go...
cls.credentials = cls.create_credentials() http = cls.credentials.authorize(httplib2.Http()) cls.credentials.refresh(http) cls.service = build("classroom", "v1", http=http) cls.stdout = sys.stdout sys.stdout = None
cls.credentials = cls.create_credentials() http = cls.credentials.authorize(httplib2.Http()) cls.credentials.refresh(http) cls.service = build("classroom", "v1", http=http) cls.stdout = sys.stdout sys.stdout = None
18
294
97
391
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,172
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_add_alias_existing.py
22,23
1,55
classroom_add_alias_existing
29,50
23,50
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member # [START classroom_existing_alias] service = build("classroom", "v1", credentials=creds) alias = "d:school_math_101" course_alias = {"alias": alias} try: course_alias = ( service.courses() .aliases() .create(cou...
""" Adds alias to existing course with specific course_id. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member...
50
344
213
557
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,173
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_add_alias_new.py
29,30
1,82
classroom_add_alias_new
39,76
30,76
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
# pylint: disable=maybe-no-member creds = None if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token:...
""" Creates a course with alias specification the user has access to. The file token.json stores the user's access and refresh tokens, and is created automatically when the authorization flow completes for the first time. Load pre-authorized user credentials from the environment. TODO(developer) - See htt...
105
441
420
861
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,174
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_add_attachment.py
23,24
1,59
classroom_add_attachment
30,54
24,54
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member request = { "addAttachments": [ {"link": {"url": "http://example.com/quiz-results"}}, {"link": {"url": "http://example.com/quiz-reading"}}, ] } try: service = build("classroom", "v1", credentials=creds) ...
""" Adds attachment to existing course with specific course_id. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-m...
45
360
236
596
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,175
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_add_student.py
27,28
1,84
classroom_add_student_new
37,80
28,80
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) crede...
""" Adds a student to a course, the teacher has access to. The file token.json stores the user's access and refresh tokens, and is created automatically when the authorization flow completes for the first time. Load pre-authorized user credentials from the environment. TODO(developer) - See https://develo...
138
446
485
931
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,176
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_add_teacher.py
21,22
1,52
classroom_add_teacher
28,48
22,48
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member service = build("classroom", "v1", credentials=creds) teacher_email = "gduser1@workspacesamples.dev" teacher = {"userId": teacher_email} try: teachers = service.courses().teachers() teacher = teachers.create(courseId=course_id, bod...
""" Adds a teacher to a course with specific course_id. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member ...
64
338
226
564
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,177
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_all_submissions.py
23,24
1,76
classroom_all_submissions
30,71
24,71
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member submissions = [] page_token = None try: service = build("classroom", "v1", credentials=creds) while True: coursework = service.courses().courseWork() response = ( coursework.studentSubmissions() .list(...
""" Creates the list of all submissions of the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: di...
84
368
353
721
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,178
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_create_course.py
23,24
1,62
classroom_create_course
30,58
24,58
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("classroom", "v1", credentials=creds) course = { "name": "10th Grade Mathematics Probability-2", "section": "Period 3", "descriptionHeading": "Welcome to 10th Grade Mathematics", "desc...
""" Creates the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: ...
79
299
298
597
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,179
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_create_coursework.py
23,24
1,66
classroom_create_coursework
30,61
24,61
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("classroom", "v1", credentials=creds) coursework = { "title": "Ant colonies", "description": """Read the article about ant colonies and complete the quiz.""", "ma...
""" Creates the coursework the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member try...
70
347
298
645
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,180
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_get_course.py
23,24
1,50
classroom_get_course
30,45
24,45
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member course = None try: service = build("classroom", "v1", credentials=creds) course = service.courses().get(id=course_id).execute() print(f"Course found : {course.get('name')}") except HttpError as error: print(f"An error occurred...
""" Prints the name of the with specific course_id. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member cou...
39
329
158
487
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,181
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_invite_guardian.py
23,24
1,60
classroom_invite_guardian
30,55
24,55
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member guardian_invitation = { "invitedEmailAddress": "guardian@gmail.com", } try: service = build("classroom", "v1", credentials=creds) while True: guardian_invitations = service.userProfiles().guardianInvitations() guard...
""" Creates the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member guardia...
58
335
246
581
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,182
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_list_course_aliases.py
23,24
1,65
classroom_list_course_aliases
30,61
24,61
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: service = build("classroom", "v1", credentials=creds) course_aliases = [] page_token = None while True: response = ( service.courses() .aliases() .list(pageToken=page_token, courseId=course_id) .execute() ) ...
""" Prints the list of the aliases of a specified course the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: s...
63
327
274
601
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,183
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_list_courses.py
23,24
1,64
classroom_list_courses
30,59
24,59
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: service = build("classroom", "v1", credentials=creds) courses = [] page_token = None while True: # pylint: disable=maybe-no-member response = ( service.courses().list(pageToken=page_token, pageSize=100).execute() ) courses.ext...
""" Prints the list of the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: service = build("classr...
63
321
261
582
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,184
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_list_student_submissions.py
23,24
1,75
classroom_list_student_submissions
30,70
24,70
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member submissions = [] page_token = None try: service = build("classroom", "v1", credentials=creds) while True: coursework = service.courses().courseWork() response = ( coursework.studentSubmissions() .list(...
""" Creates the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member submiss...
75
386
339
725
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,185
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_list_submissions.py
23,24
1,76
classroom_list_submissions
30,71
24,71
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member submissions = [] page_token = None try: service = build("classroom", "v1", credentials=creds) while True: coursework = service.courses().courseWork() response = ( coursework.studentSubmissions() .list(...
""" Creates the courses the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member submiss...
78
363
345
708
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,186
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_patch_course.py
22,23
1,53
classroom_patch_course
29,47
23,47
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
# pylint: disable=maybe-no-member creds, _ = google.auth.default() try: service = build("classroom", "v1", credentials=creds) course = {"section": "Period 3", "room": "313"} course = ( service.courses() .patch(id=course_id, updateMask="section,room", body=course) .execute() ...
""" Patch new course with existing course in the account the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ # pylint: disable=maybe-no-member creds, _ ...
44
335
180
515
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,187
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/classroom_update_course.py
23,24
1,56
classroom_update_course
30,51
24,51
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
# pylint: disable=maybe-no-member creds, _ = google.auth.default() try: service = build("classroom", "v1", credentials=creds) # Updates the section and room of Google Classroom. course = service.courses().get(id=course_id).execute() course["name"] = "10th Grade Physics - Light" course["sect...
""" Updates the courses names the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ # pylint: disable=maybe-no-member creds, _ = google.auth.default() ...
60
325
227
552
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,188
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_create_course.py
23,24
20,30
test_classroom_create_course
TestClassroomCreateCourse
25,30
24,30
class TestClassroomCreateCourse(BaseTest): """Unit test class for Create course snippet""" def test_classroom_create_course(self): FILL_FUNC_BODY
class TestClassroomCreateCourse(BaseTest): """Unit test class for Create course snippet""" def test_classroom_create_course(self): """Class function for Create course snippet""" FILL_FUNC_BODY
course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id"))
"""Class function for Create course snippet""" course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id"))
5
62
54
116
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,189
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_get_course.py
24,25
21,33
test_classroom_get_course
TestClassroomGetCourse
26,33
25,33
class TestClassroomGetCourse(BaseTest): """Unit test class for Get course snippet""" def test_classroom_get_course(self): FILL_FUNC_BODY
class TestClassroomGetCourse(BaseTest): """Unit test class for Get course snippet""" def test_classroom_get_course(self): """Unit test method for Get course snippet""" FILL_FUNC_BODY
course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course_id = classroom_get_course.classroom_get_course(course.get("id")) self.assertIsNotNone(course_id)
"""Unit test method for Get course snippet""" course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course_id = classroom_get_course.classroom_get_course(course.get("id")) self.assertIsNotNone(course_id)
9
63
94
157
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,190
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_list_course_aliases.py
24,25
21,33
test_classroom_list_course_aliases
TestClassroomListCourseAliases
26,33
25,33
class TestClassroomListCourseAliases(BaseTest): """Unit test class for List course aliases snippet""" def test_classroom_list_course_aliases(self): FILL_FUNC_BODY
class TestClassroomListCourseAliases(BaseTest): """Unit test class for List course aliases snippet""" def test_classroom_list_course_aliases(self): """Unit test method for List course snippet""" FILL_FUNC_BODY
course = classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course_aliases = classroom_list_course_aliases(course.get("id")) self.assertIsNotNone(course_aliases)
"""Unit test method for List course snippet""" course = classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course_aliases = classroom_list_course_aliases(course.get("id")) self.assertIsNotNone(course_aliases)
9
70
85
155
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,191
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_list_courses.py
24,25
21,33
test_classroom_list_courses
TestClassroomListCourses
26,33
25,33
class TestClassroomListCourses(BaseTest): """Unit test class for List course snippet""" def test_classroom_list_courses(self): FILL_FUNC_BODY
class TestClassroomListCourses(BaseTest): """Unit test class for List course snippet""" def test_classroom_list_courses(self): """Unit test method for List course snippet""" FILL_FUNC_BODY
course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) courses = classroom_list_courses.classroom_list_courses() self.assertIsNotNone(courses)
"""Unit test method for List course snippet""" course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) courses = classroom_list_courses.classroom_list_courses() self.assertIsNotNone(courses)
9
66
90
156
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,192
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_patch_course.py
24,25
21,33
test_classroom_patch_course
TestClassroomPatchCourse
26,33
25,33
class TestClassroomPatchCourse(BaseTest): """Unit test class for Patch course snippet""" def test_classroom_patch_course(self): FILL_FUNC_BODY
class TestClassroomPatchCourse(BaseTest): """Unit test class for Patch course snippet""" def test_classroom_patch_course(self): """Unit test method for Patch course snippet""" FILL_FUNC_BODY
course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course = classroom_patch_course.classroom_patch_course(course.get("id")) self.assertIsNotNone(course)
"""Unit test method for Patch course snippet""" course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course = classroom_patch_course.classroom_patch_course(course.get("id")) self.assertIsNotNone(course)
9
66
90
156
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,193
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/classroom/snippets/test_classroom_update_course.py
24,25
21,33
test_classroom_update_course
TestClassroomUpdateCourse
26,33
25,33
class TestClassroomUpdateCourse(BaseTest): """Unit test class for Get course snippet""" def test_classroom_update_course(self): FILL_FUNC_BODY
class TestClassroomUpdateCourse(BaseTest): """Unit test class for Get course snippet""" def test_classroom_update_course(self): """Unit test method for Get course snippet""" FILL_FUNC_BODY
course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course = classroom_update_course.classroom_update_course(course.get("id")) self.assertIsNotNone(course)
"""Unit test method for Get course snippet""" course = classroom_create_course.classroom_create_course() self.assertIsNotNone(course) self.delete_course_on_cleanup(course.get("id")) course = classroom_update_course.classroom_update_course(course.get("id")) self.assertIsNotNone(course)
9
63
90
153
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,194
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/docs/mail-merge/docs_mail_merge.py
129,130
1,189
_copy_template
133,146
130,146
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
try: body = {"name": f"Merged form letter ({source})"} return ( service.files() .copy(body=body, fileId=tmpl_id, fields="id") .execute() .get("id") ) except HttpError as error: print(f"An error occurred: {error}") return error
"""(private) Copies letter template document using Drive API then returns file ID of (new) copy. """ try: body = {"name": f"Merged form letter ({source})"} return ( service.files() .copy(body=body, fileId=tmpl_id, fields="id") .execute() .get("id") ) except HttpErro...
27
1,911
111
2,022
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
47,195
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/docs/mail-merge/docs_mail_merge_test.py
58,59
1,91
create_doc_test
60,70
59,70
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
DRIVE = discovery.build("drive", "v3", credentials=creds) DATA = { "name": "Test Doc", "mimeType": "application/vnd.google-apps.document", } doc_id = DRIVE.files().create(body=DATA, fields="id").execute().get("id") DRIVE.files().delete(fileId=doc_id, fields="").execute() return True
"Tests whether project can create and delete a Google Docs file." DRIVE = discovery.build("drive", "v3", credentials=creds) DATA = { "name": "Test Doc", "mimeType": "application/vnd.google-apps.document", } doc_id = DRIVE.files().create(body=DATA, fields="id").execute().get("id") DRIVE.files().d...
22
775
123
898
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
47,196
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/docs/mail-merge/docs_mail_merge_test.py
49,50
34,53
test_get_sheets_data
TestDocsMailMerge
50,53
50,53
class TestDocsMailMerge(unittest.TestCase): "Unit tests for Mail Merge sample" def test_project(self): self.assertTrue(project_test()) def test_create_doc(self): self.assertTrue(create_doc_test()) def test_copy_doc(self): self.assertTrue(copy_doc_test()) def test_get_text_data(self): self....
class TestDocsMailMerge(unittest.TestCase): "Unit tests for Mail Merge sample" def test_project(self): self.assertTrue(project_test()) def test_create_doc(self): self.assertTrue(create_doc_test()) def test_copy_doc(self): self.assertTrue(copy_doc_test()) def test_get_text_data(self): self....
self.assertTrue(bool(get_sheets_data_test()))
self.assertTrue(bool(get_sheets_data_test()))
1
153
23
176
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
# -*- coding: utf-8 -*- # # Copyright ©2018-2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at apache.org/licenses/LICENSE-2.0. # # Unless required by applicable law or agreed to...
47,197
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/docs/quickstart/quickstart.py
31,32
1,68
main
35,65
32,65
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Docs API. Prints the title of a sample document. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credent...
115
397
370
767
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,198
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/activity-v2/quickstart.py
28,29
1,135
main
33,81
29,81
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Drive Activity API. Prints information about the last 10 events that occured the user's Drive. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os...
189
790
588
1,378
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,199
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/quickstart/quickstart.py
28,29
1,76
main
32,73
29,73
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Drive v3 API. Prints the names and ids of the first 10 files the user has access to. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exist...
141
353
461
814
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,200
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v2/drive_snippet/create_drive.py
25,26
1,60
create_drive
34,57
26,57
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v2", credentials=creds) drive_metadata = {"name": "Project Resources"} request_id = str(uuid.uuid4()) # pylint: disable=maybe-no-member drive = ( service.drives() .insert(body=drive_me...
"""Create a drive. Returns: Id of the created drive Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive api clie...
51
303
209
512
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,201
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v2/drive_snippet/recover_drives.py
23,24
1,94
recover_drives
34,91
24,91
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v2", credentials=creds) drives = [] page_token = None new_organizer_permission = { "type": "user", "role": "organizer", "value": "user@example.com", } new_organizer_permis...
"""Find all shared drives without an organizer and add one. Args: real_user:User ID for the new organizer. Returns: drives object Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the app...
108
352
485
837
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,202
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v2/team_drive_snippets/create_team_drive.py
24,25
1,58
create_team_drive
32,55
25,55
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v2", credentials=creds) # pylint: disable=maybe-no-member team_drive_metadata = {"name": "Project Resources"} request_id = str(uuid.uuid4()) team_drive = ( service.teamdrives() .insert(b...
"""Create a drive for team. Returns: ID of the created drive Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # call drive api cli...
52
310
222
532
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,203
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v2/team_drive_snippets/recover_team_drives.py
22,23
1,94
recover_team_drives
33,91
23,91
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v2", credentials=creds) # pylint: disable=maybe-no-member team_drives = [] page_token = None new_organizer_permission = { "type": "user", "role": "organizer", "value": "user@exa...
"""Finds all Team Drives without an organizer and add one Args: real_user:User ID for the new organizer. Returns: team drives_object. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the...
110
363
518
881
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,204
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/fetch_appdata_folder.py
22,23
1,50
fetch_appdata_folder
30,47
23,47
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member file = service.files().get(fileId="appDataFolder", fields="id").execute() print(f'Folder ID: {file.get("id")}') except HttpError as error: pr...
"""List out application data folder and prints folder ID. Returns : Folder ID Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # c...
38
311
157
468
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,205
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/list_appdata.py
22,23
1,61
list_appdata
31,58
23,58
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member response = ( service.files() .list( spaces="appDataFolder", fields="nextPageToken, files(id, name)", ...
"""List all files inserted in the application data folder prints file titles with Ids. Returns : List of items Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = go...
56
311
227
538
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,206
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/test_fetch_appdata_folder.py
24,26
21,31
test_list_appdata
TestFetchAppdataFolder
27,31
26,31
class TestFetchAppdataFolder(unittest.TestCase): """Unit test class for Appdata snippet""" @classmethod def test_list_appdata(cls): FILL_FUNC_BODY
class TestFetchAppdataFolder(unittest.TestCase): """Unit test class for Appdata snippet""" @classmethod def test_list_appdata(cls): """Test list_appdata""" FILL_FUNC_BODY
file_id = fetch_appdata_folder.fetch_appdata_folder() cls.assertIsNotNone(cls, file_id)
"""Test list_appdata""" file_id = fetch_appdata_folder.fetch_appdata_folder() cls.assertIsNotNone(cls, file_id)
5
65
42
107
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,207
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/test_list_appdata.py
24,26
21,31
test_list_appdata
TestListAppdata
27,31
26,31
class TestListAppdata(unittest.TestCase): """Unit test class for Appdata snippet""" @classmethod def test_list_appdata(cls): FILL_FUNC_BODY
class TestListAppdata(unittest.TestCase): """Unit test class for Appdata snippet""" @classmethod def test_list_appdata(cls): """Test list_appdata""" FILL_FUNC_BODY
files = list_appdata.list_appdata() cls.assertNotEqual(cls, 0, len(files))
"""Test list_appdata""" files = list_appdata.list_appdata() cls.assertNotEqual(cls, 0, len(files))
6
63
38
101
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,208
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/test_upload_appdata.py
26,28
21,35
test_upload_adddata
TestUploadAppdata
31,35
28,35
class TestUploadAppdata(unittest.TestCase): """ Unit test class for Appdata snippet """ @classmethod def test_upload_adddata(cls): FILL_FUNC_BODY
class TestUploadAppdata(unittest.TestCase): """ Unit test class for Appdata snippet """ @classmethod def test_upload_adddata(cls): """Test upload_appdata create a text file titled "abc.txt" in order to pass this test """ FILL_FUNC_BODY
file_id = upload_app_data.upload_appdata() cls.assertIsNotNone(cls, file_id)
"""Test upload_appdata create a text file titled "abc.txt" in order to pass this test """ file_id = upload_app_data.upload_appdata() cls.assertIsNotNone(cls, file_id)
5
88
39
127
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,209
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/app_data_snippet/upload_appdata.py
23,24
1,57
upload_appdata
31,54
24,54
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member file_metadata = {"name": "abc.txt", "parents": ["appDataFolder"]} media = MediaFileUpload("abc.txt", mimetype="text/txt", resumable=True) file =...
"""Insert a file in the application data folder and prints file Id. Returns : ID's of the inserted files Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.aut...
54
322
228
550
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,210
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/change_snippet/fetch_changes.py
20,21
1,65
fetch_changes
32,61
21,61
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) # Begin with our last saved start token for this user or the # current token from getStartPageToken() page_token = saved_start_page_token # pylint: disable=maybe-no-member ...
"""Retrieve the list of changes for the currently authenticated user. prints changed file's ID Args: saved_start_page_token : StartPageToken for the current state of the account. Returns: saved start page token. Load pre-authorized user credentials from the environment. TODO(developer) - Se...
96
374
310
684
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,211
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/change_snippet/fetch_start_page_token.py
20,21
1,48
fetch_start_page_token
28,45
21,45
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member response = service.changes().getStartPageToken().execute() print(f'Start token: {response.get("startPageToken")}') except HttpError as error: ...
"""Retrieve page token for the current state of the account. Returns & prints : start page token Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.defaul...
37
317
151
468
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distri...
47,212
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/change_snippet/test_fetch_changes.py
25,27
22,33
test_fetch_changes
TestFetchChanges
28,33
27,33
class TestFetchChanges(unittest.TestCase): """Unit test class for Change snippet""" @classmethod def test_fetch_changes(cls): FILL_FUNC_BODY
class TestFetchChanges(unittest.TestCase): """Unit test class for Change snippet""" @classmethod def test_fetch_changes(cls): """Test fetch_changes""" FILL_FUNC_BODY
start_token = fetch_start_page_token.fetch_start_page_token() token = fetch_changes.fetch_changes(start_token) cls.assertIsNotNone(cls, token)
"""Test fetch_changes""" start_token = fetch_start_page_token.fetch_start_page_token() token = fetch_changes.fetch_changes(start_token) cls.assertIsNotNone(cls, token)
8
61
59
120
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,213
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/change_snippet/test_fetch_start_page_token.py
24,26
21,31
test_fetch_start_page_token
TestFetchChanges
27,31
26,31
class TestFetchChanges(unittest.TestCase): """Unit test class for Change snippet""" @classmethod def test_fetch_start_page_token(cls): FILL_FUNC_BODY
class TestFetchChanges(unittest.TestCase): """Unit test class for Change snippet""" @classmethod def test_fetch_start_page_token(cls): """Test fetch_start_page_token""" FILL_FUNC_BODY
token = fetch_start_page_token.fetch_start_page_token() cls.assertIsNotNone(cls, token)
"""Test fetch_start_page_token""" token = fetch_start_page_token.fetch_start_page_token() cls.assertIsNotNone(cls, token)
5
69
40
109
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,214
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/drive_snippet/create_drive.py
25,26
1,60
create_drive
34,57
26,57
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) drive_metadata = {"name": "Project Resources"} request_id = str(uuid.uuid4()) # pylint: disable=maybe-no-member drive = ( service.drives() .create(body=drive_me...
"""Create a drive. Returns: Id of the created drive Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive api clie...
51
303
209
512
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,215
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/drive_snippet/recover_drives.py
23,24
1,93
recover_drives
34,90
24,90
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) drives = [] # pylint: disable=maybe-no-member page_token = None new_organizer_permission = { "type": "user", "role": "organizer", "emailAddress": "user@...
"""Find all shared drives without an organizer and add one. Args: real_user:User ID for the new organizer. Returns: drives object Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the app...
108
352
488
840
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,216
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/create_folder.py
23,24
1,54
create_folder
31,51
24,51
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = { "name": "Invoices", "mimeType": "application/vnd.google-apps.folder", } # pylint: disable=maybe-no-member file = service.files().create(body=f...
"""Create a folder and prints the folder ID Returns : Folder Id Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive ap...
45
298
197
495
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,217
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/create_shortcut.py
23,24
1,52
create_shortcut
30,49
24,49
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = { "name": "Project plan", "mimeType": "application/vnd.google-apps.drive-sdk", } # pylint: disable=maybe-no-member file = service.files().create...
"""Create a third party shortcut Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive api client service = build("dri...
44
292
191
483
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,218
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/download_file.py
26,27
1,63
download_file
36,60
27,60
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_id = real_file_id # pylint: disable=maybe-no-member request = service.files().get_media(fileId=file_id) file = io.BytesIO() downloader = MediaIoBaseDownload(file, req...
"""Downloads a file Args: real_file_id: ID of the file to download Returns : IO object with location. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = googl...
59
375
222
597
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,219
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/export_pdf.py
26,27
1,65
export_pdf
36,62
27,62
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_id = real_file_id # pylint: disable=maybe-no-member request = service.files().export_media( fileId=file_id, mimeType="application/pdf" ) file = io.BytesIO() ...
"""Download a Document file in PDF format. Args: real_file_id : file ID of any workspace document format file Returns : IO object with location Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for...
62
390
238
628
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,220
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/move_file_to_folder.py
22,23
1,68
move_file_to_folder
34,62
23,62
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member # Retrieve the existing parents to remove file = service.files().get(fileId=file_id, fields="parents").execute() previous_parents = ",".join(fil...
"""Move specified file to the specified folder. Args: file_id: Id of the file to move. folder_id: Id of the folder Print: An object containing the new parent folder and other meta data Returns : Parent Ids for the file Load pre-authorized user credentials from the environment. TODO(developer) -...
65
439
249
688
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,221
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/search_file.py
23,24
1,67
search_file
30,64
24,64
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) files = [] page_token = None while True: # pylint: disable=maybe-no-member response = ( service.files() .list( q="mimeType='image/jpeg'...
"""Search file in drive location Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive api client service = build("dri...
76
288
302
590
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,222
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/share_file.py
23,24
1,98
share_file
35,91
24,91
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) ids = [] file_id = real_file_id def callback(request_id, response, exception): if exception: # Handle error print(exception) else: print(f"Reque...
"""Batch permission modification. Args: real_file_id: file Id real_user: User ID real_domain: Domain of the user ID Prints modified permissions Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementin...
103
415
485
900
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,223
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_create_folder.py
24,26
21,31
test_create_folder
TestCreateFolder
27,31
26,31
class TestCreateFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_create_folder(cls): FILL_FUNC_BODY
class TestCreateFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_create_folder(cls): """Test create_folder""" FILL_FUNC_BODY
file_id = create_folder.create_folder() cls.assertIsNotNone(cls, file_id)
"""Test create_folder""" file_id = create_folder.create_folder() cls.assertIsNotNone(cls, file_id)
5
59
36
95
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,224
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_create_shortcut.py
24,26
21,31
test_create_shortcut
TestCreateShortcut
27,31
26,31
class TestCreateShortcut(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_create_shortcut(cls): FILL_FUNC_BODY
class TestCreateShortcut(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_create_shortcut(cls): """Test create_folder""" FILL_FUNC_BODY
file_id = create_shortcut.create_shortcut() cls.assertIsNotNone(cls, file_id)
"""Test create_folder""" file_id = create_shortcut.create_shortcut() cls.assertIsNotNone(cls, file_id)
5
61
38
99
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,225
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_download_file.py
24,26
21,33
test_download_file
TestDownloadFile
27,33
26,33
class TestDownloadFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_download_file(cls): FILL_FUNC_BODY
class TestDownloadFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_download_file(cls): """Test Download_file""" FILL_FUNC_BODY
# valid file id real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" file = download_file.download_file(real_file_id=real_file_id) cls.assertNotEqual(cls, 0, len(file))
"""Test Download_file""" # valid file id real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" file = download_file.download_file(real_file_id=real_file_id) cls.assertNotEqual(cls, 0, len(file))
13
59
94
153
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,226
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_export_pdf.py
24,26
21,33
test_export_pdf
TestExportPdf
27,33
26,33
class TestExportPdf(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_export_pdf(cls): FILL_FUNC_BODY
class TestExportPdf(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_export_pdf(cls): """Test export_pdf""" FILL_FUNC_BODY
# valid file ID real_file_id = "1zbp8wAyuImX91Jt9mI-CAX_1TqkBLDEDcr2WeXBbKUY" file = export_pdf.export_pdf(real_file_id=real_file_id) cls.assertNotEqual(cls, 0, len(file))
"""Test export_pdf""" # valid file ID real_file_id = "1zbp8wAyuImX91Jt9mI-CAX_1TqkBLDEDcr2WeXBbKUY" file = export_pdf.export_pdf(real_file_id=real_file_id) cls.assertNotEqual(cls, 0, len(file))
13
60
103
163
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,227
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_move_file_to_folder.py
24,26
21,36
test_move_file_to_folder
TestMoveFileToFolder
27,36
26,36
class TestMoveFileToFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_move_file_to_folder(cls): FILL_FUNC_BODY
class TestMoveFileToFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_move_file_to_folder(cls): """Test move_file_to_folder""" FILL_FUNC_BODY
file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" folder_id = "1v5eyIbXCr9TZX3eX_44HEExfe7yRj24V" update = move_file_to_folder.move_file_to_folder( file_id=file_id, folder_id=folder_id ) cls.assertIsNotNone(cls, 0, len(update))
"""Test move_file_to_folder""" file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" folder_id = "1v5eyIbXCr9TZX3eX_44HEExfe7yRj24V" update = move_file_to_folder.move_file_to_folder( file_id=file_id, folder_id=folder_id ) cls.assertIsNotNone(cls, 0, len(update))
15
69
143
212
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,228
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_search_file.py
24,26
21,31
test_search_file
TestSearchFile
27,31
26,31
class TestSearchFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_search_file(cls): FILL_FUNC_BODY
class TestSearchFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_search_file(cls): """Test search_file""" FILL_FUNC_BODY
file = search_file.search_file() cls.assertNotEqual(cls, 0, len(file))
"""Test search_file""" file = search_file.search_file() cls.assertNotEqual(cls, 0, len(file))
6
59
36
95
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,229
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_share_file.py
24,26
21,38
test_share_file
TestShareFile
27,38
26,38
class TestShareFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_share_file(cls): FILL_FUNC_BODY
class TestShareFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_share_file(cls): """Test share_file""" FILL_FUNC_BODY
real_file_id = "1dUiRSoAQKkM3a4nTPeNQWgiuau1KdQ_l" real_user = "gduser1@workspacesamples.dev" real_domain = "workspacesamples.dev" file = share_file.share_file( real_file_id=real_file_id, real_user=real_user, real_domain=real_domain, ) cls.assertNotEqual(cls, 0, len(file)...
"""Test share_file""" real_file_id = "1dUiRSoAQKkM3a4nTPeNQWgiuau1KdQ_l" real_user = "gduser1@workspacesamples.dev" real_domain = "workspacesamples.dev" file = share_file.share_file( real_file_id=real_file_id, real_user=real_user, real_domain=real_domain, ) cls.assert...
19
59
150
209
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,230
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_touch_file.py
26,28
23,38
test_touch_file
TestTouchFile
29,38
28,38
class TestTouchFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_touch_file(cls): FILL_FUNC_BODY
class TestTouchFile(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_touch_file(cls): """Test touch_file""" FILL_FUNC_BODY
real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" now = datetime.utcnow().isoformat() + "Z" now = re.sub(r"\d{3}Z", "Z", now) # Truncate microseconds modified_time = touch_file.touch_file( real_file_id=real_file_id, real_timestamp=now ) cls.assertIsNotNone(cls, modified_time)
"""Test touch_file""" real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" now = datetime.utcnow().isoformat() + "Z" now = re.sub(r"\d{3}Z", "Z", now) # Truncate microseconds modified_time = touch_file.touch_file( real_file_id=real_file_id, real_timestamp=now ) cls.assertIsNotNone(cls...
24
59
147
206
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,231
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_upload_basic.py
24,26
21,31
test_upload_basic
TestUploadBasic
27,31
26,31
class TestUploadBasic(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_basic(cls): FILL_FUNC_BODY
class TestUploadBasic(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_basic(cls): """Test upload_basic""" FILL_FUNC_BODY
file_id = upload_basic.upload_basic() cls.assertIsNotNone(cls, file_id)
"""Test upload_basic""" file_id = upload_basic.upload_basic() cls.assertIsNotNone(cls, file_id)
5
59
36
95
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,232
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_upload_revision.py
24,26
21,33
test_upload_revision
TestUploadRevision
27,33
26,33
class TestUploadRevision(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_revision(cls): FILL_FUNC_BODY
class TestUploadRevision(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_revision(cls): """Test upload_revision""" FILL_FUNC_BODY
real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" file_id = upload_revision.upload_revision(real_file_id=real_file_id) cls.assertIsNotNone(cls, file_id)
"""Test upload_revision""" real_file_id = "1KuPmvGq8yoYgbfW74OENMCB5H0n_2Jm9" file_id = upload_revision.upload_revision(real_file_id=real_file_id) cls.assertIsNotNone(cls, file_id)
8
62
91
153
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,233
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_upload_to_folder.py
24,26
21,32
test_upload_to_folder
TestUploadToFolder
27,32
26,32
class TestUploadToFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_to_folder(cls): FILL_FUNC_BODY
class TestUploadToFolder(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_to_folder(cls): """Test upload_to_folder""" FILL_FUNC_BODY
folder_id = "1s0oKEZZXjImNngxHGnY0xed6Mw-tvspu" file_id = upload_to_folder.upload_to_folder(folder_id=folder_id) cls.assertIsNotNone(cls, file_id)
"""Test upload_to_folder""" folder_id = "1s0oKEZZXjImNngxHGnY0xed6Mw-tvspu" file_id = upload_to_folder.upload_to_folder(folder_id=folder_id) cls.assertIsNotNone(cls, file_id)
8
64
83
147
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,234
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/test_upload_with_conversion.py
24,26
21,31
test_upload_to_folder
TestUploadWithConversion
27,31
26,31
class TestUploadWithConversion(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_to_folder(cls): FILL_FUNC_BODY
class TestUploadWithConversion(unittest.TestCase): """Unit test class for file snippet""" @classmethod def test_upload_to_folder(cls): """Test upload_with_conversion""" FILL_FUNC_BODY
file_id = upload_with_conversion.upload_with_conversion() cls.assertIsNotNone(cls, file_id)
"""Test upload_with_conversion""" file_id = upload_with_conversion.upload_with_conversion() cls.assertIsNotNone(cls, file_id)
5
66
42
108
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,235
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/touch_file.py
25,26
1,66
touch_file
36,60
26,60
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = {"modifiedTime": datetime.utcnow().isoformat() + "Z"} # pylint: disable=maybe-no-member file_id = real_file_id file_metadata["modifiedTime"] = real_timestamp ...
"""Change the file's modification timestamp. Args: real_file_id: ID of the file to change modified time real_timestamp: Timestamp to override Modified date time of the file Returns : Modified Date and time. Load pre-authorized user credentials from the environment. TODO(developer) - See https://d...
56
426
238
664
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,236
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/upload_basic.py
24,25
1,58
upload_basic
32,55
25,55
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = {"name": "download.jpeg"} media = MediaFileUpload("download.jpeg", mimetype="image/jpeg") # pylint: disable=maybe-no-member file = ( service.files() ...
"""Insert new file. Returns : Id's of the file uploaded Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive api client...
51
310
217
527
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,237
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/upload_revision.py
24,25
1,59
upload_revision
33,56
25,56
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_id = real_file_id media = MediaFileUpload( "download.jpeg", mimetype="image/jpeg", resumable=True ) # pylint: disable=maybe-no-member file = ( service.f...
"""Replace the old file with new one on same file ID Args: ID of the file to be replaced Returns: file ID Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google....
51
367
222
589
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,238
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/upload_to_folder.py
24,25
1,60
upload_to_folder
33,57
25,57
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = {"name": "photo.jpg", "parents": [folder_id]} media = MediaFileUpload( "download.jpeg", mimetype="image/jpeg", resumable=True ) # pylint: disable=maybe-...
"""Upload a file to the specified folder and prints file ID, folder ID Args: Id of the folder Returns: ID of the file uploaded Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """...
55
371
235
606
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,239
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/file_snippet/upload_with_conversion.py
24,25
1,61
upload_with_conversion
32,58
25,58
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() try: # create drive api client service = build("drive", "v3", credentials=creds) file_metadata = { "name": "My Report", "mimeType": "application/vnd.google-apps.spreadsheet", } media = MediaFileUpload("report.csv", mimetype="text/csv", resumable...
"""Upload file with conversion Returns: ID of the file uploaded Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create drive ap...
61
320
255
575
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,240
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/team_drive_snippets/create_team_drive.py
24,25
1,58
create_team_drive
32,55
25,55
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member team_drive_metadata = {"name": "Project Resources"} request_id = str(uuid.uuid4()) team_drive = ( service.teamdrives() .create(b...
"""Create a drive for team. Returns: ID of the created drive Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # call drive api cli...
52
310
222
532
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,241
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/drive/snippets/drive-v3/team_drive_snippets/recover_team_drives.py
22,23
1,96
recover_team_drives
33,93
23,93
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
creds, _ = google.auth.default() try: # call drive api client service = build("drive", "v3", credentials=creds) # pylint: disable=maybe-no-member team_drives = [] page_token = None new_organizer_permission = { "type": "user", "role": "organizer", "value": "user@exa...
"""Finds all Team Drives without an organizer and add one Args: real_user:User ID for the new organizer. Returns: team drives_object. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the...
108
364
529
893
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,242
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/customer_data_service.py
129,130
24,132
GetCustomerData
CustomerDataService
130,132
130,132
class CustomerDataService(object): _CUSTOMER_DATA = { "mars": { "customer_name": "Mars Inc.", "customer_logo": ( "https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/" + "OSIRIS_Mars_true_color.jpg/550px-OSIRIS_Mars_true_color.jpg" ), "cu...
class CustomerDataService(object): _CUSTOMER_DATA = { "mars": { "customer_name": "Mars Inc.", "customer_logo": ( "https://upload.wikimedia.org/wikipedia/commons/thumb/0/02/" + "OSIRIS_Mars_true_color.jpg/550px-OSIRIS_Mars_true_color.jpg" ), "cu...
customer_data = self._CUSTOMER_DATA[customer_id] return [customer_data[p.lower()] for p in properties]
customer_data = self._CUSTOMER_DATA[customer_id] return [customer_data[p.lower()] for p in properties]
9
1,673
39
1,712
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,243
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/customer_spreadsheet_reader.py
74,75
60,83
GetColumnData
CustomerSpreadsheet
75,83
75,83
class CustomerSpreadsheet(object): def __init__(self, spreadsheet, data_filters): self._spreadsheet = spreadsheet self._data_filters = data_filters def GetSheetId(self): sheet = self._spreadsheet.get("sheets")[0] return sheet.get("properties").get("sheetId") def GetTemplateId(self): metadat...
class CustomerSpreadsheet(object): def __init__(self, spreadsheet, data_filters): self._spreadsheet = spreadsheet self._data_filters = data_filters def GetSheetId(self): sheet = self._spreadsheet.get("sheets")[0] return sheet.get("properties").get("sheetId") def GetTemplateId(self): metadat...
index = list(self._data_filters.keys()).index(column_id) data = self._spreadsheet.get("sheets")[0].get("data")[index] values = [ row.get("values")[0].get("formattedValue") for row in data.get("rowData") ] # Remove the first value which is just the label return values[1:]
index = list(self._data_filters.keys()).index(column_id) data = self._spreadsheet.get("sheets")[0].get("data")[index] values = [ row.get("values")[0].get("formattedValue") for row in data.get("rowData") ] # Remove the first value which is just the label return values[1:]
27
155
110
265
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,244
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/customer_spreadsheet_reader.py
38,39
22,60
ExecuteRead
CustomerSpreadsheetReader
39,60
39,60
class CustomerSpreadsheetReader(object): def __init__(self, sheets_service, spreadsheet_id): self._sheets_service = sheets_service self._spreadsheet_id = spreadsheet_id self._data_filters = collections.OrderedDict() def ReadColumnData(self, column_id): data_filter = { "developerMetadataLoo...
class CustomerSpreadsheetReader(object): def __init__(self, sheets_service, spreadsheet_id): self._sheets_service = sheets_service self._spreadsheet_id = spreadsheet_id self._data_filters = collections.OrderedDict() def ReadColumnData(self, column_id): data_filter = { "developerMetadataLoo...
filters = list(self._data_filters.values()) get_body = {"dataFilters": filters} read_fields = ",".join([ "sheets.properties.sheetId", "sheets.data.rowData.values.formattedValue", "developerMetadata.metadataValue", ]) spreadsheet = ( self._sheets_service.spreadsheets()...
filters = list(self._data_filters.values()) get_body = {"dataFilters": filters} read_fields = ",".join([ "sheets.properties.sheetId", "sheets.data.rowData.values.formattedValue", "developerMetadata.metadataValue", ]) spreadsheet = ( self._sheets_service.spreadsheets()...
34
165
221
386
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,245
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/presentation_reader.py
69,70
25,79
_GetPlaceholdersFromText
PresentationReader
70,79
70,79
class PresentationReader(object): def __init__(self, slides_service, presentation_id): self._slides_service = slides_service self._presentation_id = presentation_id self._presentation = None def _InitPresentation(self): if not self._presentation: self._presentation = ( self._slides...
class PresentationReader(object): def __init__(self, slides_service, presentation_id): self._slides_service = slides_service self._presentation_id = presentation_id self._presentation = None def _InitPresentation(self): if not self._presentation: self._presentation = ( self._slides...
if not text: return [] placeholders = [] elements = text.get("textElements") for element in elements: if element.get("textRun"): content = element.get("textRun").get("content") placeholders += re.findall("{.*?}", content) return placeholders
if not text: return [] placeholders = [] elements = text.get("textElements") for element in elements: if element.get("textRun"): content = element.get("textRun").get("content") placeholders += re.findall("{.*?}", content) return placeholders
26
422
91
513
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,246
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/presentation_writer.py
49,50
20,55
ExecuteBatchUpdate
PresentationWriter
50,55
50,55
class PresentationWriter(object): """Queues writes for modifying a presentation. Call ExecuteBatchUpdate to flush pending writes. """ def __init__(self, slides_service, presentation_id): self._slides_service = slides_service self._presentation_id = presentation_id self._requests = [] def Replac...
class PresentationWriter(object): """Queues writes for modifying a presentation. Call ExecuteBatchUpdate to flush pending writes. """ def __init__(self, slides_service, presentation_id): self._slides_service = slides_service self._presentation_id = presentation_id self._requests = [] def Replac...
body = {"requests": self._requests} self._requests = [] self._slides_service.presentations().batchUpdate( presentationId=self._presentation_id, body=body ).execute()
body = {"requests": self._requests} self._requests = [] self._slides_service.presentations().batchUpdate( presentationId=self._presentation_id, body=body ).execute()
11
268
61
329
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,247
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/qbr_tool.py
107,108
1,197
add_customers
108,145
108,145
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Read the placeholders by querying for the developer metadata we added # while creating the spreadsheet spreadsheet_reader = customer_spreadsheet_reader.CustomerSpreadsheetReader( sheets_service, spreadsheet_id ) spreadsheet_reader.ReadColumnData("placeholders") customer_spreadsheet = spreadsheet_rea...
# Read the placeholders by querying for the developer metadata we added # while creating the spreadsheet spreadsheet_reader = customer_spreadsheet_reader.CustomerSpreadsheetReader( sheets_service, spreadsheet_id ) spreadsheet_reader.ReadColumnData("placeholders") customer_spreadsheet = spreadsheet_rea...
104
1,585
407
1,992
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,248
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/spreadsheet_writer.py
20,21
1,133
CreateSpreadsheet
26,44
21,44
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
sheets = [] for sheet_title in sheet_titles: sheet = { "properties": { "title": sheet_title, }, } sheets.append(sheet) spreadsheet = { "properties": { "title": title, }, "sheets": sheets, } return sheets_service.spreadsheets().create(body=sp...
"""Creates an empty spreadsheet. It creates a spreadsheet with the provided title, and creates a sheet for each entry in the sheet_titles list with the corresponding sheet title. """ sheets = [] for sheet_title in sheet_titles: sheet = { "properties": { "title": sheet_title, ...
30
1,007
127
1,134
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,249
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/events/next18/spreadsheet_writer.py
68,69
44,133
PopulateColumn
SpreadsheetWriter
69,112
69,112
class SpreadsheetWriter(object): """Queues writes for modifying a spreadsheet. Call ExecuteBatchUpdate to flush pending writes. """ def __init__(self, sheets_service, spreadsheet_id): self._sheets_service = sheets_service self._spreadsheet_id = spreadsheet_id self._requests = [] def InsertColum...
class SpreadsheetWriter(object): """Queues writes for modifying a spreadsheet. Call ExecuteBatchUpdate to flush pending writes. """ def __init__(self, sheets_service, spreadsheet_id): self._sheets_service = sheets_service self._spreadsheet_id = spreadsheet_id self._requests = [] def InsertColum...
# Include the column ID in the column values values = [column_id] + values # Populate the column with the values rows = [] for value in values: row_data = {"values": [{"userEnteredValue": {"stringValue": value}}]} rows.append(row_data) update_request = { "updateCells": { ...
# Include the column ID in the column values values = [column_id] + values # Populate the column with the values rows = [] for value in values: row_data = {"values": [{"userEnteredValue": {"stringValue": value}}]} rows.append(row_data) update_request = { "updateCells": { ...
115
410
387
797
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,250
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/forms/snippets/duplicate_form.py
27,28
1,61
main
31,58
28,58
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
creds = None if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or not creds.valid: if creds and creds.expired and creds.refresh_token: creds.refresh(Request()) ...
"""Shows copy file example in Drive v3 API. Prints the name, id and other data of the copied file. """ creds = None if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) credentials available, let the user log in. if not creds or...
87
335
367
702
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,251
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/gmail/quickstart/quickstart.py
28,29
1,72
main
32,69
29,69
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Gmail API. Lists the user's Gmail labels. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.fr...
132
342
423
765
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,252
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/gmail/snippet/base_test.py
31,33
22,52
create_credentials
BaseTest
33,46
33,46
class BaseTest(unittest.TestCase): RECIPIENT = "gduser01@workspacesamples.dev" TEST_USER = "ci-test01@workspacesamples.dev" FORWARDING_ADDRESS = "gduser01@workspacesamples.dev" @classmethod def setUpClass(cls): cls.service = cls.create_service() @classmethod def create_credentials(cls): FILL_FUNC_BO...
class BaseTest(unittest.TestCase): RECIPIENT = "gduser01@workspacesamples.dev" TEST_USER = "ci-test01@workspacesamples.dev" FORWARDING_ADDRESS = "gduser01@workspacesamples.dev" @classmethod def setUpClass(cls): cls.service = cls.create_service() @classmethod def create_credentials(cls): FILL_FUNC_BO...
scope = [ "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.labels", "https://www.googleapis.com/auth/gmail.settings.basic", "https://www.googleapis.com/auth/gmail.settings.sharing", "...
scope = [ "https://www.googleapis.com/auth/gmail.compose", "https://www.googleapis.com/auth/gmail.send", "https://www.googleapis.com/auth/gmail.labels", "https://www.googleapis.com/auth/gmail.settings.basic", "https://www.googleapis.com/auth/gmail.settings.sharing", "...
18
175
187
362
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,253
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/gmail/snippet/thread/test_thread.py
24,26
21,31
test_threads
TestThreads
27,31
26,31
class TestThreads(unittest.TestCase): """unit test class for snippets""" @classmethod def test_threads(cls): FILL_FUNC_BODY
class TestThreads(unittest.TestCase): """unit test class for snippets""" @classmethod def test_threads(cls): """to test threads""" FILL_FUNC_BODY
result = show_chatty_threads() cls.assertIsNotNone(cls, result)
"""to test threads""" result = show_chatty_threads() cls.assertIsNotNone(cls, result)
5
56
32
88
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
"""Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dist...
47,254
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/gmail/snippet/thread/threads.py
19,20
1,63
show_chatty_threads
27,60
20,60
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
creds, _ = google.auth.default() try: # create gmail api client service = build("gmail", "v1", credentials=creds) # pylint: disable=maybe-no-member # pylint: disable:R1710 threads = ( service.users().threads().list(userId="me").execute().get("threads", []) ) for thread in threa...
"""Display threads with long conversations(>= 3 messages) Return: None Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() try: # create g...
90
312
326
638
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
"""Copyright 2018 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distrib...
47,255
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/meet/quickstart/quickstart.py
30,31
1,64
main
33,61
31,61
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_authorized_user_file('token.json', SCOPES) # If there are n...
"""Shows basic usage of the Google Meet API. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists('token.json'): creds = Credentials.from_author...
113
330
375
705
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,256
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/people/quickstart/quickstart.py
28,29
1,80
main
32,77
29,77
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the People API. Prints the name of the first 10 connections. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds =...
135
342
463
805
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,257
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/quickstart/quickstart.py
32,33
1,82
main
36,79
33,79
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Credentials.from_authorized_user_file("token.json", SCOPES) # If there are no (valid) creden...
"""Shows basic usage of the Sheets API. Prints values from a sample spreadsheet. """ creds = None # The file token.json stores the user's access and refresh tokens, and is # created automatically when the authorization flow completes for the first # time. if os.path.exists("token.json"): creds = Cre...
144
424
479
903
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,258
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/snippets/base_test.py
42,44
24,94
create_credentials
BaseTest
44,48
44,48
class BaseTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.credentials = cls.create_credentials() http = cls.credentials.authorize(httplib2.Http()) cls.credentials.refresh(http) cls.service = build("sheets", "v4", http=http) cls.drive_service = build("drive", "v3", http=http) ...
class BaseTest(unittest.TestCase): @classmethod def setUpClass(cls): cls.credentials = cls.create_credentials() http = cls.credentials.authorize(httplib2.Http()) cls.credentials.refresh(http) cls.service = build("sheets", "v4", http=http) cls.drive_service = build("drive", "v3", http=http) ...
cls.credentials = GoogleCredentials.get_application_default() scope = ["https://www.googleapis.com/auth/drive"] return cls.credentials.create_scoped(scope)
cls.credentials = GoogleCredentials.get_application_default() scope = ["https://www.googleapis.com/auth/drive"] return cls.credentials.create_scoped(scope)
8
636
56
692
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
47,259
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/snippets/sheets_append_values.py
23,24
1,73
append_values
30,64
24,64
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("sheets", "v4", credentials=creds) values = [ [ # Cell values ... ], # Additional rows ... ] # [START_EXCLUDE silent] values = _values # [END_EXCLUDE] body = {"v...
""" Creates the batch_update the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member try...
67
412
278
690
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,260
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/snippets/sheets_batch_get_values.py
23,24
1,59
batch_get_values
30,54
24,54
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("sheets", "v4", credentials=creds) range_names = [ # Range names ... ] # [START_EXCLUDE silent] range_names = _range_names # [END_EXCLUDE] result = ( service.spreadsheets() ....
""" Creates the batch_update the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member try...
57
372
234
606
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,261
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/snippets/sheets_batch_update.py
23,24
1,80
sheets_batch_update
30,76
24,76
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("sheets", "v4", credentials=creds) requests = [] # Change the spreadsheet's title. requests.append( { "updateSpreadsheetProperties": { "properties": {"title": title}, ...
""" Update the sheet details in batch, the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-m...
89
330
369
699
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
47,262
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples
/home/hieuvd/dung_repo/raw/stars_03/googleworkspace_python-samples/python-samples/sheets/snippets/sheets_batch_update_values.py
23,26
1,73
batch_update_values
32,64
26,64
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
creds, _ = google.auth.default() # pylint: disable=maybe-no-member try: service = build("sheets", "v4", credentials=creds) values = [ [ # Cell values ... ], # Additional rows ] # [START_EXCLUDE silent] values = _values # [END_EXCLUDE] data = [ ...
""" Creates the batch_update the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application. """ creds, _ = google.auth.default() # pylint: disable=maybe-no-member try...
78
422
286
708
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...
""" Copyright 2022 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software dis...