Skip to content

Commit 1385950

Browse files
cleaned up styling
1 parent ba7a19d commit 1385950

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

classroom/snippets/snippets.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ def add_teacher(self):
170170
'userId': teacher_email
171171
}
172172
try:
173-
teacher = service.courses().teachers().create(courseId=course_id,
174-
body=teacher).execute()
173+
teachers = service.courses().teachers()
174+
teacher = teachers.create(courseId=course_id,
175+
body=teacher).execute()
175176
print('User %s was added as a teacher to the course with ID %s'
176177
% (teacher.get('profile').get('name').get('fullName'),
177178
course_id))
178179
except errors.HttpError as e:
179180
error = json.loads(e.content).get('error')
180-
if(error.get('code') == 409):
181+
if error.get('code') == 409:
181182
print('User "{%s}" is already a member of this course.'
182183
% teacher_email)
183184
else:
@@ -200,13 +201,14 @@ def add_student(self):
200201
courseId=course_id,
201202
enrollmentCode=enrollment_code,
202203
body=student).execute()
203-
print (
204-
'User {%s} was enrolled as a student in the course with ID "{%s}"'
204+
print(
205+
'''User {%s} was enrolled as a student in
206+
the course with ID "{%s}"'''
205207
% (student.get('profile').get('name').get('fullName'),
206208
course_id))
207209
except errors.HttpError as e:
208210
error = json.loads(e.content).get('error')
209-
if(error.get('code') == 409):
211+
if error.get('code') == 409:
210212
print('You are already a member of this course.')
211213
else:
212214
raise

0 commit comments

Comments
 (0)