Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CSCE 361
scripts
Commits
9c2db6a0
Commit
9c2db6a0
authored
5 years ago
by
Christopher Bohn
Browse files
Options
Downloads
Patches
Plain Diff
Added code to validate repos for code review & response assignments
parent
38df6b06
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/gitlab_classes.py
+7
-0
7 additions, 0 deletions
api/gitlab_classes.py
prep-code-review-and-response.py
+39
-1
39 additions, 1 deletion
prep-code-review-and-response.py
with
46 additions
and
1 deletion
api/gitlab_classes.py
+
7
−
0
View file @
9c2db6a0
...
...
@@ -53,6 +53,13 @@ class GitlabUser:
def
get_site
(
self
)
->
str
:
return
self
.
git_user
.
web_url
def
get_projects
(
self
)
->
List
[
"
GitlabProject
"
]:
gitlab_projects
=
self
.
git_user
.
projects
.
list
(
all
=
True
)
projects
:
List
[
GitlabProject
]
=
[]
for
project
in
gitlab_projects
:
projects
.
append
(
GitlabProject
(
project
))
return
projects
def
__repr__
(
self
)
->
str
:
username
=
self
.
get_username
()
return
f
'
@
{
username
}
'
...
...
This diff is collapsed.
Click to expand it.
prep-code-review-and-response.py
+
39
−
1
View file @
9c2db6a0
...
...
@@ -58,7 +58,45 @@ def create_clone_script():
def
validate_forks
():
print
(
'
Examining the forks (... not yet)
'
)
old_groupset
:
str
=
input
(
'
Please provide the name of the student groupset for the previous assignment:
'
)
new_groupset
:
str
=
input
(
'
Please provide the name of the student groupset for the next assignment:
'
)
students
:
Set
[
CompositeUser
]
=
get_students
()
print
(
'
Validating the forks.
'
)
print
(
'
This script will report anything unexpected;
'
)
print
(
'
use judgement when grading fork requirement.
'
)
print
()
# noinspection PyPep8Naming
TAs
:
List
[
str
]
=
(
input
(
'
Enter the TAs
\'
gitlab usernames as a space-delimited sequence:
'
)).
split
()
course
=
CanvasCourse
(
Course
.
canvas_course_id
)
old_groups
:
List
[
CanvasUserGroup
]
=
list
(
filter
(
lambda
g
:
g
.
get_name
()
==
old_groupset
,
course
.
get_user_groupsets
()))[
0
].
get_groups
()
new_groups
:
List
[
CanvasUserGroup
]
=
list
(
filter
(
lambda
g
:
g
.
get_name
()
==
new_groupset
,
course
.
get_user_groupsets
()))[
0
].
get_groups
()
for
student
in
students
:
print
(
f
'
Validating
{
student
.
get_canvas_user
().
get_name
()
}
'
)
old_group_name
:
str
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
old_groups
))[
0
].
get_name
().
strip
().
replace
(
"
"
,
""
)
new_group
=
list
(
filter
(
lambda
g
:
student
.
get_canvas_user
()
in
g
.
get_students
(),
new_groups
))[
0
]
projects
:
List
[
GitlabProject
]
=
student
.
get_gitlab_user
().
get_projects
()
project_names
:
List
[
str
]
=
list
(
map
(
lambda
p
:
p
.
get_name
(),
projects
))
if
old_group_name
in
project_names
:
project
:
GitlabProject
=
list
(
filter
(
lambda
p
:
p
.
get_name
()
==
old_group_name
,
projects
))[
0
]
users
:
List
[
GitlabUser
]
=
project
.
get_all_users
()
usernames
:
List
[
str
]
=
list
(
map
(
lambda
u
:
u
.
get_username
(),
users
))
for
TA
in
TAs
:
if
TA
not
in
usernames
:
print
(
f
'
\t
{
student
.
get_canvas_user
().
get_name
()
}
did not add @
{
TA
}
to repo.
'
)
for
partner
in
new_group
.
get_students
():
composite_student
:
CompositeUser
=
list
(
filter
(
lambda
s
:
s
.
get_canvas_user
()
==
partner
,
students
))[
0
]
if
composite_student
.
get_gitlab_user
().
get_username
()
not
in
usernames
:
print
(
f
'
\t
{
student
.
get_canvas_user
().
get_name
()
}
did not add
{
partner
.
get_name
()
}
to repo.
'
)
else
:
print
(
f
'
\t
{
student
.
get_canvas_user
().
get_name
()
}
: Could not locate
{
old_group_name
}
.git
'
)
print
(
'
\t\t
This may be because the student hasn
\'
t forked their repository, or
'
)
print
(
'
\t\t
because they haven
\'
t given you access, or because they renamed it.
'
)
print
(
f
'
\t\t\t
{
student
.
get_canvas_user
().
get_name
()
}
\'
s repositories:
'
)
for
project
in
project_names
:
print
(
f
'
\t\t\t
{
project
}
'
)
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment