partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | render_page_with_error_code_message | Return a 404 page with specified error_code after logging error and adding message to django messages. | enterprise/views.py | def render_page_with_error_code_message(request, context_data, error_code, log_message):
"""
Return a 404 page with specified error_code after logging error and adding message to django messages.
"""
LOGGER.error(log_message)
messages.add_generic_error_message_with_code(request, error_code)
retu... | def render_page_with_error_code_message(request, context_data, error_code, log_message):
"""
Return a 404 page with specified error_code after logging error and adding message to django messages.
"""
LOGGER.error(log_message)
messages.add_generic_error_message_with_code(request, error_code)
retu... | [
"Return",
"a",
"404",
"page",
"with",
"specified",
"error_code",
"after",
"logging",
"error",
"and",
"adding",
"message",
"to",
"django",
"messages",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L139-L150 | [
"def",
"render_page_with_error_code_message",
"(",
"request",
",",
"context_data",
",",
"error_code",
",",
"log_message",
")",
":",
"LOGGER",
".",
"error",
"(",
"log_message",
")",
"messages",
".",
"add_generic_error_message_with_code",
"(",
"request",
",",
"error_cod... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.course_or_program_exist | Return whether the input course or program exist. | enterprise/views.py | def course_or_program_exist(self, course_id, program_uuid):
"""
Return whether the input course or program exist.
"""
course_exists = course_id and CourseApiClient().get_course_details(course_id)
program_exists = program_uuid and CourseCatalogApiServiceClient().program_exists(pro... | def course_or_program_exist(self, course_id, program_uuid):
"""
Return whether the input course or program exist.
"""
course_exists = course_id and CourseApiClient().get_course_details(course_id)
program_exists = program_uuid and CourseCatalogApiServiceClient().program_exists(pro... | [
"Return",
"whether",
"the",
"input",
"course",
"or",
"program",
"exist",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L183-L189 | [
"def",
"course_or_program_exist",
"(",
"self",
",",
"course_id",
",",
"program_uuid",
")",
":",
"course_exists",
"=",
"course_id",
"and",
"CourseApiClient",
"(",
")",
".",
"get_course_details",
"(",
"course_id",
")",
"program_exists",
"=",
"program_uuid",
"and",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.get_default_context | Get the set of variables that will populate the template by default. | enterprise/views.py | def get_default_context(self, enterprise_customer, platform_name):
"""
Get the set of variables that will populate the template by default.
"""
context_data = {
'page_title': _('Data sharing consent required'),
'consent_message_header': _('Consent to share your da... | def get_default_context(self, enterprise_customer, platform_name):
"""
Get the set of variables that will populate the template by default.
"""
context_data = {
'page_title': _('Data sharing consent required'),
'consent_message_header': _('Consent to share your da... | [
"Get",
"the",
"set",
"of",
"variables",
"that",
"will",
"populate",
"the",
"template",
"by",
"default",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L191-L287 | [
"def",
"get_default_context",
"(",
"self",
",",
"enterprise_customer",
",",
"platform_name",
")",
":",
"context_data",
"=",
"{",
"'page_title'",
":",
"_",
"(",
"'Data sharing consent required'",
")",
",",
"'consent_message_header'",
":",
"_",
"(",
"'Consent to share y... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.get_context_from_db | Make set of variables(populated from db) that will be used in data sharing consent page. | enterprise/views.py | def get_context_from_db(self, consent_page, platform_name, item, context):
"""
Make set of variables(populated from db) that will be used in data sharing consent page.
"""
enterprise_customer = consent_page.enterprise_customer
course_title = context.get('course_title', None)
... | def get_context_from_db(self, consent_page, platform_name, item, context):
"""
Make set of variables(populated from db) that will be used in data sharing consent page.
"""
enterprise_customer = consent_page.enterprise_customer
course_title = context.get('course_title', None)
... | [
"Make",
"set",
"of",
"variables",
"(",
"populated",
"from",
"db",
")",
"that",
"will",
"be",
"used",
"in",
"data",
"sharing",
"consent",
"page",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L289-L347 | [
"def",
"get_context_from_db",
"(",
"self",
",",
"consent_page",
",",
"platform_name",
",",
"item",
",",
"context",
")",
":",
"enterprise_customer",
"=",
"consent_page",
".",
"enterprise_customer",
"course_title",
"=",
"context",
".",
"get",
"(",
"'course_title'",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.get_course_or_program_context | Return a dict having course or program specific keys for data sharing consent page. | enterprise/views.py | def get_course_or_program_context(self, enterprise_customer, course_id=None, program_uuid=None):
"""
Return a dict having course or program specific keys for data sharing consent page.
"""
context_data = {}
if course_id:
context_data.update({'course_id': course_id, 'c... | def get_course_or_program_context(self, enterprise_customer, course_id=None, program_uuid=None):
"""
Return a dict having course or program specific keys for data sharing consent page.
"""
context_data = {}
if course_id:
context_data.update({'course_id': course_id, 'c... | [
"Return",
"a",
"dict",
"having",
"course",
"or",
"program",
"specific",
"keys",
"for",
"data",
"sharing",
"consent",
"page",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L349-L381 | [
"def",
"get_course_or_program_context",
"(",
"self",
",",
"enterprise_customer",
",",
"course_id",
"=",
"None",
",",
"program_uuid",
"=",
"None",
")",
":",
"context_data",
"=",
"{",
"}",
"if",
"course_id",
":",
"context_data",
".",
"update",
"(",
"{",
"'course... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.get | Render a form to collect user input about data sharing consent. | enterprise/views.py | def get(self, request):
"""
Render a form to collect user input about data sharing consent.
"""
enterprise_customer_uuid = request.GET.get('enterprise_customer_uuid')
success_url = request.GET.get('next')
failure_url = request.GET.get('failure_url')
course_id = re... | def get(self, request):
"""
Render a form to collect user input about data sharing consent.
"""
enterprise_customer_uuid = request.GET.get('enterprise_customer_uuid')
success_url = request.GET.get('next')
failure_url = request.GET.get('failure_url')
course_id = re... | [
"Render",
"a",
"form",
"to",
"collect",
"user",
"input",
"about",
"data",
"sharing",
"consent",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L384-L552 | [
"def",
"get",
"(",
"self",
",",
"request",
")",
":",
"enterprise_customer_uuid",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'enterprise_customer_uuid'",
")",
"success_url",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'next'",
")",
"failure_url",
"=",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | GrantDataSharingPermissions.post | Process the above form. | enterprise/views.py | def post(self, request):
"""
Process the above form.
"""
enterprise_uuid = request.POST.get('enterprise_customer_uuid')
success_url = request.POST.get('redirect_url')
failure_url = request.POST.get('failure_url')
course_id = request.POST.get('course_id', '')
... | def post(self, request):
"""
Process the above form.
"""
enterprise_uuid = request.POST.get('enterprise_customer_uuid')
success_url = request.POST.get('redirect_url')
failure_url = request.POST.get('failure_url')
course_id = request.POST.get('course_id', '')
... | [
"Process",
"the",
"above",
"form",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L555-L644 | [
"def",
"post",
"(",
"self",
",",
"request",
")",
":",
"enterprise_uuid",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'enterprise_customer_uuid'",
")",
"success_url",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'redirect_url'",
")",
"failure_url",
"=",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | HandleConsentEnrollment.get | Handle the enrollment of enterprise learner in the provided course.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment record should be created.
Depending on the value of query parameter `course_mode` then learner
will be either redire... | enterprise/views.py | def get(self, request, enterprise_uuid, course_id):
"""
Handle the enrollment of enterprise learner in the provided course.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment record should be created.
Depending on the value of ... | def get(self, request, enterprise_uuid, course_id):
"""
Handle the enrollment of enterprise learner in the provided course.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment record should be created.
Depending on the value of ... | [
"Handle",
"the",
"enrollment",
"of",
"enterprise",
"learner",
"in",
"the",
"provided",
"course",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L656-L744 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"course_id",
")",
":",
"enrollment_course_mode",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'course_mode'",
")",
"enterprise_catalog_uuid",
"=",
"request",
".",
"GET",
".",
"get",
"("... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.set_final_prices | Set the final discounted price on each premium mode. | enterprise/views.py | def set_final_prices(self, modes, request):
"""
Set the final discounted price on each premium mode.
"""
result = []
for mode in modes:
if mode['premium']:
mode['final_price'] = EcommerceApiClient(request.user).get_course_final_price(
... | def set_final_prices(self, modes, request):
"""
Set the final discounted price on each premium mode.
"""
result = []
for mode in modes:
if mode['premium']:
mode['final_price'] = EcommerceApiClient(request.user).get_course_final_price(
... | [
"Set",
"the",
"final",
"discounted",
"price",
"on",
"each",
"premium",
"mode",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L760-L774 | [
"def",
"set_final_prices",
"(",
"self",
",",
"modes",
",",
"request",
")",
":",
"result",
"=",
"[",
"]",
"for",
"mode",
"in",
"modes",
":",
"if",
"mode",
"[",
"'premium'",
"]",
":",
"mode",
"[",
"'final_price'",
"]",
"=",
"EcommerceApiClient",
"(",
"re... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.get_available_course_modes | Return the available course modes for the course run.
The provided EnterpriseCustomerCatalog is used to filter and order the
course modes returned using the EnterpriseCustomerCatalog's
field "enabled_course_modes". | enterprise/views.py | def get_available_course_modes(self, request, course_run_id, enterprise_catalog):
"""
Return the available course modes for the course run.
The provided EnterpriseCustomerCatalog is used to filter and order the
course modes returned using the EnterpriseCustomerCatalog's
field "e... | def get_available_course_modes(self, request, course_run_id, enterprise_catalog):
"""
Return the available course modes for the course run.
The provided EnterpriseCustomerCatalog is used to filter and order the
course modes returned using the EnterpriseCustomerCatalog's
field "e... | [
"Return",
"the",
"available",
"course",
"modes",
"for",
"the",
"course",
"run",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L776-L805 | [
"def",
"get_available_course_modes",
"(",
"self",
",",
"request",
",",
"course_run_id",
",",
"enterprise_catalog",
")",
":",
"modes",
"=",
"EnrollmentApiClient",
"(",
")",
".",
"get_course_modes",
"(",
"course_run_id",
")",
"if",
"not",
"modes",
":",
"LOGGER",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.get_base_details | Retrieve fundamental details used by both POST and GET versions of this view.
Specifically, take an EnterpriseCustomer UUID and a course run ID, and transform those
into an actual EnterpriseCustomer, a set of details about the course, and a list
of the available course modes for that course run... | enterprise/views.py | def get_base_details(self, request, enterprise_uuid, course_run_id):
"""
Retrieve fundamental details used by both POST and GET versions of this view.
Specifically, take an EnterpriseCustomer UUID and a course run ID, and transform those
into an actual EnterpriseCustomer, a set of detai... | def get_base_details(self, request, enterprise_uuid, course_run_id):
"""
Retrieve fundamental details used by both POST and GET versions of this view.
Specifically, take an EnterpriseCustomer UUID and a course run ID, and transform those
into an actual EnterpriseCustomer, a set of detai... | [
"Retrieve",
"fundamental",
"details",
"used",
"by",
"both",
"POST",
"and",
"GET",
"versions",
"of",
"this",
"view",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L807-L909 | [
"def",
"get_base_details",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"course_run_id",
")",
":",
"enterprise_customer",
"=",
"get_enterprise_customer_or_404",
"(",
"enterprise_uuid",
")",
"# If the catalog query parameter was provided, we need to scope",
"# this ... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.get_enterprise_course_enrollment_page | Render enterprise-specific course track selection page. | enterprise/views.py | def get_enterprise_course_enrollment_page(
self,
request,
enterprise_customer,
course,
course_run,
course_modes,
enterprise_course_enrollment,
data_sharing_consent
):
"""
Render enterprise-specific course... | def get_enterprise_course_enrollment_page(
self,
request,
enterprise_customer,
course,
course_run,
course_modes,
enterprise_course_enrollment,
data_sharing_consent
):
"""
Render enterprise-specific course... | [
"Render",
"enterprise",
"-",
"specific",
"course",
"track",
"selection",
"page",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L911-L1029 | [
"def",
"get_enterprise_course_enrollment_page",
"(",
"self",
",",
"request",
",",
"enterprise_customer",
",",
"course",
",",
"course_run",
",",
"course_modes",
",",
"enterprise_course_enrollment",
",",
"data_sharing_consent",
")",
":",
"context_data",
"=",
"get_global_con... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.post | Process a submitted track selection form for the enterprise. | enterprise/views.py | def post(self, request, enterprise_uuid, course_id):
"""
Process a submitted track selection form for the enterprise.
"""
enterprise_customer, course, course_run, course_modes = self.get_base_details(
request, enterprise_uuid, course_id
)
# Create a link betw... | def post(self, request, enterprise_uuid, course_id):
"""
Process a submitted track selection form for the enterprise.
"""
enterprise_customer, course, course_run, course_modes = self.get_base_details(
request, enterprise_uuid, course_id
)
# Create a link betw... | [
"Process",
"a",
"submitted",
"track",
"selection",
"form",
"for",
"the",
"enterprise",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1032-L1168 | [
"def",
"post",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"course_id",
")",
":",
"enterprise_customer",
",",
"course",
",",
"course_run",
",",
"course_modes",
"=",
"self",
".",
"get_base_details",
"(",
"request",
",",
"enterprise_uuid",
",",
"co... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | CourseEnrollmentView.get | Show course track selection page for the enterprise.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment page is to use.
Unauthenticated learners will be redirected to enterprise-linked SSO.
A 404 will be raised if any of the following... | enterprise/views.py | def get(self, request, enterprise_uuid, course_id):
"""
Show course track selection page for the enterprise.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment page is to use.
Unauthenticated learners will be redirected to ente... | def get(self, request, enterprise_uuid, course_id):
"""
Show course track selection page for the enterprise.
Based on `enterprise_uuid` in URL, the view will decide which
enterprise customer's course enrollment page is to use.
Unauthenticated learners will be redirected to ente... | [
"Show",
"course",
"track",
"selection",
"page",
"for",
"the",
"enterprise",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1172-L1227 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"course_id",
")",
":",
"# Check to see if access to the course run is restricted for this user.",
"embargo_url",
"=",
"EmbargoApiClient",
".",
"redirect_if_blocked",
"(",
"[",
"course_id",
"]",
",",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | ProgramEnrollmentView.extend_course | Extend a course with more details needed for the program landing page.
In particular, we add the following:
* `course_image_uri`
* `course_title`
* `course_level_type`
* `course_short_description`
* `course_full_description`
* `course_effort`
* `expected... | enterprise/views.py | def extend_course(course, enterprise_customer, request):
"""
Extend a course with more details needed for the program landing page.
In particular, we add the following:
* `course_image_uri`
* `course_title`
* `course_level_type`
* `course_short_description`
... | def extend_course(course, enterprise_customer, request):
"""
Extend a course with more details needed for the program landing page.
In particular, we add the following:
* `course_image_uri`
* `course_title`
* `course_level_type`
* `course_short_description`
... | [
"Extend",
"a",
"course",
"with",
"more",
"details",
"needed",
"for",
"the",
"program",
"landing",
"page",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1241-L1315 | [
"def",
"extend_course",
"(",
"course",
",",
"enterprise_customer",
",",
"request",
")",
":",
"course_run_id",
"=",
"course",
"[",
"'course_runs'",
"]",
"[",
"0",
"]",
"[",
"'key'",
"]",
"try",
":",
"catalog_api_client",
"=",
"CourseCatalogApiServiceClient",
"(",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | ProgramEnrollmentView.get_program_details | Retrieve fundamental details used by both POST and GET versions of this view.
Specifically:
* Take the program UUID and get specific details about the program.
* Determine whether the learner is enrolled in the program.
* Determine whether the learner is certificate eligible for the pr... | enterprise/views.py | def get_program_details(self, request, program_uuid, enterprise_customer):
"""
Retrieve fundamental details used by both POST and GET versions of this view.
Specifically:
* Take the program UUID and get specific details about the program.
* Determine whether the learner is enro... | def get_program_details(self, request, program_uuid, enterprise_customer):
"""
Retrieve fundamental details used by both POST and GET versions of this view.
Specifically:
* Take the program UUID and get specific details about the program.
* Determine whether the learner is enro... | [
"Retrieve",
"fundamental",
"details",
"used",
"by",
"both",
"POST",
"and",
"GET",
"versions",
"of",
"this",
"view",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1317-L1404 | [
"def",
"get_program_details",
"(",
"self",
",",
"request",
",",
"program_uuid",
",",
"enterprise_customer",
")",
":",
"try",
":",
"course_catalog_api_client",
"=",
"CourseCatalogApiServiceClient",
"(",
"enterprise_customer",
".",
"site",
")",
"except",
"ImproperlyConfig... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | ProgramEnrollmentView.get_enterprise_program_enrollment_page | Render Enterprise-specific program enrollment page. | enterprise/views.py | def get_enterprise_program_enrollment_page(self, request, enterprise_customer, program_details):
"""
Render Enterprise-specific program enrollment page.
"""
# Safely make the assumption that we can use the first authoring organization.
organizations = program_details['authoring_o... | def get_enterprise_program_enrollment_page(self, request, enterprise_customer, program_details):
"""
Render Enterprise-specific program enrollment page.
"""
# Safely make the assumption that we can use the first authoring organization.
organizations = program_details['authoring_o... | [
"Render",
"Enterprise",
"-",
"specific",
"program",
"enrollment",
"page",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1406-L1519 | [
"def",
"get_enterprise_program_enrollment_page",
"(",
"self",
",",
"request",
",",
"enterprise_customer",
",",
"program_details",
")",
":",
"# Safely make the assumption that we can use the first authoring organization.",
"organizations",
"=",
"program_details",
"[",
"'authoring_or... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | ProgramEnrollmentView.get | Show Program Landing page for the Enterprise's Program.
Render the Enterprise's Program Enrollment page for a specific program.
The Enterprise and Program are both selected by their respective UUIDs.
Unauthenticated learners will be redirected to enterprise-linked SSO.
A 404 will be r... | enterprise/views.py | def get(self, request, enterprise_uuid, program_uuid):
"""
Show Program Landing page for the Enterprise's Program.
Render the Enterprise's Program Enrollment page for a specific program.
The Enterprise and Program are both selected by their respective UUIDs.
Unauthenticated lea... | def get(self, request, enterprise_uuid, program_uuid):
"""
Show Program Landing page for the Enterprise's Program.
Render the Enterprise's Program Enrollment page for a specific program.
The Enterprise and Program are both selected by their respective UUIDs.
Unauthenticated lea... | [
"Show",
"Program",
"Landing",
"page",
"for",
"the",
"Enterprise",
"s",
"Program",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1523-L1564 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"program_uuid",
")",
":",
"verify_edx_resources",
"(",
")",
"enterprise_customer",
"=",
"get_enterprise_customer_or_404",
"(",
"enterprise_uuid",
")",
"context_data",
"=",
"get_global_context",
"(... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | ProgramEnrollmentView.post | Process a submitted track selection form for the enterprise. | enterprise/views.py | def post(self, request, enterprise_uuid, program_uuid):
"""
Process a submitted track selection form for the enterprise.
"""
verify_edx_resources()
# Create a link between the user and the enterprise customer if it does not already exist.
enterprise_customer = get_enterp... | def post(self, request, enterprise_uuid, program_uuid):
"""
Process a submitted track selection form for the enterprise.
"""
verify_edx_resources()
# Create a link between the user and the enterprise customer if it does not already exist.
enterprise_customer = get_enterp... | [
"Process",
"a",
"submitted",
"track",
"selection",
"form",
"for",
"the",
"enterprise",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1567-L1624 | [
"def",
"post",
"(",
"self",
",",
"request",
",",
"enterprise_uuid",
",",
"program_uuid",
")",
":",
"verify_edx_resources",
"(",
")",
"# Create a link between the user and the enterprise customer if it does not already exist.",
"enterprise_customer",
"=",
"get_enterprise_customer_... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.get_path_variables | Get the base variables for any view to route to.
Currently gets:
- `enterprise_uuid` - the UUID of the enterprise customer.
- `course_run_id` - the ID of the course, if applicable.
- `program_uuid` - the UUID of the program, if applicable. | enterprise/views.py | def get_path_variables(**kwargs):
"""
Get the base variables for any view to route to.
Currently gets:
- `enterprise_uuid` - the UUID of the enterprise customer.
- `course_run_id` - the ID of the course, if applicable.
- `program_uuid` - the UUID of the program, if appli... | def get_path_variables(**kwargs):
"""
Get the base variables for any view to route to.
Currently gets:
- `enterprise_uuid` - the UUID of the enterprise customer.
- `course_run_id` - the ID of the course, if applicable.
- `program_uuid` - the UUID of the program, if appli... | [
"Get",
"the",
"base",
"variables",
"for",
"any",
"view",
"to",
"route",
"to",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1643-L1657 | [
"def",
"get_path_variables",
"(",
"*",
"*",
"kwargs",
")",
":",
"enterprise_customer_uuid",
"=",
"kwargs",
".",
"get",
"(",
"'enterprise_uuid'",
",",
"''",
")",
"course_run_id",
"=",
"kwargs",
".",
"get",
"(",
"'course_id'",
",",
"''",
")",
"course_key",
"="... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.get_course_run_id | User is requesting a course, we need to translate that into the current course run.
:param user:
:param enterprise_customer:
:param course_key:
:return: course_run_id | enterprise/views.py | def get_course_run_id(user, enterprise_customer, course_key):
"""
User is requesting a course, we need to translate that into the current course run.
:param user:
:param enterprise_customer:
:param course_key:
:return: course_run_id
"""
try:
c... | def get_course_run_id(user, enterprise_customer, course_key):
"""
User is requesting a course, we need to translate that into the current course run.
:param user:
:param enterprise_customer:
:param course_key:
:return: course_run_id
"""
try:
c... | [
"User",
"is",
"requesting",
"a",
"course",
"we",
"need",
"to",
"translate",
"that",
"into",
"the",
"current",
"course",
"run",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1660-L1684 | [
"def",
"get_course_run_id",
"(",
"user",
",",
"enterprise_customer",
",",
"course_key",
")",
":",
"try",
":",
"course",
"=",
"CourseCatalogApiServiceClient",
"(",
"enterprise_customer",
".",
"site",
")",
".",
"get_course_details",
"(",
"course_key",
")",
"except",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.eligible_for_direct_audit_enrollment | Return whether a request is eligible for direct audit enrollment for a particular enterprise customer.
'resource_id' can be either course_run_id or program_uuid.
We check for the following criteria:
- The `audit` query parameter.
- The user's being routed to the course enrollment landin... | enterprise/views.py | def eligible_for_direct_audit_enrollment(self, request, enterprise_customer, resource_id, course_key=None):
"""
Return whether a request is eligible for direct audit enrollment for a particular enterprise customer.
'resource_id' can be either course_run_id or program_uuid.
We check for ... | def eligible_for_direct_audit_enrollment(self, request, enterprise_customer, resource_id, course_key=None):
"""
Return whether a request is eligible for direct audit enrollment for a particular enterprise customer.
'resource_id' can be either course_run_id or program_uuid.
We check for ... | [
"Return",
"whether",
"a",
"request",
"is",
"eligible",
"for",
"direct",
"audit",
"enrollment",
"for",
"a",
"particular",
"enterprise",
"customer",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1686-L1703 | [
"def",
"eligible_for_direct_audit_enrollment",
"(",
"self",
",",
"request",
",",
"enterprise_customer",
",",
"resource_id",
",",
"course_key",
"=",
"None",
")",
":",
"course_identifier",
"=",
"course_key",
"if",
"course_key",
"else",
"resource_id",
"# Return it in one b... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.redirect | Redirects to the appropriate view depending on where the user came from. | enterprise/views.py | def redirect(self, request, *args, **kwargs):
"""
Redirects to the appropriate view depending on where the user came from.
"""
enterprise_customer_uuid, course_run_id, course_key, program_uuid = RouterView.get_path_variables(**kwargs)
resource_id = course_key or course_run_id or ... | def redirect(self, request, *args, **kwargs):
"""
Redirects to the appropriate view depending on where the user came from.
"""
enterprise_customer_uuid, course_run_id, course_key, program_uuid = RouterView.get_path_variables(**kwargs)
resource_id = course_key or course_run_id or ... | [
"Redirects",
"to",
"the",
"appropriate",
"view",
"depending",
"on",
"where",
"the",
"user",
"came",
"from",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1705-L1718 | [
"def",
"redirect",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"enterprise_customer_uuid",
",",
"course_run_id",
",",
"course_key",
",",
"program_uuid",
"=",
"RouterView",
".",
"get_path_variables",
"(",
"*",
"*",
"kwarg... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.get | Run some custom GET logic for Enterprise workflows before routing the user through existing views.
In particular, before routing to existing views:
- If the requested resource is a course, find the current course run for that course,
and make that course run the requested resource instead.
... | enterprise/views.py | def get(self, request, *args, **kwargs):
"""
Run some custom GET logic for Enterprise workflows before routing the user through existing views.
In particular, before routing to existing views:
- If the requested resource is a course, find the current course run for that course,
... | def get(self, request, *args, **kwargs):
"""
Run some custom GET logic for Enterprise workflows before routing the user through existing views.
In particular, before routing to existing views:
- If the requested resource is a course, find the current course run for that course,
... | [
"Run",
"some",
"custom",
"GET",
"logic",
"for",
"Enterprise",
"workflows",
"before",
"routing",
"the",
"user",
"through",
"existing",
"views",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1722-L1775 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"enterprise_customer_uuid",
",",
"course_run_id",
",",
"course_key",
",",
"program_uuid",
"=",
"RouterView",
".",
"get_path_variables",
"(",
"*",
"*",
"kwargs",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | RouterView.post | Run some custom POST logic for Enterprise workflows before routing the user through existing views. | enterprise/views.py | def post(self, request, *args, **kwargs):
"""
Run some custom POST logic for Enterprise workflows before routing the user through existing views.
"""
# pylint: disable=unused-variable
enterprise_customer_uuid, course_run_id, course_key, program_uuid = RouterView.get_path_variable... | def post(self, request, *args, **kwargs):
"""
Run some custom POST logic for Enterprise workflows before routing the user through existing views.
"""
# pylint: disable=unused-variable
enterprise_customer_uuid, course_run_id, course_key, program_uuid = RouterView.get_path_variable... | [
"Run",
"some",
"custom",
"POST",
"logic",
"for",
"Enterprise",
"workflows",
"before",
"routing",
"the",
"user",
"through",
"existing",
"views",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L1778-L1808 | [
"def",
"post",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-variable",
"enterprise_customer_uuid",
",",
"course_run_id",
",",
"course_key",
",",
"program_uuid",
"=",
"RouterView",
".",
"get_path_variab... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | transmit_content_metadata | Task to send content metadata to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests to retrieve content metadata.
channel_code (str): Capitalized identifier for the integrated channel.
channel_pk (str): Primary key for iden... | integrated_channels/integrated_channel/tasks.py | def transmit_content_metadata(username, channel_code, channel_pk):
"""
Task to send content metadata to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests to retrieve content metadata.
channel_code (str): Capitalized identi... | def transmit_content_metadata(username, channel_code, channel_pk):
"""
Task to send content metadata to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests to retrieve content metadata.
channel_code (str): Capitalized identi... | [
"Task",
"to",
"send",
"content",
"metadata",
"to",
"each",
"linked",
"integrated",
"channel",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/tasks.py#L20-L46 | [
"def",
"transmit_content_metadata",
"(",
"username",
",",
"channel_code",
",",
"channel_pk",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"api_user",
"=",
"User",
".",
"objects",
".",
"get",
"(",
"username",
"=",
"username",
")",
"integrated_channe... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | transmit_learner_data | Task to send learner data to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests for learner data.
channel_code (str): Capitalized identifier for the integrated channel
channel_pk (str): Primary key for identifying integrate... | integrated_channels/integrated_channel/tasks.py | def transmit_learner_data(username, channel_code, channel_pk):
"""
Task to send learner data to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests for learner data.
channel_code (str): Capitalized identifier for the integra... | def transmit_learner_data(username, channel_code, channel_pk):
"""
Task to send learner data to each linked integrated channel.
Arguments:
username (str): The username of the User to be used for making API requests for learner data.
channel_code (str): Capitalized identifier for the integra... | [
"Task",
"to",
"send",
"learner",
"data",
"to",
"each",
"linked",
"integrated",
"channel",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/tasks.py#L50-L74 | [
"def",
"transmit_learner_data",
"(",
"username",
",",
"channel_code",
",",
"channel_pk",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"api_user",
"=",
"User",
".",
"objects",
".",
"get",
"(",
"username",
"=",
"username",
")",
"integrated_channel",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | unlink_inactive_learners | Task to unlink inactive learners of provided integrated channel.
Arguments:
channel_code (str): Capitalized identifier for the integrated channel
channel_pk (str): Primary key for identifying integrated channel | integrated_channels/integrated_channel/tasks.py | def unlink_inactive_learners(channel_code, channel_pk):
"""
Task to unlink inactive learners of provided integrated channel.
Arguments:
channel_code (str): Capitalized identifier for the integrated channel
channel_pk (str): Primary key for identifying integrated channel
"""
start =... | def unlink_inactive_learners(channel_code, channel_pk):
"""
Task to unlink inactive learners of provided integrated channel.
Arguments:
channel_code (str): Capitalized identifier for the integrated channel
channel_pk (str): Primary key for identifying integrated channel
"""
start =... | [
"Task",
"to",
"unlink",
"inactive",
"learners",
"of",
"provided",
"integrated",
"channel",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/tasks.py#L78-L100 | [
"def",
"unlink_inactive_learners",
"(",
"channel_code",
",",
"channel_pk",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"integrated_channel",
"=",
"INTEGRATED_CHANNEL_CHOICES",
"[",
"channel_code",
"]",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"ch... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | handle_user_post_save | Handle User model changes - checks if pending enterprise customer user record exists and upgrades it to actual link.
If there are pending enrollments attached to the PendingEnterpriseCustomerUser, then this signal also takes the
newly-created users and enrolls them in the relevant courses. | enterprise/signals.py | def handle_user_post_save(sender, **kwargs): # pylint: disable=unused-argument
"""
Handle User model changes - checks if pending enterprise customer user record exists and upgrades it to actual link.
If there are pending enrollments attached to the PendingEnterpriseCustomerUser, then this signal also take... | def handle_user_post_save(sender, **kwargs): # pylint: disable=unused-argument
"""
Handle User model changes - checks if pending enterprise customer user record exists and upgrades it to actual link.
If there are pending enrollments attached to the PendingEnterpriseCustomerUser, then this signal also take... | [
"Handle",
"User",
"model",
"changes",
"-",
"checks",
"if",
"pending",
"enterprise",
"customer",
"user",
"record",
"exists",
"and",
"upgrades",
"it",
"to",
"actual",
"link",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/signals.py#L28-L78 | [
"def",
"handle_user_post_save",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"created",
"=",
"kwargs",
".",
"get",
"(",
"\"created\"",
",",
"False",
")",
"user_instance",
"=",
"kwargs",
".",
"get",
"(",
"\"instance\"",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | default_content_filter | Set default value for `EnterpriseCustomerCatalog.content_filter` if not already set. | enterprise/signals.py | def default_content_filter(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Set default value for `EnterpriseCustomerCatalog.content_filter` if not already set.
"""
if kwargs['created'] and not instance.content_filter:
instance.content_filter = get_default_catalog_content_f... | def default_content_filter(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Set default value for `EnterpriseCustomerCatalog.content_filter` if not already set.
"""
if kwargs['created'] and not instance.content_filter:
instance.content_filter = get_default_catalog_content_f... | [
"Set",
"default",
"value",
"for",
"EnterpriseCustomerCatalog",
".",
"content_filter",
"if",
"not",
"already",
"set",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/signals.py#L82-L88 | [
"def",
"default_content_filter",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"[",
"'created'",
"]",
"and",
"not",
"instance",
".",
"content_filter",
":",
"instance",
".",
"content_filter",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | assign_enterprise_learner_role | Assign an enterprise learner role to EnterpriseCustomerUser whenever a new record is created. | enterprise/signals.py | def assign_enterprise_learner_role(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Assign an enterprise learner role to EnterpriseCustomerUser whenever a new record is created.
"""
if kwargs['created'] and instance.user:
enterprise_learner_role, __ = SystemWideEnterpriseRo... | def assign_enterprise_learner_role(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Assign an enterprise learner role to EnterpriseCustomerUser whenever a new record is created.
"""
if kwargs['created'] and instance.user:
enterprise_learner_role, __ = SystemWideEnterpriseRo... | [
"Assign",
"an",
"enterprise",
"learner",
"role",
"to",
"EnterpriseCustomerUser",
"whenever",
"a",
"new",
"record",
"is",
"created",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/signals.py#L92-L101 | [
"def",
"assign_enterprise_learner_role",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"kwargs",
"[",
"'created'",
"]",
"and",
"instance",
".",
"user",
":",
"enterprise_learner_role",
",",
"__",
"=",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | delete_enterprise_learner_role_assignment | Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record. | enterprise/signals.py | def delete_enterprise_learner_role_assignment(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.
"""
if instance.user:
enterprise_learner_role, __ = SystemWideEnter... | def delete_enterprise_learner_role_assignment(sender, instance, **kwargs): # pylint: disable=unused-argument
"""
Delete the associated enterprise learner role assignment record when deleting an EnterpriseCustomerUser record.
"""
if instance.user:
enterprise_learner_role, __ = SystemWideEnter... | [
"Delete",
"the",
"associated",
"enterprise",
"learner",
"role",
"assignment",
"record",
"when",
"deleting",
"an",
"EnterpriseCustomerUser",
"record",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/signals.py#L105-L118 | [
"def",
"delete_enterprise_learner_role_assignment",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=unused-argument",
"if",
"instance",
".",
"user",
":",
"enterprise_learner_role",
",",
"__",
"=",
"SystemWideEnterpriseRole",
".",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | enterprise_customer_required | Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
PermissionDenied error if an EnterpriseCustomer cannot b... | enterprise/api/v1/decorators.py | def enterprise_customer_required(view):
"""
Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
Perm... | def enterprise_customer_required(view):
"""
Ensure the user making the API request is associated with an EnterpriseCustomer.
This decorator attempts to find an EnterpriseCustomer associated with the requesting
user and passes that EnterpriseCustomer to the view as a parameter. It will return a
Perm... | [
"Ensure",
"the",
"user",
"making",
"the",
"API",
"request",
"is",
"associated",
"with",
"an",
"EnterpriseCustomer",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/decorators.py#L14-L52 | [
"def",
"enterprise_customer_required",
"(",
"view",
")",
":",
"@",
"wraps",
"(",
"view",
")",
"def",
"wrapper",
"(",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"\n Checks for an enterprise customer associated with the user, calls the ... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | require_at_least_one_query_parameter | Ensure at least one of the specified query parameters are included in the request.
This decorator checks for the existence of at least one of the specified query
parameters and passes the values as function parameters to the decorated view.
If none of the specified query parameters are included in the requ... | enterprise/api/v1/decorators.py | def require_at_least_one_query_parameter(*query_parameter_names):
"""
Ensure at least one of the specified query parameters are included in the request.
This decorator checks for the existence of at least one of the specified query
parameters and passes the values as function parameters to the decorate... | def require_at_least_one_query_parameter(*query_parameter_names):
"""
Ensure at least one of the specified query parameters are included in the request.
This decorator checks for the existence of at least one of the specified query
parameters and passes the values as function parameters to the decorate... | [
"Ensure",
"at",
"least",
"one",
"of",
"the",
"specified",
"query",
"parameters",
"are",
"included",
"in",
"the",
"request",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/decorators.py#L55-L91 | [
"def",
"require_at_least_one_query_parameter",
"(",
"*",
"query_parameter_names",
")",
":",
"def",
"outer_wrapper",
"(",
"view",
")",
":",
"\"\"\" Allow the passing of parameters to require_at_least_one_query_parameter. \"\"\"",
"@",
"wraps",
"(",
"view",
")",
"def",
"wrapper... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command.handle | Transmit the courseware data for the EnterpriseCustomer(s) to the active integration channels. | integrated_channels/integrated_channel/management/commands/transmit_content_metadata.py | def handle(self, *args, **options):
"""
Transmit the courseware data for the EnterpriseCustomer(s) to the active integration channels.
"""
username = options['catalog_user']
# Before we do a whole bunch of database queries, make sure that the user we were passed exists.
... | def handle(self, *args, **options):
"""
Transmit the courseware data for the EnterpriseCustomer(s) to the active integration channels.
"""
username = options['catalog_user']
# Before we do a whole bunch of database queries, make sure that the user we were passed exists.
... | [
"Transmit",
"the",
"courseware",
"data",
"for",
"the",
"EnterpriseCustomer",
"(",
"s",
")",
"to",
"the",
"active",
"integration",
"channels",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/transmit_content_metadata.py#L37-L54 | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"username",
"=",
"options",
"[",
"'catalog_user'",
"]",
"# Before we do a whole bunch of database queries, make sure that the user we were passed exists.",
"try",
":",
"User",
".",
"ob... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | create_roles | Create the enterprise roles if they do not already exist. | enterprise/migrations/0062_add_system_wide_enterprise_roles.py | def create_roles(apps, schema_editor):
"""Create the enterprise roles if they do not already exist."""
SystemWideEnterpriseRole = apps.get_model('enterprise', 'SystemWideEnterpriseRole')
SystemWideEnterpriseRole.objects.update_or_create(name=ENTERPRISE_ADMIN_ROLE)
SystemWideEnterpriseRole.objects.update... | def create_roles(apps, schema_editor):
"""Create the enterprise roles if they do not already exist."""
SystemWideEnterpriseRole = apps.get_model('enterprise', 'SystemWideEnterpriseRole')
SystemWideEnterpriseRole.objects.update_or_create(name=ENTERPRISE_ADMIN_ROLE)
SystemWideEnterpriseRole.objects.update... | [
"Create",
"the",
"enterprise",
"roles",
"if",
"they",
"do",
"not",
"already",
"exist",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/migrations/0062_add_system_wide_enterprise_roles.py#L9-L13 | [
"def",
"create_roles",
"(",
"apps",
",",
"schema_editor",
")",
":",
"SystemWideEnterpriseRole",
"=",
"apps",
".",
"get_model",
"(",
"'enterprise'",
",",
"'SystemWideEnterpriseRole'",
")",
"SystemWideEnterpriseRole",
".",
"objects",
".",
"update_or_create",
"(",
"name"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | delete_roles | Delete the enterprise roles. | enterprise/migrations/0062_add_system_wide_enterprise_roles.py | def delete_roles(apps, schema_editor):
"""Delete the enterprise roles."""
SystemWideEnterpriseRole = apps.get_model('enterprise', 'SystemWideEnterpriseRole')
SystemWideEnterpriseRole.objects.filter(
name__in=[ENTERPRISE_ADMIN_ROLE, ENTERPRISE_LEARNER_ROLE]
).delete() | def delete_roles(apps, schema_editor):
"""Delete the enterprise roles."""
SystemWideEnterpriseRole = apps.get_model('enterprise', 'SystemWideEnterpriseRole')
SystemWideEnterpriseRole.objects.filter(
name__in=[ENTERPRISE_ADMIN_ROLE, ENTERPRISE_LEARNER_ROLE]
).delete() | [
"Delete",
"the",
"enterprise",
"roles",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/migrations/0062_add_system_wide_enterprise_roles.py#L16-L21 | [
"def",
"delete_roles",
"(",
"apps",
",",
"schema_editor",
")",
":",
"SystemWideEnterpriseRole",
"=",
"apps",
".",
"get_model",
"(",
"'enterprise'",
",",
"'SystemWideEnterpriseRole'",
")",
"SystemWideEnterpriseRole",
".",
"objects",
".",
"filter",
"(",
"name__in",
"=... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._get_enterprise_admin_users_batch | Returns a batched queryset of User objects. | enterprise/management/commands/assign_enterprise_user_roles.py | def _get_enterprise_admin_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise admin users from indexes: %s to %s', start, end)
return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GROUP, is... | def _get_enterprise_admin_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise admin users from indexes: %s to %s', start, end)
return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GROUP, is... | [
"Returns",
"a",
"batched",
"queryset",
"of",
"User",
"objects",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L92-L97 | [
"def",
"_get_enterprise_admin_users_batch",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Fetching new batch of enterprise admin users from indexes: %s to %s'",
",",
"start",
",",
"end",
")",
"return",
"User",
".",
"objects",
".",
"f... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._get_enterprise_operator_users_batch | Returns a batched queryset of User objects. | enterprise/management/commands/assign_enterprise_user_roles.py | def _get_enterprise_operator_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise operator users from indexes: %s to %s', start, end)
return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GRO... | def _get_enterprise_operator_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise operator users from indexes: %s to %s', start, end)
return User.objects.filter(groups__name=ENTERPRISE_DATA_API_ACCESS_GRO... | [
"Returns",
"a",
"batched",
"queryset",
"of",
"User",
"objects",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L99-L104 | [
"def",
"_get_enterprise_operator_users_batch",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Fetching new batch of enterprise operator users from indexes: %s to %s'",
",",
"start",
",",
"end",
")",
"return",
"User",
".",
"objects",
"."... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._get_enterprise_customer_users_batch | Returns a batched queryset of EnterpriseCustomerUser objects. | enterprise/management/commands/assign_enterprise_user_roles.py | def _get_enterprise_customer_users_batch(self, start, end):
"""
Returns a batched queryset of EnterpriseCustomerUser objects.
"""
LOGGER.info('Fetching new batch of enterprise customer users from indexes: %s to %s', start, end)
return User.objects.filter(pk__in=self._get_enterpri... | def _get_enterprise_customer_users_batch(self, start, end):
"""
Returns a batched queryset of EnterpriseCustomerUser objects.
"""
LOGGER.info('Fetching new batch of enterprise customer users from indexes: %s to %s', start, end)
return User.objects.filter(pk__in=self._get_enterpri... | [
"Returns",
"a",
"batched",
"queryset",
"of",
"EnterpriseCustomerUser",
"objects",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L106-L111 | [
"def",
"_get_enterprise_customer_users_batch",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Fetching new batch of enterprise customer users from indexes: %s to %s'",
",",
"start",
",",
"end",
")",
"return",
"User",
".",
"objects",
"."... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._get_enterprise_enrollment_api_admin_users_batch | Returns a batched queryset of User objects. | enterprise/management/commands/assign_enterprise_user_roles.py | def _get_enterprise_enrollment_api_admin_users_batch(self, start, end): # pylint: disable=invalid-name
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise enrollment admin users from indexes: %s to %s', start, end)
return User.obj... | def _get_enterprise_enrollment_api_admin_users_batch(self, start, end): # pylint: disable=invalid-name
"""
Returns a batched queryset of User objects.
"""
LOGGER.info('Fetching new batch of enterprise enrollment admin users from indexes: %s to %s', start, end)
return User.obj... | [
"Returns",
"a",
"batched",
"queryset",
"of",
"User",
"objects",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L113-L118 | [
"def",
"_get_enterprise_enrollment_api_admin_users_batch",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"# pylint: disable=invalid-name",
"LOGGER",
".",
"info",
"(",
"'Fetching new batch of enterprise enrollment admin users from indexes: %s to %s'",
",",
"start",
",",
"end"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._get_enterprise_catalog_admin_users_batch | Returns a batched queryset of User objects. | enterprise/management/commands/assign_enterprise_user_roles.py | def _get_enterprise_catalog_admin_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
Application = apps.get_model(OAUTH2_PROVIDER_APPLICATION_MODEL) # pylint: disable=invalid-name
LOGGER.info('Fetching new batch of enterprise catalog admin user... | def _get_enterprise_catalog_admin_users_batch(self, start, end):
"""
Returns a batched queryset of User objects.
"""
Application = apps.get_model(OAUTH2_PROVIDER_APPLICATION_MODEL) # pylint: disable=invalid-name
LOGGER.info('Fetching new batch of enterprise catalog admin user... | [
"Returns",
"a",
"batched",
"queryset",
"of",
"User",
"objects",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L120-L129 | [
"def",
"_get_enterprise_catalog_admin_users_batch",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"Application",
"=",
"apps",
".",
"get_model",
"(",
"OAUTH2_PROVIDER_APPLICATION_MODEL",
")",
"# pylint: disable=invalid-name",
"LOGGER",
".",
"info",
"(",
"'Fetching new... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command._assign_enterprise_role_to_users | Assigns enterprise role to users. | enterprise/management/commands/assign_enterprise_user_roles.py | def _assign_enterprise_role_to_users(self, _get_batch_method, options, is_feature_role=False):
"""
Assigns enterprise role to users.
"""
role_name = options['role']
batch_limit = options['batch_limit']
batch_sleep = options['batch_sleep']
batch_offset = options['b... | def _assign_enterprise_role_to_users(self, _get_batch_method, options, is_feature_role=False):
"""
Assigns enterprise role to users.
"""
role_name = options['role']
batch_limit = options['batch_limit']
batch_sleep = options['batch_sleep']
batch_offset = options['b... | [
"Assigns",
"enterprise",
"role",
"to",
"users",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L131-L171 | [
"def",
"_assign_enterprise_role_to_users",
"(",
"self",
",",
"_get_batch_method",
",",
"options",
",",
"is_feature_role",
"=",
"False",
")",
":",
"role_name",
"=",
"options",
"[",
"'role'",
"]",
"batch_limit",
"=",
"options",
"[",
"'batch_limit'",
"]",
"batch_slee... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | Command.handle | Entry point for managment command execution. | enterprise/management/commands/assign_enterprise_user_roles.py | def handle(self, *args, **options):
"""
Entry point for managment command execution.
"""
LOGGER.info('Starting assigning enterprise roles to users!')
role = options['role']
if role == ENTERPRISE_ADMIN_ROLE:
# Assign admin role to non-staff users with enterpri... | def handle(self, *args, **options):
"""
Entry point for managment command execution.
"""
LOGGER.info('Starting assigning enterprise roles to users!')
role = options['role']
if role == ENTERPRISE_ADMIN_ROLE:
# Assign admin role to non-staff users with enterpri... | [
"Entry",
"point",
"for",
"managment",
"command",
"execution",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/management/commands/assign_enterprise_user_roles.py#L173-L201 | [
"def",
"handle",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"options",
")",
":",
"LOGGER",
".",
"info",
"(",
"'Starting assigning enterprise roles to users!'",
")",
"role",
"=",
"options",
"[",
"'role'",
"]",
"if",
"role",
"==",
"ENTERPRISE_ADMIN_ROLE",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | DegreedLearnerTransmitter.transmit | Send a completion status call to Degreed using the client.
Args:
payload: The learner completion data payload to send to Degreed | integrated_channels/degreed/transmitters/learner_data.py | def transmit(self, payload, **kwargs):
"""
Send a completion status call to Degreed using the client.
Args:
payload: The learner completion data payload to send to Degreed
"""
kwargs['app_label'] = 'degreed'
kwargs['model_name'] = 'DegreedLearnerDataTransmiss... | def transmit(self, payload, **kwargs):
"""
Send a completion status call to Degreed using the client.
Args:
payload: The learner completion data payload to send to Degreed
"""
kwargs['app_label'] = 'degreed'
kwargs['model_name'] = 'DegreedLearnerDataTransmiss... | [
"Send",
"a",
"completion",
"status",
"call",
"to",
"Degreed",
"using",
"the",
"client",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/transmitters/learner_data.py#L27-L37 | [
"def",
"transmit",
"(",
"self",
",",
"payload",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"'app_label'",
"]",
"=",
"'degreed'",
"kwargs",
"[",
"'model_name'",
"]",
"=",
"'DegreedLearnerDataTransmissionAudit'",
"kwargs",
"[",
"'remote_user_id'",
"]",
"=... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | get_enterprise_customer_for_running_pipeline | Get the EnterpriseCustomer associated with a running pipeline. | enterprise/tpa_pipeline.py | def get_enterprise_customer_for_running_pipeline(request, pipeline): # pylint: disable=invalid-name
"""
Get the EnterpriseCustomer associated with a running pipeline.
"""
sso_provider_id = request.GET.get('tpa_hint')
if pipeline:
sso_provider_id = Registry.get_from_pipeline(pipeline).provid... | def get_enterprise_customer_for_running_pipeline(request, pipeline): # pylint: disable=invalid-name
"""
Get the EnterpriseCustomer associated with a running pipeline.
"""
sso_provider_id = request.GET.get('tpa_hint')
if pipeline:
sso_provider_id = Registry.get_from_pipeline(pipeline).provid... | [
"Get",
"the",
"EnterpriseCustomer",
"associated",
"with",
"a",
"running",
"pipeline",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/tpa_pipeline.py#L24-L31 | [
"def",
"get_enterprise_customer_for_running_pipeline",
"(",
"request",
",",
"pipeline",
")",
":",
"# pylint: disable=invalid-name",
"sso_provider_id",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'tpa_hint'",
")",
"if",
"pipeline",
":",
"sso_provider_id",
"=",
"Regis... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | handle_enterprise_logistration | Perform the linking of user in the process of logging to the Enterprise Customer.
Args:
backend: The class handling the SSO interaction (SAML, OAuth, etc)
user: The user object in the process of being logged in with
**kwargs: Any remaining pipeline variables | enterprise/tpa_pipeline.py | def handle_enterprise_logistration(backend, user, **kwargs):
"""
Perform the linking of user in the process of logging to the Enterprise Customer.
Args:
backend: The class handling the SSO interaction (SAML, OAuth, etc)
user: The user object in the process of being logged in with
**... | def handle_enterprise_logistration(backend, user, **kwargs):
"""
Perform the linking of user in the process of logging to the Enterprise Customer.
Args:
backend: The class handling the SSO interaction (SAML, OAuth, etc)
user: The user object in the process of being logged in with
**... | [
"Perform",
"the",
"linking",
"of",
"user",
"in",
"the",
"process",
"of",
"logging",
"to",
"the",
"Enterprise",
"Customer",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/tpa_pipeline.py#L47-L74 | [
"def",
"handle_enterprise_logistration",
"(",
"backend",
",",
"user",
",",
"*",
"*",
"kwargs",
")",
":",
"request",
"=",
"backend",
".",
"strategy",
".",
"request",
"enterprise_customer",
"=",
"get_enterprise_customer_for_running_pipeline",
"(",
"request",
",",
"{",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | get_user_from_social_auth | Find the LMS user from the LMS model `UserSocialAuth`.
Arguments:
tpa_provider (third_party_auth.provider): third party auth provider object
tpa_username (str): Username returned by the third party auth | enterprise/tpa_pipeline.py | def get_user_from_social_auth(tpa_provider, tpa_username):
"""
Find the LMS user from the LMS model `UserSocialAuth`.
Arguments:
tpa_provider (third_party_auth.provider): third party auth provider object
tpa_username (str): Username returned by the third party auth
"""
user_social_... | def get_user_from_social_auth(tpa_provider, tpa_username):
"""
Find the LMS user from the LMS model `UserSocialAuth`.
Arguments:
tpa_provider (third_party_auth.provider): third party auth provider object
tpa_username (str): Username returned by the third party auth
"""
user_social_... | [
"Find",
"the",
"LMS",
"user",
"from",
"the",
"LMS",
"model",
"UserSocialAuth",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/tpa_pipeline.py#L77-L90 | [
"def",
"get_user_from_social_auth",
"(",
"tpa_provider",
",",
"tpa_username",
")",
":",
"user_social_auth",
"=",
"UserSocialAuth",
".",
"objects",
".",
"select_related",
"(",
"'user'",
")",
".",
"filter",
"(",
"user__username",
"=",
"tpa_username",
",",
"provider",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient.get_oauth_access_token | Retrieves OAuth 2.0 access token using the client credentials grant.
Args:
url_base (str): Oauth2 access token endpoint
client_id (str): client ID
client_secret (str): client secret
company_id (str): SAP company ID
user_id (str): SAP user ID
... | integrated_channels/sap_success_factors/client.py | def get_oauth_access_token(url_base, client_id, client_secret, company_id, user_id, user_type):
""" Retrieves OAuth 2.0 access token using the client credentials grant.
Args:
url_base (str): Oauth2 access token endpoint
client_id (str): client ID
client_secret (str):... | def get_oauth_access_token(url_base, client_id, client_secret, company_id, user_id, user_type):
""" Retrieves OAuth 2.0 access token using the client credentials grant.
Args:
url_base (str): Oauth2 access token endpoint
client_id (str): client ID
client_secret (str):... | [
"Retrieves",
"OAuth",
"2",
".",
"0",
"access",
"token",
"using",
"the",
"client",
"credentials",
"grant",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L33-L77 | [
"def",
"get_oauth_access_token",
"(",
"url_base",
",",
"client_id",
",",
"client_secret",
",",
"company_id",
",",
"user_id",
",",
"user_type",
")",
":",
"SAPSuccessFactorsGlobalConfiguration",
"=",
"apps",
".",
"get_model",
"(",
"# pylint: disable=invalid-name",
"'sap_s... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient._create_session | Instantiate a new session object for use in connecting with SAP SuccessFactors | integrated_channels/sap_success_factors/client.py | def _create_session(self):
"""
Instantiate a new session object for use in connecting with SAP SuccessFactors
"""
session = requests.Session()
session.timeout = self.SESSION_TIMEOUT
oauth_access_token, expires_at = SAPSuccessFactorsAPIClient.get_oauth_access_token(
... | def _create_session(self):
"""
Instantiate a new session object for use in connecting with SAP SuccessFactors
"""
session = requests.Session()
session.timeout = self.SESSION_TIMEOUT
oauth_access_token, expires_at = SAPSuccessFactorsAPIClient.get_oauth_access_token(
... | [
"Instantiate",
"a",
"new",
"session",
"object",
"for",
"use",
"in",
"connecting",
"with",
"SAP",
"SuccessFactors"
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L91-L110 | [
"def",
"_create_session",
"(",
"self",
")",
":",
"session",
"=",
"requests",
".",
"Session",
"(",
")",
"session",
".",
"timeout",
"=",
"self",
".",
"SESSION_TIMEOUT",
"oauth_access_token",
",",
"expires_at",
"=",
"SAPSuccessFactorsAPIClient",
".",
"get_oauth_acces... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient.create_course_completion | Send a completion status payload to the SuccessFactors OCN Completion Status endpoint
Args:
user_id (str): The sap user id that the completion status is being sent for.
payload (str): JSON encoded object (serialized from SapSuccessFactorsLearnerDataTransmissionAudit)
con... | integrated_channels/sap_success_factors/client.py | def create_course_completion(self, user_id, payload):
"""
Send a completion status payload to the SuccessFactors OCN Completion Status endpoint
Args:
user_id (str): The sap user id that the completion status is being sent for.
payload (str): JSON encoded object (serializ... | def create_course_completion(self, user_id, payload):
"""
Send a completion status payload to the SuccessFactors OCN Completion Status endpoint
Args:
user_id (str): The sap user id that the completion status is being sent for.
payload (str): JSON encoded object (serializ... | [
"Send",
"a",
"completion",
"status",
"payload",
"to",
"the",
"SuccessFactors",
"OCN",
"Completion",
"Status",
"endpoint"
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L112-L127 | [
"def",
"create_course_completion",
"(",
"self",
",",
"user_id",
",",
"payload",
")",
":",
"url",
"=",
"self",
".",
"enterprise_configuration",
".",
"sapsf_base_url",
"+",
"self",
".",
"global_sap_config",
".",
"completion_status_api_path",
"return",
"self",
".",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient._sync_content_metadata | Create/update/delete content metadata records using the SuccessFactors OCN Course Import API endpoint.
Arguments:
serialized_data: Serialized JSON string representing a list of content metadata items.
Raises:
ClientError: If SuccessFactors API call fails. | integrated_channels/sap_success_factors/client.py | def _sync_content_metadata(self, serialized_data):
"""
Create/update/delete content metadata records using the SuccessFactors OCN Course Import API endpoint.
Arguments:
serialized_data: Serialized JSON string representing a list of content metadata items.
Raises:
... | def _sync_content_metadata(self, serialized_data):
"""
Create/update/delete content metadata records using the SuccessFactors OCN Course Import API endpoint.
Arguments:
serialized_data: Serialized JSON string representing a list of content metadata items.
Raises:
... | [
"Create",
"/",
"update",
"/",
"delete",
"content",
"metadata",
"records",
"using",
"the",
"SuccessFactors",
"OCN",
"Course",
"Import",
"API",
"endpoint",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L165-L192 | [
"def",
"_sync_content_metadata",
"(",
"self",
",",
"serialized_data",
")",
":",
"url",
"=",
"self",
".",
"enterprise_configuration",
".",
"sapsf_base_url",
"+",
"self",
".",
"global_sap_config",
".",
"course_api_path",
"try",
":",
"status_code",
",",
"response_body"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient._call_post_with_user_override | Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.
Args:
sap_user_id (str): The user to use to retrieve an auth token.
url (str): The url to post to.
payload (str): The json encoded payload to post. | integrated_channels/sap_success_factors/client.py | def _call_post_with_user_override(self, sap_user_id, url, payload):
"""
Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.
Args:
sap_user_id (str): The user to use to retrieve an auth token.
url (str): The url to post to.
... | def _call_post_with_user_override(self, sap_user_id, url, payload):
"""
Make a post request with an auth token acquired for a specific user to a SuccessFactors endpoint.
Args:
sap_user_id (str): The user to use to retrieve an auth token.
url (str): The url to post to.
... | [
"Make",
"a",
"post",
"request",
"with",
"an",
"auth",
"token",
"acquired",
"for",
"a",
"specific",
"user",
"to",
"a",
"SuccessFactors",
"endpoint",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L194-L225 | [
"def",
"_call_post_with_user_override",
"(",
"self",
",",
"sap_user_id",
",",
"url",
",",
"payload",
")",
":",
"SAPSuccessFactorsEnterpriseCustomerConfiguration",
"=",
"apps",
".",
"get_model",
"(",
"# pylint: disable=invalid-name",
"'sap_success_factors'",
",",
"'SAPSucces... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient._call_post_with_session | Make a post request using the session object to a SuccessFactors endpoint.
Args:
url (str): The url to post to.
payload (str): The json encoded payload to post. | integrated_channels/sap_success_factors/client.py | def _call_post_with_session(self, url, payload):
"""
Make a post request using the session object to a SuccessFactors endpoint.
Args:
url (str): The url to post to.
payload (str): The json encoded payload to post.
"""
now = datetime.datetime.utcnow()
... | def _call_post_with_session(self, url, payload):
"""
Make a post request using the session object to a SuccessFactors endpoint.
Args:
url (str): The url to post to.
payload (str): The json encoded payload to post.
"""
now = datetime.datetime.utcnow()
... | [
"Make",
"a",
"post",
"request",
"using",
"the",
"session",
"object",
"to",
"a",
"SuccessFactors",
"endpoint",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L227-L241 | [
"def",
"_call_post_with_session",
"(",
"self",
",",
"url",
",",
"payload",
")",
":",
"now",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"if",
"now",
">=",
"self",
".",
"expires_at",
":",
"# Create a new session with a valid token",
"self",
".",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient.get_inactive_sap_learners | Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.
Example:
sap_search_student_url: "/learning/odatav4/searchStudent/v1/Students?
$filter=criteria/isActive eq False&$select=studentID"
SAP API response: {
u'@od... | integrated_channels/sap_success_factors/client.py | def get_inactive_sap_learners(self):
"""
Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.
Example:
sap_search_student_url: "/learning/odatav4/searchStudent/v1/Students?
$filter=criteria/isActive eq False&$select=studentI... | def get_inactive_sap_learners(self):
"""
Make a GET request using the session object to a SuccessFactors endpoint for inactive learners.
Example:
sap_search_student_url: "/learning/odatav4/searchStudent/v1/Students?
$filter=criteria/isActive eq False&$select=studentI... | [
"Make",
"a",
"GET",
"request",
"using",
"the",
"session",
"object",
"to",
"a",
"SuccessFactors",
"endpoint",
"for",
"inactive",
"learners",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L243-L290 | [
"def",
"get_inactive_sap_learners",
"(",
"self",
")",
":",
"now",
"=",
"datetime",
".",
"datetime",
".",
"utcnow",
"(",
")",
"if",
"now",
">=",
"self",
".",
"expires_at",
":",
"# Create a new session with a valid token",
"self",
".",
"session",
".",
"close",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | SAPSuccessFactorsAPIClient._call_search_students_recursively | Make recursive GET calls to traverse the paginated API response for search students. | integrated_channels/sap_success_factors/client.py | def _call_search_students_recursively(self, sap_search_student_url, all_inactive_learners, page_size, start_at):
"""
Make recursive GET calls to traverse the paginated API response for search students.
"""
search_student_paginated_url = '{sap_search_student_url}&{pagination_criterion}'.f... | def _call_search_students_recursively(self, sap_search_student_url, all_inactive_learners, page_size, start_at):
"""
Make recursive GET calls to traverse the paginated API response for search students.
"""
search_student_paginated_url = '{sap_search_student_url}&{pagination_criterion}'.f... | [
"Make",
"recursive",
"GET",
"calls",
"to",
"traverse",
"the",
"paginated",
"API",
"response",
"for",
"search",
"students",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/client.py#L292-L334 | [
"def",
"_call_search_students_recursively",
"(",
"self",
",",
"sap_search_student_url",
",",
"all_inactive_learners",
",",
"page_size",
",",
"start_at",
")",
":",
"search_student_paginated_url",
"=",
"'{sap_search_student_url}&{pagination_criterion}'",
".",
"format",
"(",
"sa... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | UserFilterBackend.filter_queryset | Filter only for the user's ID if non-staff. | enterprise/api/filters.py | def filter_queryset(self, request, queryset, view):
"""
Filter only for the user's ID if non-staff.
"""
if not request.user.is_staff:
filter_kwargs = {view.USER_ID_FILTER: request.user.id}
queryset = queryset.filter(**filter_kwargs)
return queryset | def filter_queryset(self, request, queryset, view):
"""
Filter only for the user's ID if non-staff.
"""
if not request.user.is_staff:
filter_kwargs = {view.USER_ID_FILTER: request.user.id}
queryset = queryset.filter(**filter_kwargs)
return queryset | [
"Filter",
"only",
"for",
"the",
"user",
"s",
"ID",
"if",
"non",
"-",
"staff",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/filters.py#L23-L30 | [
"def",
"filter_queryset",
"(",
"self",
",",
"request",
",",
"queryset",
",",
"view",
")",
":",
"if",
"not",
"request",
".",
"user",
".",
"is_staff",
":",
"filter_kwargs",
"=",
"{",
"view",
".",
"USER_ID_FILTER",
":",
"request",
".",
"user",
".",
"id",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerUserFilterBackend.filter_queryset | Apply incoming filters only if user is staff. If not, only filter by user's ID. | enterprise/api/filters.py | def filter_queryset(self, request, queryset, view):
"""
Apply incoming filters only if user is staff. If not, only filter by user's ID.
"""
if request.user.is_staff:
email = request.query_params.get('email', None)
username = request.query_params.get('username', No... | def filter_queryset(self, request, queryset, view):
"""
Apply incoming filters only if user is staff. If not, only filter by user's ID.
"""
if request.user.is_staff:
email = request.query_params.get('email', None)
username = request.query_params.get('username', No... | [
"Apply",
"incoming",
"filters",
"only",
"if",
"user",
"is",
"staff",
".",
"If",
"not",
"only",
"filter",
"by",
"user",
"s",
"ID",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/filters.py#L38-L57 | [
"def",
"filter_queryset",
"(",
"self",
",",
"request",
",",
"queryset",
",",
"view",
")",
":",
"if",
"request",
".",
"user",
".",
"is_staff",
":",
"email",
"=",
"request",
".",
"query_params",
".",
"get",
"(",
"'email'",
",",
"None",
")",
"username",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | LearnerTransmitter.transmit | Send a completion status call to the integrated channel using the client.
Args:
payload: The learner completion data payload to send to the integrated channel.
kwargs: Contains integrated channel-specific information for customized transmission variables.
- app_label: Th... | integrated_channels/integrated_channel/transmitters/learner_data.py | def transmit(self, payload, **kwargs):
"""
Send a completion status call to the integrated channel using the client.
Args:
payload: The learner completion data payload to send to the integrated channel.
kwargs: Contains integrated channel-specific information for customi... | def transmit(self, payload, **kwargs):
"""
Send a completion status call to the integrated channel using the client.
Args:
payload: The learner completion data payload to send to the integrated channel.
kwargs: Contains integrated channel-specific information for customi... | [
"Send",
"a",
"completion",
"status",
"call",
"to",
"the",
"integrated",
"channel",
"using",
"the",
"client",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/learner_data.py#L37-L95 | [
"def",
"transmit",
"(",
"self",
",",
"payload",
",",
"*",
"*",
"kwargs",
")",
":",
"IntegratedChannelLearnerDataTransmissionAudit",
"=",
"apps",
".",
"get_model",
"(",
"# pylint: disable=invalid-name",
"app_label",
"=",
"kwargs",
".",
"get",
"(",
"'app_label'",
",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | LearnerTransmitter.handle_transmission_error | Handle the case where the transmission fails. | integrated_channels/integrated_channel/transmitters/learner_data.py | def handle_transmission_error(self, learner_data, request_exception):
"""Handle the case where the transmission fails."""
try:
sys_msg = request_exception.response.content
except AttributeError:
sys_msg = 'Not available'
LOGGER.error(
(
... | def handle_transmission_error(self, learner_data, request_exception):
"""Handle the case where the transmission fails."""
try:
sys_msg = request_exception.response.content
except AttributeError:
sys_msg = 'Not available'
LOGGER.error(
(
... | [
"Handle",
"the",
"case",
"where",
"the",
"transmission",
"fails",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/transmitters/learner_data.py#L97-L114 | [
"def",
"handle_transmission_error",
"(",
"self",
",",
"learner_data",
",",
"request_exception",
")",
":",
"try",
":",
"sys_msg",
"=",
"request_exception",
".",
"response",
".",
"content",
"except",
"AttributeError",
":",
"sys_msg",
"=",
"'Not available'",
"LOGGER",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | add_missing_price_information_message | Add a message to the Django messages store indicating that we failed to retrieve price information about an item.
:param request: The current request.
:param item: The item for which price information is missing. Example: a program title, or a course. | enterprise/messages.py | def add_missing_price_information_message(request, item):
"""
Add a message to the Django messages store indicating that we failed to retrieve price information about an item.
:param request: The current request.
:param item: The item for which price information is missing. Example: a program title, or... | def add_missing_price_information_message(request, item):
"""
Add a message to the Django messages store indicating that we failed to retrieve price information about an item.
:param request: The current request.
:param item: The item for which price information is missing. Example: a program title, or... | [
"Add",
"a",
"message",
"to",
"the",
"Django",
"messages",
"store",
"indicating",
"that",
"we",
"failed",
"to",
"retrieve",
"price",
"information",
"about",
"an",
"item",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L47-L74 | [
"def",
"add_missing_price_information_message",
"(",
"request",
",",
"item",
")",
":",
"messages",
".",
"warning",
"(",
"request",
",",
"_",
"(",
"'{strong_start}We could not gather price information for {em_start}{item}{em_end}.{strong_end} '",
"'{span_start}If you continue to hav... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | add_unenrollable_item_message | Add a message to the Django message store indicating that the item (i.e. course run, program) is unenrollable.
:param request: The current request.
:param item: The item that is unenrollable (i.e. a course run). | enterprise/messages.py | def add_unenrollable_item_message(request, item):
"""
Add a message to the Django message store indicating that the item (i.e. course run, program) is unenrollable.
:param request: The current request.
:param item: The item that is unenrollable (i.e. a course run).
"""
messages.info(
re... | def add_unenrollable_item_message(request, item):
"""
Add a message to the Django message store indicating that the item (i.e. course run, program) is unenrollable.
:param request: The current request.
:param item: The item that is unenrollable (i.e. a course run).
"""
messages.info(
re... | [
"Add",
"a",
"message",
"to",
"the",
"Django",
"message",
"store",
"indicating",
"that",
"the",
"item",
"(",
"i",
".",
"e",
".",
"course",
"run",
"program",
")",
"is",
"unenrollable",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L77-L97 | [
"def",
"add_unenrollable_item_message",
"(",
"request",
",",
"item",
")",
":",
"messages",
".",
"info",
"(",
"request",
",",
"_",
"(",
"'{strong_start}Something happened.{strong_end} '",
"'{span_start}This {item} is not currently open to new learners. Please start over and select a... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | add_generic_info_message_for_error | Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request. | enterprise/messages.py | def add_generic_info_message_for_error(request):
"""
Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request.
"""
messages.info(
request,
_(
'{strong_start}Something happened.{strong_end} '
... | def add_generic_info_message_for_error(request):
"""
Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request.
"""
messages.info(
request,
_(
'{strong_start}Something happened.{strong_end} '
... | [
"Add",
"message",
"to",
"request",
"indicating",
"that",
"there",
"was",
"an",
"issue",
"processing",
"request",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L100-L120 | [
"def",
"add_generic_info_message_for_error",
"(",
"request",
")",
":",
"messages",
".",
"info",
"(",
"request",
",",
"_",
"(",
"'{strong_start}Something happened.{strong_end} '",
"'{span_start}This course link is currently invalid. '",
"'Please reach out to your Administrator for ass... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | add_generic_error_message_with_code | Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request.
error_code: A string error code to be used to point devs to the spot in
the code where this error occurred. | enterprise/messages.py | def add_generic_error_message_with_code(request, error_code):
"""
Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request.
error_code: A string error code to be used to point devs to the spot in
the code where... | def add_generic_error_message_with_code(request, error_code):
"""
Add message to request indicating that there was an issue processing request.
Arguments:
request: The current request.
error_code: A string error code to be used to point devs to the spot in
the code where... | [
"Add",
"message",
"to",
"request",
"indicating",
"that",
"there",
"was",
"an",
"issue",
"processing",
"request",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/messages.py#L123-L147 | [
"def",
"add_generic_error_message_with_code",
"(",
"request",
",",
"error_code",
")",
":",
"messages",
".",
"error",
"(",
"request",
",",
"_",
"(",
"'{strong_start}Something happened.{strong_end} '",
"'{span_start}Please reach out to your learning administrator with '",
"'the fol... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | validate_image_extension | Validate that a particular image extension. | enterprise/validators.py | def validate_image_extension(value):
"""
Validate that a particular image extension.
"""
config = get_app_config()
ext = os.path.splitext(value.name)[1]
if config and not ext.lower() in config.valid_image_extensions:
raise ValidationError(_("Unsupported file extension.")) | def validate_image_extension(value):
"""
Validate that a particular image extension.
"""
config = get_app_config()
ext = os.path.splitext(value.name)[1]
if config and not ext.lower() in config.valid_image_extensions:
raise ValidationError(_("Unsupported file extension.")) | [
"Validate",
"that",
"a",
"particular",
"image",
"extension",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/validators.py#L21-L28 | [
"def",
"validate_image_extension",
"(",
"value",
")",
":",
"config",
"=",
"get_app_config",
"(",
")",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"value",
".",
"name",
")",
"[",
"1",
"]",
"if",
"config",
"and",
"not",
"ext",
".",
"lower",
"(... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | validate_image_size | Validate that a particular image size. | enterprise/validators.py | def validate_image_size(image):
"""
Validate that a particular image size.
"""
config = get_app_config()
valid_max_image_size_in_bytes = config.valid_max_image_size * 1024
if config and not image.size <= valid_max_image_size_in_bytes:
raise ValidationError(
_("The logo image ... | def validate_image_size(image):
"""
Validate that a particular image size.
"""
config = get_app_config()
valid_max_image_size_in_bytes = config.valid_max_image_size * 1024
if config and not image.size <= valid_max_image_size_in_bytes:
raise ValidationError(
_("The logo image ... | [
"Validate",
"that",
"a",
"particular",
"image",
"size",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/validators.py#L31-L39 | [
"def",
"validate_image_size",
"(",
"image",
")",
":",
"config",
"=",
"get_app_config",
"(",
")",
"valid_max_image_size_in_bytes",
"=",
"config",
".",
"valid_max_image_size",
"*",
"1024",
"if",
"config",
"and",
"not",
"image",
".",
"size",
"<=",
"valid_max_image_si... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | get_enterprise_customer_from_catalog_id | Get the enterprise customer id given an enterprise customer catalog id. | enterprise/api/utils.py | def get_enterprise_customer_from_catalog_id(catalog_id):
"""
Get the enterprise customer id given an enterprise customer catalog id.
"""
try:
return str(EnterpriseCustomerCatalog.objects.get(pk=catalog_id).enterprise_customer.uuid)
except EnterpriseCustomerCatalog.DoesNotExist:
retur... | def get_enterprise_customer_from_catalog_id(catalog_id):
"""
Get the enterprise customer id given an enterprise customer catalog id.
"""
try:
return str(EnterpriseCustomerCatalog.objects.get(pk=catalog_id).enterprise_customer.uuid)
except EnterpriseCustomerCatalog.DoesNotExist:
retur... | [
"Get",
"the",
"enterprise",
"customer",
"id",
"given",
"an",
"enterprise",
"customer",
"catalog",
"id",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/utils.py#L24-L31 | [
"def",
"get_enterprise_customer_from_catalog_id",
"(",
"catalog_id",
")",
":",
"try",
":",
"return",
"str",
"(",
"EnterpriseCustomerCatalog",
".",
"objects",
".",
"get",
"(",
"pk",
"=",
"catalog_id",
")",
".",
"enterprise_customer",
".",
"uuid",
")",
"except",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | on_init | Run sphinx-apidoc after Sphinx initialization.
Read the Docs won't run tox or custom shell commands, so we need this to
avoid checking in the generated reStructuredText files. | docs/conf.py | def on_init(app): # pylint: disable=unused-argument
"""
Run sphinx-apidoc after Sphinx initialization.
Read the Docs won't run tox or custom shell commands, so we need this to
avoid checking in the generated reStructuredText files.
"""
docs_path = os.path.abspath(os.path.dirname(__file__))
... | def on_init(app): # pylint: disable=unused-argument
"""
Run sphinx-apidoc after Sphinx initialization.
Read the Docs won't run tox or custom shell commands, so we need this to
avoid checking in the generated reStructuredText files.
"""
docs_path = os.path.abspath(os.path.dirname(__file__))
... | [
"Run",
"sphinx",
"-",
"apidoc",
"after",
"Sphinx",
"initialization",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/docs/conf.py#L470-L485 | [
"def",
"on_init",
"(",
"app",
")",
":",
"# pylint: disable=unused-argument",
"docs_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"root_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | setup | Sphinx extension: run sphinx-apidoc. | docs/conf.py | def setup(app):
"""Sphinx extension: run sphinx-apidoc."""
event = 'builder-inited' if six.PY3 else b'builder-inited'
app.connect(event, on_init) | def setup(app):
"""Sphinx extension: run sphinx-apidoc."""
event = 'builder-inited' if six.PY3 else b'builder-inited'
app.connect(event, on_init) | [
"Sphinx",
"extension",
":",
"run",
"sphinx",
"-",
"apidoc",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/docs/conf.py#L488-L491 | [
"def",
"setup",
"(",
"app",
")",
":",
"event",
"=",
"'builder-inited'",
"if",
"six",
".",
"PY3",
"else",
"b'builder-inited'",
"app",
".",
"connect",
"(",
"event",
",",
"on_init",
")"
] | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | IntegratedChannelCommandMixin.add_arguments | Adds the optional arguments: ``--enterprise_customer``, ``--channel`` | integrated_channels/integrated_channel/management/commands/__init__.py | def add_arguments(self, parser):
"""
Adds the optional arguments: ``--enterprise_customer``, ``--channel``
"""
parser.add_argument(
'--enterprise_customer',
dest='enterprise_customer',
default=None,
metavar='ENTERPRISE_CUSTOMER_UUID',
... | def add_arguments(self, parser):
"""
Adds the optional arguments: ``--enterprise_customer``, ``--channel``
"""
parser.add_argument(
'--enterprise_customer',
dest='enterprise_customer',
default=None,
metavar='ENTERPRISE_CUSTOMER_UUID',
... | [
"Adds",
"the",
"optional",
"arguments",
":",
"--",
"enterprise_customer",
"--",
"channel"
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/__init__.py#L32-L52 | [
"def",
"add_arguments",
"(",
"self",
",",
"parser",
")",
":",
"parser",
".",
"add_argument",
"(",
"'--enterprise_customer'",
",",
"dest",
"=",
"'enterprise_customer'",
",",
"default",
"=",
"None",
",",
"metavar",
"=",
"'ENTERPRISE_CUSTOMER_UUID'",
",",
"help",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | IntegratedChannelCommandMixin.get_integrated_channels | Generates a list of active integrated channels for active customers, filtered from the given options.
Raises errors when invalid options are encountered.
See ``add_arguments`` for the accepted options. | integrated_channels/integrated_channel/management/commands/__init__.py | def get_integrated_channels(self, options):
"""
Generates a list of active integrated channels for active customers, filtered from the given options.
Raises errors when invalid options are encountered.
See ``add_arguments`` for the accepted options.
"""
channel_classes ... | def get_integrated_channels(self, options):
"""
Generates a list of active integrated channels for active customers, filtered from the given options.
Raises errors when invalid options are encountered.
See ``add_arguments`` for the accepted options.
"""
channel_classes ... | [
"Generates",
"a",
"list",
"of",
"active",
"integrated",
"channels",
"for",
"active",
"customers",
"filtered",
"from",
"the",
"given",
"options",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/__init__.py#L54-L73 | [
"def",
"get_integrated_channels",
"(",
"self",
",",
"options",
")",
":",
"channel_classes",
"=",
"self",
".",
"get_channel_classes",
"(",
"options",
".",
"get",
"(",
"'channel'",
")",
")",
"filter_kwargs",
"=",
"{",
"'active'",
":",
"True",
",",
"'enterprise_c... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | IntegratedChannelCommandMixin.get_enterprise_customer | Returns the enterprise customer requested for the given uuid, None if not.
Raises CommandError if uuid is invalid. | integrated_channels/integrated_channel/management/commands/__init__.py | def get_enterprise_customer(uuid):
"""
Returns the enterprise customer requested for the given uuid, None if not.
Raises CommandError if uuid is invalid.
"""
if uuid is None:
return None
try:
return EnterpriseCustomer.active_customers.get(uuid=uui... | def get_enterprise_customer(uuid):
"""
Returns the enterprise customer requested for the given uuid, None if not.
Raises CommandError if uuid is invalid.
"""
if uuid is None:
return None
try:
return EnterpriseCustomer.active_customers.get(uuid=uui... | [
"Returns",
"the",
"enterprise",
"customer",
"requested",
"for",
"the",
"given",
"uuid",
"None",
"if",
"not",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/__init__.py#L76-L88 | [
"def",
"get_enterprise_customer",
"(",
"uuid",
")",
":",
"if",
"uuid",
"is",
"None",
":",
"return",
"None",
"try",
":",
"return",
"EnterpriseCustomer",
".",
"active_customers",
".",
"get",
"(",
"uuid",
"=",
"uuid",
")",
"except",
"EnterpriseCustomer",
".",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | IntegratedChannelCommandMixin.get_channel_classes | Assemble a list of integrated channel classes to transmit to.
If a valid channel type was provided, use it.
Otherwise, use all the available channel types. | integrated_channels/integrated_channel/management/commands/__init__.py | def get_channel_classes(channel_code):
"""
Assemble a list of integrated channel classes to transmit to.
If a valid channel type was provided, use it.
Otherwise, use all the available channel types.
"""
if channel_code:
# Channel code is case-insensitive
... | def get_channel_classes(channel_code):
"""
Assemble a list of integrated channel classes to transmit to.
If a valid channel type was provided, use it.
Otherwise, use all the available channel types.
"""
if channel_code:
# Channel code is case-insensitive
... | [
"Assemble",
"a",
"list",
"of",
"integrated",
"channel",
"classes",
"to",
"transmit",
"to",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/__init__.py#L91-L110 | [
"def",
"get_channel_classes",
"(",
"channel_code",
")",
":",
"if",
"channel_code",
":",
"# Channel code is case-insensitive",
"channel_code",
"=",
"channel_code",
".",
"upper",
"(",
")",
"if",
"channel_code",
"not",
"in",
"INTEGRATED_CHANNEL_CHOICES",
":",
"raise",
"C... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | LearnerCourseCompletionStatement.get_result | Get result for the statement.
Arguments:
course_grade (CourseGrade): Course grade. | integrated_channels/xapi/statements/learner_course_completion.py | def get_result(self, course_grade):
"""
Get result for the statement.
Arguments:
course_grade (CourseGrade): Course grade.
"""
return Result(
score=Score(
scaled=course_grade.percent,
raw=course_grade.percent * 100,
... | def get_result(self, course_grade):
"""
Get result for the statement.
Arguments:
course_grade (CourseGrade): Course grade.
"""
return Result(
score=Score(
scaled=course_grade.percent,
raw=course_grade.percent * 100,
... | [
"Get",
"result",
"for",
"the",
"statement",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/statements/learner_course_completion.py#L48-L64 | [
"def",
"get_result",
"(",
"self",
",",
"course_grade",
")",
":",
"return",
"Result",
"(",
"score",
"=",
"Score",
"(",
"scaled",
"=",
"course_grade",
".",
"percent",
",",
"raw",
"=",
"course_grade",
".",
"percent",
"*",
"100",
",",
"min",
"=",
"MIN_SCORE"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | get_requirements | Get the contents of a file listing the requirements | setup.py | def get_requirements(requirements_file):
"""
Get the contents of a file listing the requirements
"""
lines = open(requirements_file).readlines()
dependencies = []
dependency_links = []
for line in lines:
package = line.strip()
if package.startswith('#'):
# Skip p... | def get_requirements(requirements_file):
"""
Get the contents of a file listing the requirements
"""
lines = open(requirements_file).readlines()
dependencies = []
dependency_links = []
for line in lines:
package = line.strip()
if package.startswith('#'):
# Skip p... | [
"Get",
"the",
"contents",
"of",
"a",
"file",
"listing",
"the",
"requirements"
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/setup.py#L28-L68 | [
"def",
"get_requirements",
"(",
"requirements_file",
")",
":",
"lines",
"=",
"open",
"(",
"requirements_file",
")",
".",
"readlines",
"(",
")",
"dependencies",
"=",
"[",
"]",
"dependency_links",
"=",
"[",
"]",
"for",
"line",
"in",
"lines",
":",
"package",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerPluginConfiguration.transmit_learner_data | Iterate over each learner data record and transmit it to the integrated channel. | integrated_channels/integrated_channel/models.py | def transmit_learner_data(self, user):
"""
Iterate over each learner data record and transmit it to the integrated channel.
"""
exporter = self.get_learner_data_exporter(user)
transmitter = self.get_learner_data_transmitter()
transmitter.transmit(exporter) | def transmit_learner_data(self, user):
"""
Iterate over each learner data record and transmit it to the integrated channel.
"""
exporter = self.get_learner_data_exporter(user)
transmitter = self.get_learner_data_transmitter()
transmitter.transmit(exporter) | [
"Iterate",
"over",
"each",
"learner",
"data",
"record",
"and",
"transmit",
"it",
"to",
"the",
"integrated",
"channel",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/models.py#L92-L98 | [
"def",
"transmit_learner_data",
"(",
"self",
",",
"user",
")",
":",
"exporter",
"=",
"self",
".",
"get_learner_data_exporter",
"(",
"user",
")",
"transmitter",
"=",
"self",
".",
"get_learner_data_transmitter",
"(",
")",
"transmitter",
".",
"transmit",
"(",
"expo... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerPluginConfiguration.transmit_content_metadata | Transmit content metadata to integrated channel. | integrated_channels/integrated_channel/models.py | def transmit_content_metadata(self, user):
"""
Transmit content metadata to integrated channel.
"""
exporter = self.get_content_metadata_exporter(user)
transmitter = self.get_content_metadata_transmitter()
transmitter.transmit(exporter.export()) | def transmit_content_metadata(self, user):
"""
Transmit content metadata to integrated channel.
"""
exporter = self.get_content_metadata_exporter(user)
transmitter = self.get_content_metadata_transmitter()
transmitter.transmit(exporter.export()) | [
"Transmit",
"content",
"metadata",
"to",
"integrated",
"channel",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/models.py#L100-L106 | [
"def",
"transmit_content_metadata",
"(",
"self",
",",
"user",
")",
":",
"exporter",
"=",
"self",
".",
"get_content_metadata_exporter",
"(",
"user",
")",
"transmitter",
"=",
"self",
".",
"get_content_metadata_transmitter",
"(",
")",
"transmitter",
".",
"transmit",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | DegreedLearnerExporter.get_learner_data_records | Return a DegreedLearnerDataTransmissionAudit with the given enrollment and course completion data.
If completed_date is None, then course completion has not been met.
If no remote ID can be found, return None. | integrated_channels/degreed/exporters/learner_data.py | def get_learner_data_records(
self,
enterprise_enrollment,
completed_date=None,
is_passing=False,
**kwargs
): # pylint: disable=arguments-differ,unused-argument
"""
Return a DegreedLearnerDataTransmissionAudit with the given enrollment and... | def get_learner_data_records(
self,
enterprise_enrollment,
completed_date=None,
is_passing=False,
**kwargs
): # pylint: disable=arguments-differ,unused-argument
"""
Return a DegreedLearnerDataTransmissionAudit with the given enrollment and... | [
"Return",
"a",
"DegreedLearnerDataTransmissionAudit",
"with",
"the",
"given",
"enrollment",
"and",
"course",
"completion",
"data",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/exporters/learner_data.py#L25-L68 | [
"def",
"get_learner_data_records",
"(",
"self",
",",
"enterprise_enrollment",
",",
"completed_date",
"=",
"None",
",",
"is_passing",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# pylint: disable=arguments-differ,unused-argument",
"# Degreed expects completion dates of... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | TemplatePreviewView.get | Render the given template with the stock data. | enterprise/admin/views.py | def get(self, request, template_id, view_type):
"""
Render the given template with the stock data.
"""
template = get_object_or_404(EnrollmentNotificationEmailTemplate, pk=template_id)
if view_type not in self.view_type_contexts:
return HttpResponse(status=404)
... | def get(self, request, template_id, view_type):
"""
Render the given template with the stock data.
"""
template = get_object_or_404(EnrollmentNotificationEmailTemplate, pk=template_id)
if view_type not in self.view_type_contexts:
return HttpResponse(status=404)
... | [
"Render",
"the",
"given",
"template",
"with",
"the",
"stock",
"data",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L79-L88 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"template_id",
",",
"view_type",
")",
":",
"template",
"=",
"get_object_or_404",
"(",
"EnrollmentNotificationEmailTemplate",
",",
"pk",
"=",
"template_id",
")",
"if",
"view_type",
"not",
"in",
"self",
".",
"view_... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerTransmitCoursesView._build_admin_context | Build common admin context. | enterprise/admin/views.py | def _build_admin_context(request, customer):
"""
Build common admin context.
"""
opts = customer._meta
codename = get_permission_codename('change', opts)
has_change_permission = request.user.has_perm('%s.%s' % (opts.app_label, codename))
return {
'has_... | def _build_admin_context(request, customer):
"""
Build common admin context.
"""
opts = customer._meta
codename = get_permission_codename('change', opts)
has_change_permission = request.user.has_perm('%s.%s' % (opts.app_label, codename))
return {
'has_... | [
"Build",
"common",
"admin",
"context",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L114-L124 | [
"def",
"_build_admin_context",
"(",
"request",
",",
"customer",
")",
":",
"opts",
"=",
"customer",
".",
"_meta",
"codename",
"=",
"get_permission_codename",
"(",
"'change'",
",",
"opts",
")",
"has_change_permission",
"=",
"request",
".",
"user",
".",
"has_perm",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerTransmitCoursesView._build_context | Build common context parts used by different handlers in this view. | enterprise/admin/views.py | def _build_context(self, request, enterprise_customer_uuid):
"""
Build common context parts used by different handlers in this view.
"""
enterprise_customer = EnterpriseCustomer.objects.get(uuid=enterprise_customer_uuid) # pylint: disable=no-member
context = {
self.... | def _build_context(self, request, enterprise_customer_uuid):
"""
Build common context parts used by different handlers in this view.
"""
enterprise_customer = EnterpriseCustomer.objects.get(uuid=enterprise_customer_uuid) # pylint: disable=no-member
context = {
self.... | [
"Build",
"common",
"context",
"parts",
"used",
"by",
"different",
"handlers",
"in",
"this",
"view",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L126-L137 | [
"def",
"_build_context",
"(",
"self",
",",
"request",
",",
"enterprise_customer_uuid",
")",
":",
"enterprise_customer",
"=",
"EnterpriseCustomer",
".",
"objects",
".",
"get",
"(",
"uuid",
"=",
"enterprise_customer_uuid",
")",
"# pylint: disable=no-member",
"context",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerTransmitCoursesView.get | Handle GET request - render "Transmit courses metadata" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
Returns:
django.http.response.HttpResponse: HttpResponse | enterprise/admin/views.py | def get(self, request, enterprise_customer_uuid):
"""
Handle GET request - render "Transmit courses metadata" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
Returns:
... | def get(self, request, enterprise_customer_uuid):
"""
Handle GET request - render "Transmit courses metadata" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
Returns:
... | [
"Handle",
"GET",
"request",
"-",
"render",
"Transmit",
"courses",
"metadata",
"form",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L139-L154 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"enterprise_customer_uuid",
")",
":",
"context",
"=",
"self",
".",
"_build_context",
"(",
"request",
",",
"enterprise_customer_uuid",
")",
"transmit_courses_metadata_form",
"=",
"TransmitEnterpriseCoursesForm",
"(",
")",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerTransmitCoursesView.post | Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID | enterprise/admin/views.py | def post(self, request, enterprise_customer_uuid):
"""
Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
"""
transmit_courses_meta... | def post(self, request, enterprise_customer_uuid):
"""
Handle POST request - handle form submissions.
Arguments:
request (django.http.request.HttpRequest): Request instance
enterprise_customer_uuid (str): Enterprise Customer UUID
"""
transmit_courses_meta... | [
"Handle",
"POST",
"request",
"-",
"handle",
"form",
"submissions",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L156-L183 | [
"def",
"post",
"(",
"self",
",",
"request",
",",
"enterprise_customer_uuid",
")",
":",
"transmit_courses_metadata_form",
"=",
"TransmitEnterpriseCoursesForm",
"(",
"request",
".",
"POST",
")",
"# check that form data is well-formed",
"if",
"transmit_courses_metadata_form",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView._build_context | Build common context parts used by different handlers in this view. | enterprise/admin/views.py | def _build_context(self, request, customer_uuid):
"""
Build common context parts used by different handlers in this view.
"""
# TODO: pylint acts stupid - find a way around it without suppressing
enterprise_customer = EnterpriseCustomer.objects.get(uuid=customer_uuid) # pylint: ... | def _build_context(self, request, customer_uuid):
"""
Build common context parts used by different handlers in this view.
"""
# TODO: pylint acts stupid - find a way around it without suppressing
enterprise_customer = EnterpriseCustomer.objects.get(uuid=customer_uuid) # pylint: ... | [
"Build",
"common",
"context",
"parts",
"used",
"by",
"different",
"handlers",
"in",
"this",
"view",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L218-L238 | [
"def",
"_build_context",
"(",
"self",
",",
"request",
",",
"customer_uuid",
")",
":",
"# TODO: pylint acts stupid - find a way around it without suppressing",
"enterprise_customer",
"=",
"EnterpriseCustomer",
".",
"objects",
".",
"get",
"(",
"uuid",
"=",
"customer_uuid",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_enterprise_customer_user_queryset | Get the list of EnterpriseCustomerUsers we want to render.
Arguments:
request (HttpRequest): HTTP Request instance.
search_keyword (str): The keyword to search for in users' email addresses and usernames.
customer_uuid (str): A unique identifier to filter down to only users ... | enterprise/admin/views.py | def get_enterprise_customer_user_queryset(self, request, search_keyword, customer_uuid, page_size=PAGE_SIZE):
"""
Get the list of EnterpriseCustomerUsers we want to render.
Arguments:
request (HttpRequest): HTTP Request instance.
search_keyword (str): The keyword to sear... | def get_enterprise_customer_user_queryset(self, request, search_keyword, customer_uuid, page_size=PAGE_SIZE):
"""
Get the list of EnterpriseCustomerUsers we want to render.
Arguments:
request (HttpRequest): HTTP Request instance.
search_keyword (str): The keyword to sear... | [
"Get",
"the",
"list",
"of",
"EnterpriseCustomerUsers",
"we",
"want",
"to",
"render",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L246-L267 | [
"def",
"get_enterprise_customer_user_queryset",
"(",
"self",
",",
"request",
",",
"search_keyword",
",",
"customer_uuid",
",",
"page_size",
"=",
"PAGE_SIZE",
")",
":",
"page",
"=",
"request",
".",
"GET",
".",
"get",
"(",
"'page'",
",",
"1",
")",
"learners",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_pending_users_queryset | Get the list of PendingEnterpriseCustomerUsers we want to render.
Args:
search_keyword (str): The keyword to search for in pending users' email addresses.
customer_uuid (str): A unique identifier to filter down to only pending users
linked to a particular EnterpriseCustomer. | enterprise/admin/views.py | def get_pending_users_queryset(self, search_keyword, customer_uuid):
"""
Get the list of PendingEnterpriseCustomerUsers we want to render.
Args:
search_keyword (str): The keyword to search for in pending users' email addresses.
customer_uuid (str): A unique identifier to... | def get_pending_users_queryset(self, search_keyword, customer_uuid):
"""
Get the list of PendingEnterpriseCustomerUsers we want to render.
Args:
search_keyword (str): The keyword to search for in pending users' email addresses.
customer_uuid (str): A unique identifier to... | [
"Get",
"the",
"list",
"of",
"PendingEnterpriseCustomerUsers",
"we",
"want",
"to",
"render",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L269-L285 | [
"def",
"get_pending_users_queryset",
"(",
"self",
",",
"search_keyword",
",",
"customer_uuid",
")",
":",
"queryset",
"=",
"PendingEnterpriseCustomerUser",
".",
"objects",
".",
"filter",
"(",
"enterprise_customer__uuid",
"=",
"customer_uuid",
")",
"if",
"search_keyword",... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView._handle_singular | Link single user by email or username.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (ManageLearnersForm): bound ManageLearners form instance | enterprise/admin/views.py | def _handle_singular(cls, enterprise_customer, manage_learners_form):
"""
Link single user by email or username.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (ManageLearnersForm): b... | def _handle_singular(cls, enterprise_customer, manage_learners_form):
"""
Link single user by email or username.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (ManageLearnersForm): b... | [
"Link",
"single",
"user",
"by",
"email",
"or",
"username",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L288-L304 | [
"def",
"_handle_singular",
"(",
"cls",
",",
"enterprise_customer",
",",
"manage_learners_form",
")",
":",
"form_field_value",
"=",
"manage_learners_form",
".",
"cleaned_data",
"[",
"ManageLearnersForm",
".",
"Fields",
".",
"EMAIL_OR_USERNAME",
"]",
"email",
"=",
"emai... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView._handle_bulk_upload | Bulk link users by email.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (ManageLearnersForm): bound ManageLearners form instance
request (django.http.request.HttpRequest): HTTP Request i... | enterprise/admin/views.py | def _handle_bulk_upload(cls, enterprise_customer, manage_learners_form, request, email_list=None):
"""
Bulk link users by email.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (Manage... | def _handle_bulk_upload(cls, enterprise_customer, manage_learners_form, request, email_list=None):
"""
Bulk link users by email.
Arguments:
enterprise_customer (EnterpriseCustomer): learners will be linked to this Enterprise Customer instance
manage_learners_form (Manage... | [
"Bulk",
"link",
"users",
"by",
"email",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L307-L406 | [
"def",
"_handle_bulk_upload",
"(",
"cls",
",",
"enterprise_customer",
",",
"manage_learners_form",
",",
"request",
",",
"email_list",
"=",
"None",
")",
":",
"errors",
"=",
"[",
"]",
"emails",
"=",
"set",
"(",
")",
"already_linked_emails",
"=",
"[",
"]",
"dup... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.enroll_user | Enroll a single user in any number of courses using a particular course mode.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
user: The user who needs to be enrolled in the course
course_mode: The mode with which the enrollment should be ... | enterprise/admin/views.py | def enroll_user(cls, enterprise_customer, user, course_mode, *course_ids):
"""
Enroll a single user in any number of courses using a particular course mode.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
user: The user who needs to b... | def enroll_user(cls, enterprise_customer, user, course_mode, *course_ids):
"""
Enroll a single user in any number of courses using a particular course mode.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
user: The user who needs to b... | [
"Enroll",
"a",
"single",
"user",
"in",
"any",
"number",
"of",
"courses",
"using",
"a",
"particular",
"course",
"mode",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L409-L453 | [
"def",
"enroll_user",
"(",
"cls",
",",
"enterprise_customer",
",",
"user",
",",
"course_mode",
",",
"*",
"course_ids",
")",
":",
"enterprise_customer_user",
",",
"__",
"=",
"EnterpriseCustomerUser",
".",
"objects",
".",
"get_or_create",
"(",
"enterprise_customer",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.is_user_enrolled | Query the enrollment API and determine if a learner is enrolled in a given course run track.
Args:
user: The user whose enrollment needs to be checked
course_mode: The mode with which the enrollment should be checked
course_id: course id of the course where enrollment should... | enterprise/admin/views.py | def is_user_enrolled(cls, user, course_id, course_mode):
"""
Query the enrollment API and determine if a learner is enrolled in a given course run track.
Args:
user: The user whose enrollment needs to be checked
course_mode: The mode with which the enrollment should be c... | def is_user_enrolled(cls, user, course_id, course_mode):
"""
Query the enrollment API and determine if a learner is enrolled in a given course run track.
Args:
user: The user whose enrollment needs to be checked
course_mode: The mode with which the enrollment should be c... | [
"Query",
"the",
"enrollment",
"API",
"and",
"determine",
"if",
"a",
"learner",
"is",
"enrolled",
"in",
"a",
"given",
"course",
"run",
"track",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L456-L484 | [
"def",
"is_user_enrolled",
"(",
"cls",
",",
"user",
",",
"course_id",
",",
"course_mode",
")",
":",
"enrollment_client",
"=",
"EnrollmentApiClient",
"(",
")",
"try",
":",
"enrollments",
"=",
"enrollment_client",
".",
"get_course_enrollment",
"(",
"user",
".",
"u... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_users_by_email | Accept a list of emails, and separate them into users that exist on OpenEdX and users who don't.
Args:
emails: An iterable of email addresses to split between existing and nonexisting
Returns:
users: Queryset of users who exist in the OpenEdX platform and who were in the list o... | enterprise/admin/views.py | def get_users_by_email(cls, emails):
"""
Accept a list of emails, and separate them into users that exist on OpenEdX and users who don't.
Args:
emails: An iterable of email addresses to split between existing and nonexisting
Returns:
users: Queryset of users who... | def get_users_by_email(cls, emails):
"""
Accept a list of emails, and separate them into users that exist on OpenEdX and users who don't.
Args:
emails: An iterable of email addresses to split between existing and nonexisting
Returns:
users: Queryset of users who... | [
"Accept",
"a",
"list",
"of",
"emails",
"and",
"separate",
"them",
"into",
"users",
"that",
"exist",
"on",
"OpenEdX",
"and",
"users",
"who",
"don",
"t",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L487-L501 | [
"def",
"get_users_by_email",
"(",
"cls",
",",
"emails",
")",
":",
"users",
"=",
"User",
".",
"objects",
".",
"filter",
"(",
"email__in",
"=",
"emails",
")",
"present_emails",
"=",
"users",
".",
"values_list",
"(",
"'email'",
",",
"flat",
"=",
"True",
")"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.enroll_users_in_program | Enroll existing users in all courses in a program, and create pending enrollments for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
program_details: The details of the program in which we're enrolling
course_mode (str... | enterprise/admin/views.py | def enroll_users_in_program(cls, enterprise_customer, program_details, course_mode, emails, cohort=None):
"""
Enroll existing users in all courses in a program, and create pending enrollments for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsorin... | def enroll_users_in_program(cls, enterprise_customer, program_details, course_mode, emails, cohort=None):
"""
Enroll existing users in all courses in a program, and create pending enrollments for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsorin... | [
"Enroll",
"existing",
"users",
"in",
"all",
"courses",
"in",
"a",
"program",
"and",
"create",
"pending",
"enrollments",
"for",
"nonexisting",
"users",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L504-L543 | [
"def",
"enroll_users_in_program",
"(",
"cls",
",",
"enterprise_customer",
",",
"program_details",
",",
"course_mode",
",",
"emails",
",",
"cohort",
"=",
"None",
")",
":",
"existing_users",
",",
"unregistered_emails",
"=",
"cls",
".",
"get_users_by_email",
"(",
"em... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.enroll_users_in_course | Enroll existing users in a course, and create a pending enrollment for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
course_id (str): The unique identifier of the course in which we're enrolling
course_mode (str): The... | enterprise/admin/views.py | def enroll_users_in_course(cls, enterprise_customer, course_id, course_mode, emails):
"""
Enroll existing users in a course, and create a pending enrollment for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
course... | def enroll_users_in_course(cls, enterprise_customer, course_id, course_mode, emails):
"""
Enroll existing users in a course, and create a pending enrollment for nonexisting users.
Args:
enterprise_customer: The EnterpriseCustomer which is sponsoring the enrollment
course... | [
"Enroll",
"existing",
"users",
"in",
"a",
"course",
"and",
"create",
"a",
"pending",
"enrollment",
"for",
"nonexisting",
"users",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L546-L583 | [
"def",
"enroll_users_in_course",
"(",
"cls",
",",
"enterprise_customer",
",",
"course_id",
",",
"course_mode",
",",
"emails",
")",
":",
"existing_users",
",",
"unregistered_emails",
"=",
"cls",
".",
"get_users_by_email",
"(",
"emails",
")",
"successes",
"=",
"[",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.send_messages | Deduplicate any outgoing message requests, and send the remainder.
Args:
http_request: The HTTP request in whose response we want to embed the messages
message_requests: A list of undeduplicated messages in the form of tuples of message type
and text- for example, ('erro... | enterprise/admin/views.py | def send_messages(cls, http_request, message_requests):
"""
Deduplicate any outgoing message requests, and send the remainder.
Args:
http_request: The HTTP request in whose response we want to embed the messages
message_requests: A list of undeduplicated messages in the ... | def send_messages(cls, http_request, message_requests):
"""
Deduplicate any outgoing message requests, and send the remainder.
Args:
http_request: The HTTP request in whose response we want to embed the messages
message_requests: A list of undeduplicated messages in the ... | [
"Deduplicate",
"any",
"outgoing",
"message",
"requests",
"and",
"send",
"the",
"remainder",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L586-L598 | [
"def",
"send_messages",
"(",
"cls",
",",
"http_request",
",",
"message_requests",
")",
":",
"deduplicated_messages",
"=",
"set",
"(",
"message_requests",
")",
"for",
"msg_type",
",",
"text",
"in",
"deduplicated_messages",
":",
"message_function",
"=",
"getattr",
"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.notify_program_learners | Notify learners about a program in which they've been enrolled.
Args:
enterprise_customer: The EnterpriseCustomer being linked to
program_details: Details about the specific program the learners were enrolled in
users: An iterable of the users or pending users who were enrol... | enterprise/admin/views.py | def notify_program_learners(cls, enterprise_customer, program_details, users):
"""
Notify learners about a program in which they've been enrolled.
Args:
enterprise_customer: The EnterpriseCustomer being linked to
program_details: Details about the specific program the le... | def notify_program_learners(cls, enterprise_customer, program_details, users):
"""
Notify learners about a program in which they've been enrolled.
Args:
enterprise_customer: The EnterpriseCustomer being linked to
program_details: Details about the specific program the le... | [
"Notify",
"learners",
"about",
"a",
"program",
"in",
"which",
"they",
"ve",
"been",
"enrolled",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L601-L648 | [
"def",
"notify_program_learners",
"(",
"cls",
",",
"enterprise_customer",
",",
"program_details",
",",
"users",
")",
":",
"program_name",
"=",
"program_details",
".",
"get",
"(",
"'title'",
")",
"program_branding",
"=",
"program_details",
".",
"get",
"(",
"'type'"... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_success_enrollment_message | Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of users who were successfully enrolled
enrolled_in (str): A string identifier for the course or program the users were enrolled in
Returns:
tuple: A 2-tuple containing a... | enterprise/admin/views.py | def get_success_enrollment_message(cls, users, enrolled_in):
"""
Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of users who were successfully enrolled
enrolled_in (str): A string identifier for the course or program the u... | def get_success_enrollment_message(cls, users, enrolled_in):
"""
Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of users who were successfully enrolled
enrolled_in (str): A string identifier for the course or program the u... | [
"Create",
"message",
"for",
"the",
"users",
"who",
"were",
"enrolled",
"in",
"a",
"course",
"or",
"program",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L651-L673 | [
"def",
"get_success_enrollment_message",
"(",
"cls",
",",
"users",
",",
"enrolled_in",
")",
":",
"enrolled_count",
"=",
"len",
"(",
"users",
")",
"return",
"(",
"'success'",
",",
"ungettext",
"(",
"'{enrolled_count} learner was enrolled in {enrolled_in}.'",
",",
"'{en... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_failed_enrollment_message | Create message for the users who were not able to be enrolled in a course or program.
Args:
users: An iterable of users who were not successfully enrolled
enrolled_in (str): A string identifier for the course or program with which enrollment was attempted
Returns:
tuple... | enterprise/admin/views.py | def get_failed_enrollment_message(cls, users, enrolled_in):
"""
Create message for the users who were not able to be enrolled in a course or program.
Args:
users: An iterable of users who were not successfully enrolled
enrolled_in (str): A string identifier for the cours... | def get_failed_enrollment_message(cls, users, enrolled_in):
"""
Create message for the users who were not able to be enrolled in a course or program.
Args:
users: An iterable of users who were not successfully enrolled
enrolled_in (str): A string identifier for the cours... | [
"Create",
"message",
"for",
"the",
"users",
"who",
"were",
"not",
"able",
"to",
"be",
"enrolled",
"in",
"a",
"course",
"or",
"program",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L676-L696 | [
"def",
"get_failed_enrollment_message",
"(",
"cls",
",",
"users",
",",
"enrolled_in",
")",
":",
"failed_emails",
"=",
"[",
"user",
".",
"email",
"for",
"user",
"in",
"users",
"]",
"return",
"(",
"'error'",
",",
"_",
"(",
"'The following learners could not be enr... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get_pending_enrollment_message | Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of PendingEnterpriseCustomerUsers who were successfully linked with a pending enrollment
enrolled_in (str): A string identifier for the course or program the pending users were linked to
... | enterprise/admin/views.py | def get_pending_enrollment_message(cls, pending_users, enrolled_in):
"""
Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of PendingEnterpriseCustomerUsers who were successfully linked with a pending enrollment
enrolled_in (... | def get_pending_enrollment_message(cls, pending_users, enrolled_in):
"""
Create message for the users who were enrolled in a course or program.
Args:
users: An iterable of PendingEnterpriseCustomerUsers who were successfully linked with a pending enrollment
enrolled_in (... | [
"Create",
"message",
"for",
"the",
"users",
"who",
"were",
"enrolled",
"in",
"a",
"course",
"or",
"program",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L699-L723 | [
"def",
"get_pending_enrollment_message",
"(",
"cls",
",",
"pending_users",
",",
"enrolled_in",
")",
":",
"pending_emails",
"=",
"[",
"pending_user",
".",
"user_email",
"for",
"pending_user",
"in",
"pending_users",
"]",
"return",
"(",
"'warning'",
",",
"_",
"(",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView._enroll_users | Enroll the users with the given email addresses to the courses specified, either specifically or by program.
Args:
cls (type): The EnterpriseCustomerManageLearnersView class itself
request: The HTTP request the enrollment is being created by
enterprise_customer: The instance... | enterprise/admin/views.py | def _enroll_users(
cls,
request,
enterprise_customer,
emails,
mode,
course_id=None,
program_details=None,
notify=True
):
"""
Enroll the users with the given email addresses to the courses specified, eithe... | def _enroll_users(
cls,
request,
enterprise_customer,
emails,
mode,
course_id=None,
program_details=None,
notify=True
):
"""
Enroll the users with the given email addresses to the courses specified, eithe... | [
"Enroll",
"the",
"users",
"with",
"the",
"given",
"email",
"addresses",
"to",
"the",
"courses",
"specified",
"either",
"specifically",
"or",
"by",
"program",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L726-L794 | [
"def",
"_enroll_users",
"(",
"cls",
",",
"request",
",",
"enterprise_customer",
",",
"emails",
",",
"mode",
",",
"course_id",
"=",
"None",
",",
"program_details",
"=",
"None",
",",
"notify",
"=",
"True",
")",
":",
"pending_messages",
"=",
"[",
"]",
"if",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
valid | EnterpriseCustomerManageLearnersView.get | Handle GET request - render linked learners list and "Link learner" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
customer_uuid (str): Enterprise Customer UUID
Returns:
django.http.response.HttpResponse: HttpResponse | enterprise/admin/views.py | def get(self, request, customer_uuid):
"""
Handle GET request - render linked learners list and "Link learner" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
customer_uuid (str): Enterprise Customer UUID
Returns:
django.... | def get(self, request, customer_uuid):
"""
Handle GET request - render linked learners list and "Link learner" form.
Arguments:
request (django.http.request.HttpRequest): Request instance
customer_uuid (str): Enterprise Customer UUID
Returns:
django.... | [
"Handle",
"GET",
"request",
"-",
"render",
"linked",
"learners",
"list",
"and",
"Link",
"learner",
"form",
"."
] | edx/edx-enterprise | python | https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/views.py#L796-L814 | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"customer_uuid",
")",
":",
"context",
"=",
"self",
".",
"_build_context",
"(",
"request",
",",
"customer_uuid",
")",
"manage_learners_form",
"=",
"ManageLearnersForm",
"(",
"user",
"=",
"request",
".",
"user",
... | aea91379ab0a87cd3bc798961fce28b60ee49a80 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.