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
ServiceUserThrottle.update_throttle_scope
Update throttle scope so that service user throttle rates are applied.
enterprise/api/throttles.py
def update_throttle_scope(self): """ Update throttle scope so that service user throttle rates are applied. """ self.scope = SERVICE_USER_SCOPE self.rate = self.get_rate() self.num_requests, self.duration = self.parse_rate(self.rate)
def update_throttle_scope(self): """ Update throttle scope so that service user throttle rates are applied. """ self.scope = SERVICE_USER_SCOPE self.rate = self.get_rate() self.num_requests, self.duration = self.parse_rate(self.rate)
[ "Update", "throttle", "scope", "so", "that", "service", "user", "throttle", "rates", "are", "applied", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/throttles.py#L48-L54
[ "def", "update_throttle_scope", "(", "self", ")", ":", "self", ".", "scope", "=", "SERVICE_USER_SCOPE", "self", ".", "rate", "=", "self", ".", "get_rate", "(", ")", "self", ".", "num_requests", ",", "self", ".", "duration", "=", "self", ".", "parse_rate", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EcommerceApiClient.get_course_final_price
Get course mode's SKU discounted price after applying any entitlement available for this user. Returns: str: Discounted price of the course mode.
enterprise/api_client/ecommerce.py
def get_course_final_price(self, mode, currency='$', enterprise_catalog_uuid=None): """ Get course mode's SKU discounted price after applying any entitlement available for this user. Returns: str: Discounted price of the course mode. """ try: price_detai...
def get_course_final_price(self, mode, currency='$', enterprise_catalog_uuid=None): """ Get course mode's SKU discounted price after applying any entitlement available for this user. Returns: str: Discounted price of the course mode. """ try: price_detai...
[ "Get", "course", "mode", "s", "SKU", "discounted", "price", "after", "applying", "any", "entitlement", "available", "for", "this", "user", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api_client/ecommerce.py#L47-L67
[ "def", "get_course_final_price", "(", "self", ",", "mode", ",", "currency", "=", "'$'", ",", "enterprise_catalog_uuid", "=", "None", ")", ":", "try", ":", "price_details", "=", "self", ".", "client", ".", "baskets", ".", "calculate", ".", "get", "(", "sku"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseContextSerializerMixin.update_enterprise_courses
This method adds enterprise-specific metadata for each course. We are adding following field in all the courses. tpa_hint: a string for identifying Identity Provider. enterprise_id: the UUID of the enterprise **kwargs: any additional data one would like to add on a per-use b...
enterprise/api/v1/mixins.py
def update_enterprise_courses(self, enterprise_customer, course_container_key='results', **kwargs): """ This method adds enterprise-specific metadata for each course. We are adding following field in all the courses. tpa_hint: a string for identifying Identity Provider. ...
def update_enterprise_courses(self, enterprise_customer, course_container_key='results', **kwargs): """ This method adds enterprise-specific metadata for each course. We are adding following field in all the courses. tpa_hint: a string for identifying Identity Provider. ...
[ "This", "method", "adds", "enterprise", "-", "specific", "metadata", "for", "each", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/mixins.py#L16-L40
[ "def", "update_enterprise_courses", "(", "self", ",", "enterprise_customer", ",", "course_container_key", "=", "'results'", ",", "*", "*", "kwargs", ")", ":", "enterprise_context", "=", "{", "'tpa_hint'", ":", "enterprise_customer", "and", "enterprise_customer", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseContextSerializerMixin.update_course
Update course metadata of the given course and return updated course. Arguments: course (dict): Course Metadata returned by course catalog API enterprise_customer (EnterpriseCustomer): enterprise customer instance. enterprise_context (dict): Enterprise context to be added to...
enterprise/api/v1/mixins.py
def update_course(self, course, enterprise_customer, enterprise_context): """ Update course metadata of the given course and return updated course. Arguments: course (dict): Course Metadata returned by course catalog API enterprise_customer (EnterpriseCustomer): enterpri...
def update_course(self, course, enterprise_customer, enterprise_context): """ Update course metadata of the given course and return updated course. Arguments: course (dict): Course Metadata returned by course catalog API enterprise_customer (EnterpriseCustomer): enterpri...
[ "Update", "course", "metadata", "of", "the", "given", "course", "and", "return", "updated", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/mixins.py#L42-L68
[ "def", "update_course", "(", "self", ",", "course", ",", "enterprise_customer", ",", "enterprise_context", ")", ":", "course", "[", "'course_runs'", "]", "=", "self", ".", "update_course_runs", "(", "course_runs", "=", "course", ".", "get", "(", "'course_runs'",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseContextSerializerMixin.update_course_runs
Update Marketing urls in course metadata and return updated course. Arguments: course_runs (list): List of course runs. enterprise_customer (EnterpriseCustomer): enterprise customer instance. enterprise_context (dict): The context to inject into URLs. Returns: ...
enterprise/api/v1/mixins.py
def update_course_runs(self, course_runs, enterprise_customer, enterprise_context): """ Update Marketing urls in course metadata and return updated course. Arguments: course_runs (list): List of course runs. enterprise_customer (EnterpriseCustomer): enterprise customer i...
def update_course_runs(self, course_runs, enterprise_customer, enterprise_context): """ Update Marketing urls in course metadata and return updated course. Arguments: course_runs (list): List of course runs. enterprise_customer (EnterpriseCustomer): enterprise customer i...
[ "Update", "Marketing", "urls", "in", "course", "metadata", "and", "return", "updated", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/mixins.py#L70-L104
[ "def", "update_course_runs", "(", "self", ",", "course_runs", ",", "enterprise_customer", ",", "enterprise_context", ")", ":", "updated_course_runs", "=", "[", "]", "for", "course_run", "in", "course_runs", ":", "track_selection_url", "=", "utils", ".", "get_course_...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerExporter.export
Collect learner data for the ``EnterpriseCustomer`` where data sharing consent is granted. Yields a learner data object for each enrollment, containing: * ``enterprise_enrollment``: ``EnterpriseCourseEnrollment`` object. * ``completed_date``: datetime instance containing the course/enrollment ...
integrated_channels/integrated_channel/exporters/learner_data.py
def export(self): """ Collect learner data for the ``EnterpriseCustomer`` where data sharing consent is granted. Yields a learner data object for each enrollment, containing: * ``enterprise_enrollment``: ``EnterpriseCourseEnrollment`` object. * ``completed_date``: datetime inst...
def export(self): """ Collect learner data for the ``EnterpriseCustomer`` where data sharing consent is granted. Yields a learner data object for each enrollment, containing: * ``enterprise_enrollment``: ``EnterpriseCourseEnrollment`` object. * ``completed_date``: datetime inst...
[ "Collect", "learner", "data", "for", "the", "EnterpriseCustomer", "where", "data", "sharing", "consent", "is", "granted", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L78-L149
[ "def", "export", "(", "self", ")", ":", "# Fetch the consenting enrollment data, including the enterprise_customer_user.", "# Order by the course_id, to avoid fetching course API data more than we have to.", "enrollment_queryset", "=", "EnterpriseCourseEnrollment", ".", "objects", ".", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerExporter.get_learner_data_records
Generate a learner data transmission audit with fields properly filled in.
integrated_channels/integrated_channel/exporters/learner_data.py
def get_learner_data_records(self, enterprise_enrollment, completed_date=None, grade=None, is_passing=False): """ Generate a learner data transmission audit with fields properly filled in. """ # pylint: disable=invalid-name LearnerDataTransmissionAudit = apps.get_model('integrate...
def get_learner_data_records(self, enterprise_enrollment, completed_date=None, grade=None, is_passing=False): """ Generate a learner data transmission audit with fields properly filled in. """ # pylint: disable=invalid-name LearnerDataTransmissionAudit = apps.get_model('integrate...
[ "Generate", "a", "learner", "data", "transmission", "audit", "with", "fields", "properly", "filled", "in", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L151-L171
[ "def", "get_learner_data_records", "(", "self", ",", "enterprise_enrollment", ",", "completed_date", "=", "None", ",", "grade", "=", "None", ",", "is_passing", "=", "False", ")", ":", "# pylint: disable=invalid-name", "LearnerDataTransmissionAudit", "=", "apps", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerExporter._collect_certificate_data
Collect the learner completion data from the course certificate. Used for Instructor-paced courses. If no certificate is found, then returns the completed_date = None, grade = In Progress, on the idea that a certificate will eventually be generated. Args: enterprise_enroll...
integrated_channels/integrated_channel/exporters/learner_data.py
def _collect_certificate_data(self, enterprise_enrollment): """ Collect the learner completion data from the course certificate. Used for Instructor-paced courses. If no certificate is found, then returns the completed_date = None, grade = In Progress, on the idea that a certif...
def _collect_certificate_data(self, enterprise_enrollment): """ Collect the learner completion data from the course certificate. Used for Instructor-paced courses. If no certificate is found, then returns the completed_date = None, grade = In Progress, on the idea that a certif...
[ "Collect", "the", "learner", "completion", "data", "from", "the", "course", "certificate", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L173-L215
[ "def", "_collect_certificate_data", "(", "self", ",", "enterprise_enrollment", ")", ":", "if", "self", ".", "certificates_api", "is", "None", ":", "self", ".", "certificates_api", "=", "CertificatesApiClient", "(", "self", ".", "user", ")", "course_id", "=", "en...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerExporter._collect_grades_data
Collect the learner completion data from the Grades API. Used for self-paced courses. Args: enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to collect completion/grade data course_details (dict): the course deta...
integrated_channels/integrated_channel/exporters/learner_data.py
def _collect_grades_data(self, enterprise_enrollment, course_details): """ Collect the learner completion data from the Grades API. Used for self-paced courses. Args: enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to ...
def _collect_grades_data(self, enterprise_enrollment, course_details): """ Collect the learner completion data from the Grades API. Used for self-paced courses. Args: enterprise_enrollment (EnterpriseCourseEnrollment): the enterprise enrollment record for which we need to ...
[ "Collect", "the", "learner", "completion", "data", "from", "the", "Grades", "API", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/learner_data.py#L217-L282
[ "def", "_collect_grades_data", "(", "self", ",", "enterprise_enrollment", ",", "course_details", ")", ":", "if", "self", ".", "grades_api", "is", "None", ":", "self", ".", "grades_api", "=", "GradesApiClient", "(", "self", ".", "user", ")", "course_id", "=", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerInfoSerializer.get_enterprise_user_id
Get enterprise user id from user object. Arguments: obj (User): Django User object Returns: (int): Primary Key identifier for enterprise user object.
integrated_channels/xapi/serializers.py
def get_enterprise_user_id(self, obj): """ Get enterprise user id from user object. Arguments: obj (User): Django User object Returns: (int): Primary Key identifier for enterprise user object. """ # An enterprise learner can not belong to multipl...
def get_enterprise_user_id(self, obj): """ Get enterprise user id from user object. Arguments: obj (User): Django User object Returns: (int): Primary Key identifier for enterprise user object. """ # An enterprise learner can not belong to multipl...
[ "Get", "enterprise", "user", "id", "from", "user", "object", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/serializers.py#L30-L44
[ "def", "get_enterprise_user_id", "(", "self", ",", "obj", ")", ":", "# An enterprise learner can not belong to multiple enterprise customer at the same time", "# but if such scenario occurs we will pick the first.", "enterprise_learner", "=", "EnterpriseCustomerUser", ".", "objects", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
LearnerInfoSerializer.get_enterprise_sso_uid
Get enterprise SSO UID. Arguments: obj (User): Django User object Returns: (str): string containing UUID for enterprise customer's Identity Provider.
integrated_channels/xapi/serializers.py
def get_enterprise_sso_uid(self, obj): """ Get enterprise SSO UID. Arguments: obj (User): Django User object Returns: (str): string containing UUID for enterprise customer's Identity Provider. """ # An enterprise learner can not belong to multipl...
def get_enterprise_sso_uid(self, obj): """ Get enterprise SSO UID. Arguments: obj (User): Django User object Returns: (str): string containing UUID for enterprise customer's Identity Provider. """ # An enterprise learner can not belong to multipl...
[ "Get", "enterprise", "SSO", "UID", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/serializers.py#L46-L60
[ "def", "get_enterprise_sso_uid", "(", "self", ",", "obj", ")", ":", "# An enterprise learner can not belong to multiple enterprise customer at the same time", "# but if such scenario occurs we will pick the first.", "enterprise_learner", "=", "EnterpriseCustomerUser", ".", "objects", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
CourseInfoSerializer.get_course_duration
Get course's duration as a timedelta. Arguments: obj (CourseOverview): CourseOverview object Returns: (timedelta): Duration of a course.
integrated_channels/xapi/serializers.py
def get_course_duration(self, obj): """ Get course's duration as a timedelta. Arguments: obj (CourseOverview): CourseOverview object Returns: (timedelta): Duration of a course. """ duration = obj.end - obj.start if obj.start and obj.end else None...
def get_course_duration(self, obj): """ Get course's duration as a timedelta. Arguments: obj (CourseOverview): CourseOverview object Returns: (timedelta): Duration of a course. """ duration = obj.end - obj.start if obj.start and obj.end else None...
[ "Get", "course", "s", "duration", "as", "a", "timedelta", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/serializers.py#L76-L89
[ "def", "get_course_duration", "(", "self", ",", "obj", ")", ":", "duration", "=", "obj", ".", "end", "-", "obj", ".", "start", "if", "obj", ".", "start", "and", "obj", ".", "end", "else", "None", "if", "duration", ":", "return", "strfdelta", "(", "du...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataTransmitter.transmit
Transmit content metadata items to the integrated channel.
integrated_channels/sap_success_factors/transmitters/content_metadata.py
def transmit(self, payload, **kwargs): """ Transmit content metadata items to the integrated channel. """ items_to_create, items_to_update, items_to_delete, transmission_map = self._partition_items(payload) self._prepare_items_for_delete(items_to_delete) prepared_items = ...
def transmit(self, payload, **kwargs): """ Transmit content metadata items to the integrated channel. """ items_to_create, items_to_update, items_to_delete, transmission_map = self._partition_items(payload) self._prepare_items_for_delete(items_to_delete) prepared_items = ...
[ "Transmit", "content", "metadata", "items", "to", "the", "integrated", "channel", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/transmitters/content_metadata.py#L32-L75
[ "def", "transmit", "(", "self", ",", "payload", ",", "*", "*", "kwargs", ")", ":", "items_to_create", ",", "items_to_update", ",", "items_to_delete", ",", "transmission_map", "=", "self", ".", "_partition_items", "(", "payload", ")", "self", ".", "_prepare_ite...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataTransmitter._remove_failed_items
Remove content metadata items from the `items_to_create`, `items_to_update`, `items_to_delete` dicts. Arguments: failed_items (list): Failed Items to be removed. items_to_create (dict): dict containing the items created successfully. items_to_update (dict): dict containing t...
integrated_channels/sap_success_factors/transmitters/content_metadata.py
def _remove_failed_items(self, failed_items, items_to_create, items_to_update, items_to_delete): """ Remove content metadata items from the `items_to_create`, `items_to_update`, `items_to_delete` dicts. Arguments: failed_items (list): Failed Items to be removed. items_to...
def _remove_failed_items(self, failed_items, items_to_create, items_to_update, items_to_delete): """ Remove content metadata items from the `items_to_create`, `items_to_update`, `items_to_delete` dicts. Arguments: failed_items (list): Failed Items to be removed. items_to...
[ "Remove", "content", "metadata", "items", "from", "the", "items_to_create", "items_to_update", "items_to_delete", "dicts", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/transmitters/content_metadata.py#L77-L91
[ "def", "_remove_failed_items", "(", "self", ",", "failed_items", ",", "items_to_create", ",", "items_to_update", ",", "items_to_delete", ")", ":", "for", "item", "in", "failed_items", ":", "content_metadata_id", "=", "item", "[", "'courseID'", "]", "items_to_create"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
Command.parse_arguments
Parse and validate arguments for send_course_enrollments command. Arguments: *args: Positional arguments passed to the command **options: optional arguments passed to the command Returns: A tuple containing parsed values for 1. days (int): Integer showin...
integrated_channels/xapi/management/commands/send_course_enrollments.py
def parse_arguments(*args, **options): # pylint: disable=unused-argument """ Parse and validate arguments for send_course_enrollments command. Arguments: *args: Positional arguments passed to the command **options: optional arguments passed to the command Retur...
def parse_arguments(*args, **options): # pylint: disable=unused-argument """ Parse and validate arguments for send_course_enrollments command. Arguments: *args: Positional arguments passed to the command **options: optional arguments passed to the command Retur...
[ "Parse", "and", "validate", "arguments", "for", "send_course_enrollments", "command", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/management/commands/send_course_enrollments.py#L55-L83
[ "def", "parse_arguments", "(", "*", "args", ",", "*", "*", "options", ")", ":", "# pylint: disable=unused-argument", "days", "=", "options", ".", "get", "(", "'days'", ",", "1", ")", "enterprise_customer_uuid", "=", "options", ".", "get", "(", "'enterprise_cus...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
Command.handle
Send xAPI statements.
integrated_channels/xapi/management/commands/send_course_enrollments.py
def handle(self, *args, **options): """ Send xAPI statements. """ if not CourseEnrollment: raise NotConnectedToOpenEdX("This package must be installed in an OpenEdX environment.") days, enterprise_customer = self.parse_arguments(*args, **options) if enterpri...
def handle(self, *args, **options): """ Send xAPI statements. """ if not CourseEnrollment: raise NotConnectedToOpenEdX("This package must be installed in an OpenEdX environment.") days, enterprise_customer = self.parse_arguments(*args, **options) if enterpri...
[ "Send", "xAPI", "statements", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/management/commands/send_course_enrollments.py#L85-L109
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "if", "not", "CourseEnrollment", ":", "raise", "NotConnectedToOpenEdX", "(", "\"This package must be installed in an OpenEdX environment.\"", ")", "days", ",", "enterprise_customer", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
Command.send_xapi_statements
Send xAPI analytics data of the enterprise learners to the given LRS. Arguments: lrs_configuration (XAPILRSConfiguration): Configuration object containing LRS configurations of the LRS where to send xAPI learner analytics. days (int): Include course enrollment of this n...
integrated_channels/xapi/management/commands/send_course_enrollments.py
def send_xapi_statements(self, lrs_configuration, days): """ Send xAPI analytics data of the enterprise learners to the given LRS. Arguments: lrs_configuration (XAPILRSConfiguration): Configuration object containing LRS configurations of the LRS where to send xAPI l...
def send_xapi_statements(self, lrs_configuration, days): """ Send xAPI analytics data of the enterprise learners to the given LRS. Arguments: lrs_configuration (XAPILRSConfiguration): Configuration object containing LRS configurations of the LRS where to send xAPI l...
[ "Send", "xAPI", "analytics", "data", "of", "the", "enterprise", "learners", "to", "the", "given", "LRS", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/management/commands/send_course_enrollments.py#L111-L129
[ "def", "send_xapi_statements", "(", "self", ",", "lrs_configuration", ",", "days", ")", ":", "for", "course_enrollment", "in", "self", ".", "get_course_enrollments", "(", "lrs_configuration", ".", "enterprise_customer", ",", "days", ")", ":", "try", ":", "send_cou...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
Command.get_course_enrollments
Get course enrollments for all the learners of given enterprise customer. Arguments: enterprise_customer (EnterpriseCustomer): Include Course enrollments for learners of this enterprise customer. days (int): Include course enrollment of this number of days. Retu...
integrated_channels/xapi/management/commands/send_course_enrollments.py
def get_course_enrollments(self, enterprise_customer, days): """ Get course enrollments for all the learners of given enterprise customer. Arguments: enterprise_customer (EnterpriseCustomer): Include Course enrollments for learners of this enterprise customer. ...
def get_course_enrollments(self, enterprise_customer, days): """ Get course enrollments for all the learners of given enterprise customer. Arguments: enterprise_customer (EnterpriseCustomer): Include Course enrollments for learners of this enterprise customer. ...
[ "Get", "course", "enrollments", "for", "all", "the", "learners", "of", "given", "enterprise", "customer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/management/commands/send_course_enrollments.py#L131-L147
[ "def", "get_course_enrollments", "(", "self", ",", "enterprise_customer", ",", "days", ")", ":", "return", "CourseEnrollment", ".", "objects", ".", "filter", "(", "created__gt", "=", "datetime", ".", "datetime", ".", "now", "(", ")", "-", "datetime", ".", "t...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
course_modal
Django template tag that returns course information to display in a modal. You may pass in a particular course if you like. Otherwise, the modal will look for course context within the parent context. Usage: {% course_modal %} {% course_modal course %}
enterprise/templatetags/enterprise.py
def course_modal(context, course=None): """ Django template tag that returns course information to display in a modal. You may pass in a particular course if you like. Otherwise, the modal will look for course context within the parent context. Usage: {% course_modal %} {% course_m...
def course_modal(context, course=None): """ Django template tag that returns course information to display in a modal. You may pass in a particular course if you like. Otherwise, the modal will look for course context within the parent context. Usage: {% course_modal %} {% course_m...
[ "Django", "template", "tag", "that", "returns", "course", "information", "to", "display", "in", "a", "modal", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/templatetags/enterprise.py#L48-L71
[ "def", "course_modal", "(", "context", ",", "course", "=", "None", ")", ":", "if", "course", ":", "context", ".", "update", "(", "{", "'course_image_uri'", ":", "course", ".", "get", "(", "'course_image_uri'", ",", "''", ")", ",", "'course_title'", ":", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
link_to_modal
Django template filter that returns an anchor with attributes useful for course modal selection. General Usage: {{ link_text|link_to_modal:index }} Examples: {{ course_title|link_to_modal:forloop.counter0 }} {{ course_title|link_to_modal:3 }} {{ view_details_text|link_to_modal:...
enterprise/templatetags/enterprise.py
def link_to_modal(link_text, index, autoescape=True): # pylint: disable=unused-argument """ Django template filter that returns an anchor with attributes useful for course modal selection. General Usage: {{ link_text|link_to_modal:index }} Examples: {{ course_title|link_to_modal:forlo...
def link_to_modal(link_text, index, autoescape=True): # pylint: disable=unused-argument """ Django template filter that returns an anchor with attributes useful for course modal selection. General Usage: {{ link_text|link_to_modal:index }} Examples: {{ course_title|link_to_modal:forlo...
[ "Django", "template", "filter", "that", "returns", "an", "anchor", "with", "attributes", "useful", "for", "course", "modal", "selection", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/templatetags/enterprise.py#L91-L115
[ "def", "link_to_modal", "(", "link_text", ",", "index", ",", "autoescape", "=", "True", ")", ":", "# pylint: disable=unused-argument", "link", "=", "(", "'<a'", "' href=\"#!\"'", "' class=\"text-underline view-course-details-link\"'", "' id=\"view-course-details-link-{index}\"'...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
Command.handle
Unlink inactive EnterpriseCustomer(s) SAP learners.
integrated_channels/integrated_channel/management/commands/unlink_inactive_sap_learners.py
def handle(self, *args, **options): """ Unlink inactive EnterpriseCustomer(s) SAP learners. """ channels = self.get_integrated_channels(options) for channel in channels: channel_code = channel.channel_code() channel_pk = channel.pk if channel_...
def handle(self, *args, **options): """ Unlink inactive EnterpriseCustomer(s) SAP learners. """ channels = self.get_integrated_channels(options) for channel in channels: channel_code = channel.channel_code() channel_pk = channel.pk if channel_...
[ "Unlink", "inactive", "EnterpriseCustomer", "(", "s", ")", "SAP", "learners", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/management/commands/unlink_inactive_sap_learners.py#L23-L34
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "channels", "=", "self", ".", "get_integrated_channels", "(", "options", ")", "for", "channel", "in", "channels", ":", "channel_code", "=", "channel", ".", "channel_code", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
populate_data_sharing_consent
Populates the ``DataSharingConsent`` model with the ``enterprise`` application's consent data. Consent data from the ``enterprise`` application come from the ``EnterpriseCourseEnrollment`` model.
consent/migrations/0002_migrate_to_new_data_sharing_consent.py
def populate_data_sharing_consent(apps, schema_editor): """ Populates the ``DataSharingConsent`` model with the ``enterprise`` application's consent data. Consent data from the ``enterprise`` application come from the ``EnterpriseCourseEnrollment`` model. """ DataSharingConsent = apps.get_model('co...
def populate_data_sharing_consent(apps, schema_editor): """ Populates the ``DataSharingConsent`` model with the ``enterprise`` application's consent data. Consent data from the ``enterprise`` application come from the ``EnterpriseCourseEnrollment`` model. """ DataSharingConsent = apps.get_model('co...
[ "Populates", "the", "DataSharingConsent", "model", "with", "the", "enterprise", "application", "s", "consent", "data", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/migrations/0002_migrate_to_new_data_sharing_consent.py#L20-L45
[ "def", "populate_data_sharing_consent", "(", "apps", ",", "schema_editor", ")", ":", "DataSharingConsent", "=", "apps", ".", "get_model", "(", "'consent'", ",", "'DataSharingConsent'", ")", "EnterpriseCourseEnrollment", "=", "apps", ".", "get_model", "(", "'enterprise...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient.create_course_completion
Send a completion status payload to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransmissionAudit) containing completion status fields per Degreed documentation. Returns: ...
integrated_channels/degreed/client.py
def create_course_completion(self, user_id, payload): # pylint: disable=unused-argument """ Send a completion status payload to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransmissionAudi...
def create_course_completion(self, user_id, payload): # pylint: disable=unused-argument """ Send a completion status payload to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransmissionAudi...
[ "Send", "a", "completion", "status", "payload", "to", "the", "Degreed", "Completion", "Status", "endpoint" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L45-L66
[ "def", "create_course_completion", "(", "self", ",", "user_id", ",", "payload", ")", ":", "# pylint: disable=unused-argument", "return", "self", ".", "_post", "(", "urljoin", "(", "self", ".", "enterprise_configuration", ".", "degreed_base_url", ",", "self", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient.delete_course_completion
Delete a completion status previously sent to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransmissionAudit) containing the required completion status fields for deletion per Degreed docume...
integrated_channels/degreed/client.py
def delete_course_completion(self, user_id, payload): # pylint: disable=unused-argument """ Delete a completion status previously sent to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransm...
def delete_course_completion(self, user_id, payload): # pylint: disable=unused-argument """ Delete a completion status previously sent to the Degreed Completion Status endpoint Args: user_id: Unused. payload: JSON encoded object (serialized from DegreedLearnerDataTransm...
[ "Delete", "a", "completion", "status", "previously", "sent", "to", "the", "Degreed", "Completion", "Status", "endpoint" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L68-L89
[ "def", "delete_course_completion", "(", "self", ",", "user_id", ",", "payload", ")", ":", "# pylint: disable=unused-argument", "return", "self", ".", "_delete", "(", "urljoin", "(", "self", ".", "enterprise_configuration", ".", "degreed_base_url", ",", "self", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient._sync_content_metadata
Synchronize content metadata using the Degreed course content API. Args: serialized_data: JSON-encoded object containing content metadata. http_method: The HTTP method to use for the API request. Raises: ClientError: If Degreed API request fails.
integrated_channels/degreed/client.py
def _sync_content_metadata(self, serialized_data, http_method): """ Synchronize content metadata using the Degreed course content API. Args: serialized_data: JSON-encoded object containing content metadata. http_method: The HTTP method to use for the API request. ...
def _sync_content_metadata(self, serialized_data, http_method): """ Synchronize content metadata using the Degreed course content API. Args: serialized_data: JSON-encoded object containing content metadata. http_method: The HTTP method to use for the API request. ...
[ "Synchronize", "content", "metadata", "using", "the", "Degreed", "course", "content", "API", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L127-L158
[ "def", "_sync_content_metadata", "(", "self", ",", "serialized_data", ",", "http_method", ")", ":", "try", ":", "status_code", ",", "response_body", "=", "getattr", "(", "self", ",", "'_'", "+", "http_method", ")", "(", "urljoin", "(", "self", ".", "enterpri...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient._post
Make a POST request using the session object to a Degreed endpoint. Args: url (str): The url to send a POST request to. data (str): The json encoded payload to POST. scope (str): Must be one of the scopes Degreed expects: - `CONTENT_PROVIDER_SCOPE` ...
integrated_channels/degreed/client.py
def _post(self, url, data, scope): """ Make a POST request using the session object to a Degreed endpoint. Args: url (str): The url to send a POST request to. data (str): The json encoded payload to POST. scope (str): Must be one of the scopes Degreed expects...
def _post(self, url, data, scope): """ Make a POST request using the session object to a Degreed endpoint. Args: url (str): The url to send a POST request to. data (str): The json encoded payload to POST. scope (str): Must be one of the scopes Degreed expects...
[ "Make", "a", "POST", "request", "using", "the", "session", "object", "to", "a", "Degreed", "endpoint", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L160-L173
[ "def", "_post", "(", "self", ",", "url", ",", "data", ",", "scope", ")", ":", "self", ".", "_create_session", "(", "scope", ")", "response", "=", "self", ".", "session", ".", "post", "(", "url", ",", "data", "=", "data", ")", "return", "response", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient._delete
Make a DELETE request using the session object to a Degreed endpoint. Args: url (str): The url to send a DELETE request to. data (str): The json encoded payload to DELETE. scope (str): Must be one of the scopes Degreed expects: - `CONTENT_PROVIDER_SCO...
integrated_channels/degreed/client.py
def _delete(self, url, data, scope): """ Make a DELETE request using the session object to a Degreed endpoint. Args: url (str): The url to send a DELETE request to. data (str): The json encoded payload to DELETE. scope (str): Must be one of the scopes Degreed...
def _delete(self, url, data, scope): """ Make a DELETE request using the session object to a Degreed endpoint. Args: url (str): The url to send a DELETE request to. data (str): The json encoded payload to DELETE. scope (str): Must be one of the scopes Degreed...
[ "Make", "a", "DELETE", "request", "using", "the", "session", "object", "to", "a", "Degreed", "endpoint", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L175-L188
[ "def", "_delete", "(", "self", ",", "url", ",", "data", ",", "scope", ")", ":", "self", ".", "_create_session", "(", "scope", ")", "response", "=", "self", ".", "session", ".", "delete", "(", "url", ",", "data", "=", "data", ")", "return", "response"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient._create_session
Instantiate a new session object for use in connecting with Degreed
integrated_channels/degreed/client.py
def _create_session(self, scope): """ Instantiate a new session object for use in connecting with Degreed """ now = datetime.datetime.utcnow() if self.session is None or self.expires_at is None or now >= self.expires_at: # Create a new session with a valid token ...
def _create_session(self, scope): """ Instantiate a new session object for use in connecting with Degreed """ now = datetime.datetime.utcnow() if self.session is None or self.expires_at is None or now >= self.expires_at: # Create a new session with a valid token ...
[ "Instantiate", "a", "new", "session", "object", "for", "use", "in", "connecting", "with", "Degreed" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/client.py#L190-L211
[ "def", "_create_session", "(", "self", ",", "scope", ")", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "if", "self", ".", "session", "is", "None", "or", "self", ".", "expires_at", "is", "None", "or", "now", ">=", "self", "."...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedAPIClient._get_oauth_access_token
Retrieves OAuth 2.0 access token using the client credentials grant. Args: client_id (str): API client ID client_secret (str): API client secret user_id (str): Degreed company ID user_password (str): Degreed user password scope (str): Must be one of t...
integrated_channels/degreed/client.py
def _get_oauth_access_token(self, client_id, client_secret, user_id, user_password, scope): """ Retrieves OAuth 2.0 access token using the client credentials grant. Args: client_id (str): API client ID client_secret (str): API client secret user_id (str): Degreed com...
def _get_oauth_access_token(self, client_id, client_secret, user_id, user_password, scope): """ Retrieves OAuth 2.0 access token using the client credentials grant. Args: client_id (str): API client ID client_secret (str): API client secret user_id (str): Degreed com...
[ "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/degreed/client.py#L213-L249
[ "def", "_get_oauth_access_token", "(", "self", ",", "client_id", ",", "client_secret", ",", "user_id", ",", "user_password", ",", "scope", ")", ":", "response", "=", "requests", ".", "post", "(", "urljoin", "(", "self", ".", "enterprise_configuration", ".", "d...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseViewSet.ensure_data_exists
Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it.
enterprise/api/v1/views.py
def ensure_data_exists(self, request, data, error_message=None): """ Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it. """ if not data: error_message = ( error_message or "Unable to fetch API response from e...
def ensure_data_exists(self, request, data, error_message=None): """ Ensure that the wrapped API client's response brings us valid data. If not, raise an error and log it. """ if not data: error_message = ( error_message or "Unable to fetch API response from e...
[ "Ensure", "that", "the", "wrapped", "API", "client", "s", "response", "brings", "us", "valid", "data", ".", "If", "not", "raise", "an", "error", "and", "log", "it", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L60-L69
[ "def", "ensure_data_exists", "(", "self", ",", "request", ",", "data", ",", "error_message", "=", "None", ")", ":", "if", "not", "data", ":", "error_message", "=", "(", "error_message", "or", "\"Unable to fetch API response from endpoint '{}'.\"", ".", "format", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerViewSet.contains_content_items
Return whether or not the specified content is available to the EnterpriseCustomer. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in the EnterpriseCustomerCatalogs associated with this EnterpriseCustomer. At least one course ...
enterprise/api/v1/views.py
def contains_content_items(self, request, pk, course_run_ids, program_uuids): """ Return whether or not the specified content is available to the EnterpriseCustomer. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in th...
def contains_content_items(self, request, pk, course_run_ids, program_uuids): """ Return whether or not the specified content is available to the EnterpriseCustomer. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in th...
[ "Return", "whether", "or", "not", "the", "specified", "content", "is", "available", "to", "the", "EnterpriseCustomer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L124-L145
[ "def", "contains_content_items", "(", "self", ",", "request", ",", "pk", ",", "course_run_ids", ",", "program_uuids", ")", ":", "enterprise_customer", "=", "self", ".", "get_object", "(", ")", "# Maintain plus characters in course key.", "course_run_ids", "=", "[", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerViewSet.courses
Retrieve the list of courses contained within the catalog linked to this enterprise. Only courses with active course runs are returned. A course run is considered active if it is currently open for enrollment, or will open in the future.
enterprise/api/v1/views.py
def courses(self, request, pk=None): # pylint: disable=invalid-name,unused-argument """ Retrieve the list of courses contained within the catalog linked to this enterprise. Only courses with active course runs are returned. A course run is considered active if it is currently open for ...
def courses(self, request, pk=None): # pylint: disable=invalid-name,unused-argument """ Retrieve the list of courses contained within the catalog linked to this enterprise. Only courses with active course runs are returned. A course run is considered active if it is currently open for ...
[ "Retrieve", "the", "list", "of", "courses", "contained", "within", "the", "catalog", "linked", "to", "this", "enterprise", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L149-L189
[ "def", "courses", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "# pylint: disable=invalid-name,unused-argument", "enterprise_customer", "=", "self", ".", "get_object", "(", ")", "self", ".", "check_object_permissions", "(", "request", ",", "enter...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerViewSet.course_enrollments
Creates a course enrollment for an EnterpriseCustomerUser.
enterprise/api/v1/views.py
def course_enrollments(self, request, pk): """ Creates a course enrollment for an EnterpriseCustomerUser. """ enterprise_customer = self.get_object() serializer = serializers.EnterpriseCustomerCourseEnrollmentsSerializer( data=request.data, many=True, ...
def course_enrollments(self, request, pk): """ Creates a course enrollment for an EnterpriseCustomerUser. """ enterprise_customer = self.get_object() serializer = serializers.EnterpriseCustomerCourseEnrollmentsSerializer( data=request.data, many=True, ...
[ "Creates", "a", "course", "enrollment", "for", "an", "EnterpriseCustomerUser", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L197-L214
[ "def", "course_enrollments", "(", "self", ",", "request", ",", "pk", ")", ":", "enterprise_customer", "=", "self", ".", "get_object", "(", ")", "serializer", "=", "serializers", ".", "EnterpriseCustomerCourseEnrollmentsSerializer", "(", "data", "=", "request", "."...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerViewSet.with_access_to
Returns the list of enterprise customers the user has a specified group permission access to.
enterprise/api/v1/views.py
def with_access_to(self, request, *args, **kwargs): # pylint: disable=invalid-name,unused-argument """ Returns the list of enterprise customers the user has a specified group permission access to. """ self.queryset = self.queryset.order_by('name') enterprise_id = self.request.qu...
def with_access_to(self, request, *args, **kwargs): # pylint: disable=invalid-name,unused-argument """ Returns the list of enterprise customers the user has a specified group permission access to. """ self.queryset = self.queryset.order_by('name') enterprise_id = self.request.qu...
[ "Returns", "the", "list", "of", "enterprise", "customers", "the", "user", "has", "a", "specified", "group", "permission", "access", "to", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L221-L236
[ "def", "with_access_to", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=invalid-name,unused-argument", "self", ".", "queryset", "=", "self", ".", "queryset", ".", "order_by", "(", "'name'", ")", "enterprise...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerUserViewSet.entitlements
Retrieve the list of entitlements available to this learner. Only those entitlements are returned that satisfy enterprise customer's data sharing setting. Arguments: request (HttpRequest): Reference to in-progress request instance. pk (Int): Primary key value of the selected en...
enterprise/api/v1/views.py
def entitlements(self, request, pk=None): # pylint: disable=invalid-name,unused-argument """ Retrieve the list of entitlements available to this learner. Only those entitlements are returned that satisfy enterprise customer's data sharing setting. Arguments: request (HttpR...
def entitlements(self, request, pk=None): # pylint: disable=invalid-name,unused-argument """ Retrieve the list of entitlements available to this learner. Only those entitlements are returned that satisfy enterprise customer's data sharing setting. Arguments: request (HttpR...
[ "Retrieve", "the", "list", "of", "entitlements", "available", "to", "this", "learner", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L304-L320
[ "def", "entitlements", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "# pylint: disable=invalid-name,unused-argument", "enterprise_customer_user", "=", "self", ".", "get_object", "(", ")", "instance", "=", "{", "\"entitlements\"", ":", "enterprise_c...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerCatalogViewSet.contains_content_items
Return whether or not the EnterpriseCustomerCatalog contains the specified content. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in the EnterpriseCustomerCatalog. At least one course run key or program UUID value must be inc...
enterprise/api/v1/views.py
def contains_content_items(self, request, pk, course_run_ids, program_uuids): """ Return whether or not the EnterpriseCustomerCatalog contains the specified content. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in th...
def contains_content_items(self, request, pk, course_run_ids, program_uuids): """ Return whether or not the EnterpriseCustomerCatalog contains the specified content. Multiple course_run_ids and/or program_uuids query parameters can be sent to this view to check for their existence in th...
[ "Return", "whether", "or", "not", "the", "EnterpriseCustomerCatalog", "contains", "the", "specified", "content", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L389-L411
[ "def", "contains_content_items", "(", "self", ",", "request", ",", "pk", ",", "course_run_ids", ",", "program_uuids", ")", ":", "enterprise_customer_catalog", "=", "self", ".", "get_object", "(", ")", "# Maintain plus characters in course key.", "course_run_ids", "=", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerCatalogViewSet.course_detail
Return the metadata for the specified course. The course needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint.
enterprise/api/v1/views.py
def course_detail(self, request, pk, course_key): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified course. The course needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint. ...
def course_detail(self, request, pk, course_key): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified course. The course needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint. ...
[ "Return", "the", "metadata", "for", "the", "specified", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L417-L432
[ "def", "course_detail", "(", "self", ",", "request", ",", "pk", ",", "course_key", ")", ":", "# pylint: disable=invalid-name,unused-argument", "enterprise_customer_catalog", "=", "self", ".", "get_object", "(", ")", "course", "=", "enterprise_customer_catalog", ".", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerCatalogViewSet.course_run_detail
Return the metadata for the specified course run. The course run needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint.
enterprise/api/v1/views.py
def course_run_detail(self, request, pk, course_id): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified course run. The course run needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoi...
def course_run_detail(self, request, pk, course_id): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified course run. The course run needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoi...
[ "Return", "the", "metadata", "for", "the", "specified", "course", "run", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L438-L453
[ "def", "course_run_detail", "(", "self", ",", "request", ",", "pk", ",", "course_id", ")", ":", "# pylint: disable=invalid-name,unused-argument", "enterprise_customer_catalog", "=", "self", ".", "get_object", "(", ")", "course_run", "=", "enterprise_customer_catalog", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerCatalogViewSet.program_detail
Return the metadata for the specified program. The program needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint.
enterprise/api/v1/views.py
def program_detail(self, request, pk, program_uuid): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified program. The program needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint. ...
def program_detail(self, request, pk, program_uuid): # pylint: disable=invalid-name,unused-argument """ Return the metadata for the specified program. The program needs to be included in the specified EnterpriseCustomerCatalog in order for metadata to be returned from this endpoint. ...
[ "Return", "the", "metadata", "for", "the", "specified", "program", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L459-L474
[ "def", "program_detail", "(", "self", ",", "request", ",", "pk", ",", "program_uuid", ")", ":", "# pylint: disable=invalid-name,unused-argument", "enterprise_customer_catalog", "=", "self", ".", "get_object", "(", ")", "program", "=", "enterprise_customer_catalog", ".",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseCatalogViewSet.list
DRF view to list all catalogs. Arguments: request (HttpRequest): Current request Returns: (Response): DRF response object containing course catalogs.
enterprise/api/v1/views.py
def list(self, request): """ DRF view to list all catalogs. Arguments: request (HttpRequest): Current request Returns: (Response): DRF response object containing course catalogs. """ catalog_api = CourseCatalogApiClient(request.user) cata...
def list(self, request): """ DRF view to list all catalogs. Arguments: request (HttpRequest): Current request Returns: (Response): DRF response object containing course catalogs. """ catalog_api = CourseCatalogApiClient(request.user) cata...
[ "DRF", "view", "to", "list", "all", "catalogs", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L484-L498
[ "def", "list", "(", "self", ",", "request", ")", ":", "catalog_api", "=", "CourseCatalogApiClient", "(", "request", ".", "user", ")", "catalogs", "=", "catalog_api", ".", "get_paginated_catalogs", "(", "request", ".", "GET", ")", "self", ".", "ensure_data_exis...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseCatalogViewSet.retrieve
DRF view to get catalog details. Arguments: request (HttpRequest): Current request pk (int): Course catalog identifier Returns: (Response): DRF response object containing course catalogs.
enterprise/api/v1/views.py
def retrieve(self, request, pk=None): # pylint: disable=invalid-name """ DRF view to get catalog details. Arguments: request (HttpRequest): Current request pk (int): Course catalog identifier Returns: (Response): DRF response object containing cours...
def retrieve(self, request, pk=None): # pylint: disable=invalid-name """ DRF view to get catalog details. Arguments: request (HttpRequest): Current request pk (int): Course catalog identifier Returns: (Response): DRF response object containing cours...
[ "DRF", "view", "to", "get", "catalog", "details", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L500-L522
[ "def", "retrieve", "(", "self", ",", "request", ",", "pk", "=", "None", ")", ":", "# pylint: disable=invalid-name", "catalog_api", "=", "CourseCatalogApiClient", "(", "request", ".", "user", ")", "catalog", "=", "catalog_api", ".", "get_catalog", "(", "pk", ")...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCourseCatalogViewSet.courses
Retrieve the list of courses contained within this catalog. Only courses with active course runs are returned. A course run is considered active if it is currently open for enrollment, or will open in the future.
enterprise/api/v1/views.py
def courses(self, request, enterprise_customer, pk=None): # pylint: disable=invalid-name """ Retrieve the list of courses contained within this catalog. Only courses with active course runs are returned. A course run is considered active if it is currently open for enrollment, or will ...
def courses(self, request, enterprise_customer, pk=None): # pylint: disable=invalid-name """ Retrieve the list of courses contained within this catalog. Only courses with active course runs are returned. A course run is considered active if it is currently open for enrollment, or will ...
[ "Retrieve", "the", "list", "of", "courses", "contained", "within", "this", "catalog", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L526-L550
[ "def", "courses", "(", "self", ",", "request", ",", "enterprise_customer", ",", "pk", "=", "None", ")", ":", "# pylint: disable=invalid-name", "catalog_api", "=", "CourseCatalogApiClient", "(", "request", ".", "user", ",", "enterprise_customer", ".", "site", ")", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
CouponCodesView.get_required_query_params
Gets ``email``, ``enterprise_name``, and ``number_of_codes``, which are the relevant parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``email``, ``enterprise_name``, and ``number_of_codes`` from the request.
enterprise/api/v1/views.py
def get_required_query_params(self, request): """ Gets ``email``, ``enterprise_name``, and ``number_of_codes``, which are the relevant parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``email``, ``enterprise_name``, and ``number_of_cod...
def get_required_query_params(self, request): """ Gets ``email``, ``enterprise_name``, and ``number_of_codes``, which are the relevant parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``email``, ``enterprise_name``, and ``number_of_cod...
[ "Gets", "email", "enterprise_name", "and", "number_of_codes", "which", "are", "the", "relevant", "parameters", "for", "this", "API", "endpoint", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L583-L601
[ "def", "get_required_query_params", "(", "self", ",", "request", ")", ":", "email", "=", "get_request_value", "(", "request", ",", "self", ".", "REQUIRED_PARAM_EMAIL", ",", "''", ")", "enterprise_name", "=", "get_request_value", "(", "request", ",", "self", ".",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
CouponCodesView.get_missing_params_message
Get a user-friendly message indicating a missing parameter for the API endpoint.
enterprise/api/v1/views.py
def get_missing_params_message(self, parameter_state): """ Get a user-friendly message indicating a missing parameter for the API endpoint. """ params = ', '.join(name for name, present in parameter_state if not present) return self.MISSING_REQUIRED_PARAMS_MSG.format(params)
def get_missing_params_message(self, parameter_state): """ Get a user-friendly message indicating a missing parameter for the API endpoint. """ params = ', '.join(name for name, present in parameter_state if not present) return self.MISSING_REQUIRED_PARAMS_MSG.format(params)
[ "Get", "a", "user", "-", "friendly", "message", "indicating", "a", "missing", "parameter", "for", "the", "API", "endpoint", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L603-L608
[ "def", "get_missing_params_message", "(", "self", ",", "parameter_state", ")", ":", "params", "=", "', '", ".", "join", "(", "name", "for", "name", ",", "present", "in", "parameter_state", "if", "not", "present", ")", "return", "self", ".", "MISSING_REQUIRED_P...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
CouponCodesView.post
POST /enterprise/api/v1/request_codes Requires a JSON object of the following format: >>> { >>> "email": "bob@alice.com", >>> "enterprise_name": "IBM", >>> "number_of_codes": "50" >>> } Keys: *email* Email of the customer who has ...
enterprise/api/v1/views.py
def post(self, request): """ POST /enterprise/api/v1/request_codes Requires a JSON object of the following format: >>> { >>> "email": "bob@alice.com", >>> "enterprise_name": "IBM", >>> "number_of_codes": "50" >>> } Keys: *emai...
def post(self, request): """ POST /enterprise/api/v1/request_codes Requires a JSON object of the following format: >>> { >>> "email": "bob@alice.com", >>> "enterprise_name": "IBM", >>> "number_of_codes": "50" >>> } Keys: *emai...
[ "POST", "/", "enterprise", "/", "api", "/", "v1", "/", "request_codes" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/api/v1/views.py#L611-L677
[ "def", "post", "(", "self", ",", "request", ")", ":", "try", ":", "email", ",", "enterprise_name", ",", "number_of_codes", "=", "self", ".", "get_required_query_params", "(", "request", ")", "except", "CodesAPIRequestError", "as", "invalid_request", ":", "return...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_title
Return the title of the content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_title(self, content_metadata_item): """ Return the title of the content item. """ title_with_locales = [] for locale in self.enterprise_configuration.get_locales(): title_with_locales.append({ 'locale': locale, 'value': c...
def transform_title(self, content_metadata_item): """ Return the title of the content item. """ title_with_locales = [] for locale in self.enterprise_configuration.get_locales(): title_with_locales.append({ 'locale': locale, 'value': c...
[ "Return", "the", "title", "of", "the", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L57-L69
[ "def", "transform_title", "(", "self", ",", "content_metadata_item", ")", ":", "title_with_locales", "=", "[", "]", "for", "locale", "in", "self", ".", "enterprise_configuration", ".", "get_locales", "(", ")", ":", "title_with_locales", ".", "append", "(", "{", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_description
Return the description of the content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_description(self, content_metadata_item): """ Return the description of the content item. """ description_with_locales = [] for locale in self.enterprise_configuration.get_locales(): description_with_locales.append({ 'locale': locale, ...
def transform_description(self, content_metadata_item): """ Return the description of the content item. """ description_with_locales = [] for locale in self.enterprise_configuration.get_locales(): description_with_locales.append({ 'locale': locale, ...
[ "Return", "the", "description", "of", "the", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L71-L87
[ "def", "transform_description", "(", "self", ",", "content_metadata_item", ")", ":", "description_with_locales", "=", "[", "]", "for", "locale", "in", "self", ".", "enterprise_configuration", ".", "get_locales", "(", ")", ":", "description_with_locales", ".", "appen...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_image
Return the image URI of the content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_image(self, content_metadata_item): """ Return the image URI of the content item. """ image_url = '' if content_metadata_item['content_type'] in ['course', 'program']: image_url = content_metadata_item.get('card_image_url') elif content_metadata_...
def transform_image(self, content_metadata_item): """ Return the image URI of the content item. """ image_url = '' if content_metadata_item['content_type'] in ['course', 'program']: image_url = content_metadata_item.get('card_image_url') elif content_metadata_...
[ "Return", "the", "image", "URI", "of", "the", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L89-L99
[ "def", "transform_image", "(", "self", ",", "content_metadata_item", ")", ":", "image_url", "=", "''", "if", "content_metadata_item", "[", "'content_type'", "]", "in", "[", "'course'", ",", "'program'", "]", ":", "image_url", "=", "content_metadata_item", ".", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_launch_points
Return the content metadata item launch points. SAPSF allows you to transmit an arry of content launch points which are meant to represent sections of a content item which a learner can launch into from SAPSF. Currently, we only provide a single launch point for a content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_launch_points(self, content_metadata_item): """ Return the content metadata item launch points. SAPSF allows you to transmit an arry of content launch points which are meant to represent sections of a content item which a learner can launch into from SAPSF. Current...
def transform_launch_points(self, content_metadata_item): """ Return the content metadata item launch points. SAPSF allows you to transmit an arry of content launch points which are meant to represent sections of a content item which a learner can launch into from SAPSF. Current...
[ "Return", "the", "content", "metadata", "item", "launch", "points", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L101-L118
[ "def", "transform_launch_points", "(", "self", ",", "content_metadata_item", ")", ":", "return", "[", "{", "'providerID'", ":", "self", ".", "enterprise_configuration", ".", "provider_id", ",", "'launchURL'", ":", "content_metadata_item", "[", "'enrollment_url'", "]",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_courserun_title
Return the title of the courserun content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_courserun_title(self, content_metadata_item): """ Return the title of the courserun content item. """ title = content_metadata_item.get('title') or '' course_run_start = content_metadata_item.get('start') if course_run_start: if course_available...
def transform_courserun_title(self, content_metadata_item): """ Return the title of the courserun content item. """ title = content_metadata_item.get('title') or '' course_run_start = content_metadata_item.get('start') if course_run_start: if course_available...
[ "Return", "the", "title", "of", "the", "courserun", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L132-L159
[ "def", "transform_courserun_title", "(", "self", ",", "content_metadata_item", ")", ":", "title", "=", "content_metadata_item", ".", "get", "(", "'title'", ")", "or", "''", "course_run_start", "=", "content_metadata_item", ".", "get", "(", "'start'", ")", "if", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_courserun_description
Return the description of the courserun content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_courserun_description(self, content_metadata_item): """ Return the description of the courserun content item. """ description_with_locales = [] content_metadata_language_code = transform_language_code(content_metadata_item.get('content_language', '')) for lo...
def transform_courserun_description(self, content_metadata_item): """ Return the description of the courserun content item. """ description_with_locales = [] content_metadata_language_code = transform_language_code(content_metadata_item.get('content_language', '')) for lo...
[ "Return", "the", "description", "of", "the", "courserun", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L161-L178
[ "def", "transform_courserun_description", "(", "self", ",", "content_metadata_item", ")", ":", "description_with_locales", "=", "[", "]", "content_metadata_language_code", "=", "transform_language_code", "(", "content_metadata_item", ".", "get", "(", "'content_language'", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.transform_courserun_schedule
Return the schedule of the courseun content item.
integrated_channels/sap_success_factors/exporters/content_metadata.py
def transform_courserun_schedule(self, content_metadata_item): """ Return the schedule of the courseun content item. """ start = content_metadata_item.get('start') or UNIX_MIN_DATE_STRING end = content_metadata_item.get('end') or UNIX_MAX_DATE_STRING return [{ ...
def transform_courserun_schedule(self, content_metadata_item): """ Return the schedule of the courseun content item. """ start = content_metadata_item.get('start') or UNIX_MIN_DATE_STRING end = content_metadata_item.get('end') or UNIX_MAX_DATE_STRING return [{ ...
[ "Return", "the", "schedule", "of", "the", "courseun", "content", "item", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L180-L190
[ "def", "transform_courserun_schedule", "(", "self", ",", "content_metadata_item", ")", ":", "start", "=", "content_metadata_item", ".", "get", "(", "'start'", ")", "or", "UNIX_MIN_DATE_STRING", "end", "=", "content_metadata_item", ".", "get", "(", "'end'", ")", "o...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
SapSuccessFactorsContentMetadataExporter.get_content_id
Return the id for the given content_metadata_item, `uuid` for programs or `key` for other content
integrated_channels/sap_success_factors/exporters/content_metadata.py
def get_content_id(self, content_metadata_item): """ Return the id for the given content_metadata_item, `uuid` for programs or `key` for other content """ content_id = content_metadata_item.get('key', '') if content_metadata_item['content_type'] == 'program': content_...
def get_content_id(self, content_metadata_item): """ Return the id for the given content_metadata_item, `uuid` for programs or `key` for other content """ content_id = content_metadata_item.get('key', '') if content_metadata_item['content_type'] == 'program': content_...
[ "Return", "the", "id", "for", "the", "given", "content_metadata_item", "uuid", "for", "programs", "or", "key", "for", "other", "content" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/sap_success_factors/exporters/content_metadata.py#L198-L205
[ "def", "get_content_id", "(", "self", ",", "content_metadata_item", ")", ":", "content_id", "=", "content_metadata_item", ".", "get", "(", "'key'", ",", "''", ")", "if", "content_metadata_item", "[", "'content_type'", "]", "==", "'program'", ":", "content_id", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
parse_datetime_to_epoch
Convert an ISO-8601 datetime string to a Unix epoch timestamp in some magnitude. By default, returns seconds.
integrated_channels/utils.py
def parse_datetime_to_epoch(datestamp, magnitude=1.0): """ Convert an ISO-8601 datetime string to a Unix epoch timestamp in some magnitude. By default, returns seconds. """ parsed_datetime = parse_lms_api_datetime(datestamp) time_since_epoch = parsed_datetime - UNIX_EPOCH return int(time_si...
def parse_datetime_to_epoch(datestamp, magnitude=1.0): """ Convert an ISO-8601 datetime string to a Unix epoch timestamp in some magnitude. By default, returns seconds. """ parsed_datetime = parse_lms_api_datetime(datestamp) time_since_epoch = parsed_datetime - UNIX_EPOCH return int(time_si...
[ "Convert", "an", "ISO", "-", "8601", "datetime", "string", "to", "a", "Unix", "epoch", "timestamp", "in", "some", "magnitude", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/utils.py#L23-L31
[ "def", "parse_datetime_to_epoch", "(", "datestamp", ",", "magnitude", "=", "1.0", ")", ":", "parsed_datetime", "=", "parse_lms_api_datetime", "(", "datestamp", ")", "time_since_epoch", "=", "parsed_datetime", "-", "UNIX_EPOCH", "return", "int", "(", "time_since_epoch"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
current_time_is_in_interval
Determine whether the current time is on the interval [start, end].
integrated_channels/utils.py
def current_time_is_in_interval(start, end): """ Determine whether the current time is on the interval [start, end]. """ interval_start = parse_lms_api_datetime(start or UNIX_MIN_DATE_STRING) interval_end = parse_lms_api_datetime(end or UNIX_MAX_DATE_STRING) return interval_start <= timezone.now...
def current_time_is_in_interval(start, end): """ Determine whether the current time is on the interval [start, end]. """ interval_start = parse_lms_api_datetime(start or UNIX_MIN_DATE_STRING) interval_end = parse_lms_api_datetime(end or UNIX_MAX_DATE_STRING) return interval_start <= timezone.now...
[ "Determine", "whether", "the", "current", "time", "is", "on", "the", "interval", "[", "start", "end", "]", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/utils.py#L41-L47
[ "def", "current_time_is_in_interval", "(", "start", ",", "end", ")", ":", "interval_start", "=", "parse_lms_api_datetime", "(", "start", "or", "UNIX_MIN_DATE_STRING", ")", "interval_end", "=", "parse_lms_api_datetime", "(", "end", "or", "UNIX_MAX_DATE_STRING", ")", "r...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
chunks
Yield successive n-sized chunks from dictionary.
integrated_channels/utils.py
def chunks(dictionary, chunk_size): """ Yield successive n-sized chunks from dictionary. """ iterable = iter(dictionary) for __ in range(0, len(dictionary), chunk_size): yield {key: dictionary[key] for key in islice(iterable, chunk_size)}
def chunks(dictionary, chunk_size): """ Yield successive n-sized chunks from dictionary. """ iterable = iter(dictionary) for __ in range(0, len(dictionary), chunk_size): yield {key: dictionary[key] for key in islice(iterable, chunk_size)}
[ "Yield", "successive", "n", "-", "sized", "chunks", "from", "dictionary", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/utils.py#L50-L56
[ "def", "chunks", "(", "dictionary", ",", "chunk_size", ")", ":", "iterable", "=", "iter", "(", "dictionary", ")", "for", "__", "in", "range", "(", "0", ",", "len", "(", "dictionary", ")", ",", "chunk_size", ")", ":", "yield", "{", "key", ":", "dictio...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
strfdelta
Convert a datetime.timedelta object or a regular number to a custom-formatted string. This function works like the strftime() method works for datetime.datetime objects. The fmt argument allows custom formatting to be specified. Fields can include seconds, minutes, hours, days, and weeks. Each field...
integrated_channels/utils.py
def strfdelta(tdelta, fmt='{D:02}d {H:02}h {M:02}m {S:02}s', input_type='timedelta'): """ Convert a datetime.timedelta object or a regular number to a custom-formatted string. This function works like the strftime() method works for datetime.datetime objects. The fmt argument allows custom formatt...
def strfdelta(tdelta, fmt='{D:02}d {H:02}h {M:02}m {S:02}s', input_type='timedelta'): """ Convert a datetime.timedelta object or a regular number to a custom-formatted string. This function works like the strftime() method works for datetime.datetime objects. The fmt argument allows custom formatt...
[ "Convert", "a", "datetime", ".", "timedelta", "object", "or", "a", "regular", "number", "to", "a", "custom", "-", "formatted", "string", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/utils.py#L59-L122
[ "def", "strfdelta", "(", "tdelta", ",", "fmt", "=", "'{D:02}d {H:02}h {M:02}m {S:02}s'", ",", "input_type", "=", "'timedelta'", ")", ":", "# Convert tdelta to integer seconds.", "if", "input_type", "==", "'timedelta'", ":", "remainder", "=", "int", "(", "tdelta", "....
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DegreedContentMetadataExporter.transform_description
Return the transformed version of the course description. We choose one value out of the course's full description, short description, and title depending on availability and length limits.
integrated_channels/degreed/exporters/content_metadata.py
def transform_description(self, content_metadata_item): """ Return the transformed version of the course description. We choose one value out of the course's full description, short description, and title depending on availability and length limits. """ full_description ...
def transform_description(self, content_metadata_item): """ Return the transformed version of the course description. We choose one value out of the course's full description, short description, and title depending on availability and length limits. """ full_description ...
[ "Return", "the", "transformed", "version", "of", "the", "course", "description", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/degreed/exporters/content_metadata.py#L33-L43
[ "def", "transform_description", "(", "self", ",", "content_metadata_item", ")", ":", "full_description", "=", "content_metadata_item", ".", "get", "(", "'full_description'", ")", "or", "''", "if", "0", "<", "len", "(", "full_description", ")", "<=", "self", ".",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
logo_path
Delete the file if it already exist and returns the enterprise customer logo image path. Arguments: instance (:class:`.EnterpriseCustomerBrandingConfiguration`): EnterpriseCustomerBrandingConfiguration object filename (str): file to upload Returns: path: path of image file e.g. enterpr...
enterprise/models.py
def logo_path(instance, filename): """ Delete the file if it already exist and returns the enterprise customer logo image path. Arguments: instance (:class:`.EnterpriseCustomerBrandingConfiguration`): EnterpriseCustomerBrandingConfiguration object filename (str): file to upload Returns...
def logo_path(instance, filename): """ Delete the file if it already exist and returns the enterprise customer logo image path. Arguments: instance (:class:`.EnterpriseCustomerBrandingConfiguration`): EnterpriseCustomerBrandingConfiguration object filename (str): file to upload Returns...
[ "Delete", "the", "file", "if", "it", "already", "exist", "and", "returns", "the", "enterprise", "customer", "logo", "image", "path", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L888-L905
[ "def", "logo_path", "(", "instance", ",", "filename", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", ".", "lower", "(", ")", "instance_id", "=", "str", "(", "instance", ".", "id", ")", "fullname",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerUserManager.get_link_by_email
Return link by email.
enterprise/models.py
def get_link_by_email(self, user_email): """ Return link by email. """ try: user = User.objects.get(email=user_email) try: return self.get(user_id=user.id) except EnterpriseCustomerUser.DoesNotExist: pass except ...
def get_link_by_email(self, user_email): """ Return link by email. """ try: user = User.objects.get(email=user_email) try: return self.get(user_id=user.id) except EnterpriseCustomerUser.DoesNotExist: pass except ...
[ "Return", "link", "by", "email", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L510-L528
[ "def", "get_link_by_email", "(", "self", ",", "user_email", ")", ":", "try", ":", "user", "=", "User", ".", "objects", ".", "get", "(", "email", "=", "user_email", ")", "try", ":", "return", "self", ".", "get", "(", "user_id", "=", "user", ".", "id",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerUserManager.link_user
Link user email to Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is created instead.
enterprise/models.py
def link_user(self, enterprise_customer, user_email): """ Link user email to Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is created instead. """ try: ...
def link_user(self, enterprise_customer, user_email): """ Link user email to Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is created instead. """ try: ...
[ "Link", "user", "email", "to", "Enterprise", "Customer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L530-L542
[ "def", "link_user", "(", "self", ",", "enterprise_customer", ",", "user_email", ")", ":", "try", ":", "existing_user", "=", "User", ".", "objects", ".", "get", "(", "email", "=", "user_email", ")", "self", ".", "get_or_create", "(", "enterprise_customer", "=...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerUserManager.unlink_user
Unlink user email from Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is deleted instead. Raises EnterpriseCustomerUser.DoesNotExist if instance of :class:`django.contrib.auth.model...
enterprise/models.py
def unlink_user(self, enterprise_customer, user_email): """ Unlink user email from Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is deleted instead. Raises Enterpri...
def unlink_user(self, enterprise_customer, user_email): """ Unlink user email from Enterprise Customer. If :class:`django.contrib.auth.models.User` instance with specified email does not exist, :class:`.PendingEnterpriseCustomerUser` instance is deleted instead. Raises Enterpri...
[ "Unlink", "user", "email", "from", "Enterprise", "Customer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L544-L585
[ "def", "unlink_user", "(", "self", ",", "enterprise_customer", ",", "user_email", ")", ":", "try", ":", "existing_user", "=", "User", ".", "objects", ".", "get", "(", "email", "=", "user_email", ")", "# not capturing DoesNotExist intentionally to signal to view that l...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseRoleAssignmentContextMixin.enterprise_customer_uuid
Get the enterprise customer uuid linked to the user.
enterprise/models.py
def enterprise_customer_uuid(self): """Get the enterprise customer uuid linked to the user.""" try: enterprise_user = EnterpriseCustomerUser.objects.get(user_id=self.user.id) except ObjectDoesNotExist: LOGGER.warning( 'User {} has a {} assignment but is no...
def enterprise_customer_uuid(self): """Get the enterprise customer uuid linked to the user.""" try: enterprise_user = EnterpriseCustomerUser.objects.get(user_id=self.user.id) except ObjectDoesNotExist: LOGGER.warning( 'User {} has a {} assignment but is no...
[ "Get", "the", "enterprise", "customer", "uuid", "linked", "to", "the", "user", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/models.py#L1786-L1803
[ "def", "enterprise_customer_uuid", "(", "self", ")", ":", "try", ":", "enterprise_user", "=", "EnterpriseCustomerUser", ".", "objects", ".", "get", "(", "user_id", "=", "self", ".", "user", ".", "id", ")", "except", "ObjectDoesNotExist", ":", "LOGGER", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_data_sharing_consent
Get the data sharing consent object associated with a certain user, enterprise customer, and other scope. :param username: The user that grants consent :param enterprise_customer_uuid: The consent requester :param course_id (optional): A course ID to which consent may be related :param program_uuid (op...
consent/helpers.py
def get_data_sharing_consent(username, enterprise_customer_uuid, course_id=None, program_uuid=None): """ Get the data sharing consent object associated with a certain user, enterprise customer, and other scope. :param username: The user that grants consent :param enterprise_customer_uuid: The consent r...
def get_data_sharing_consent(username, enterprise_customer_uuid, course_id=None, program_uuid=None): """ Get the data sharing consent object associated with a certain user, enterprise customer, and other scope. :param username: The user that grants consent :param enterprise_customer_uuid: The consent r...
[ "Get", "the", "data", "sharing", "consent", "object", "associated", "with", "a", "certain", "user", "enterprise", "customer", "and", "other", "scope", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/helpers.py#L15-L31
[ "def", "get_data_sharing_consent", "(", "username", ",", "enterprise_customer_uuid", ",", "course_id", "=", "None", ",", "program_uuid", "=", "None", ")", ":", "EnterpriseCustomer", "=", "apps", ".", "get_model", "(", "'enterprise'", ",", "'EnterpriseCustomer'", ")"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_course_data_sharing_consent
Get the data sharing consent object associated with a certain user of a customer for a course. :param username: The user that grants consent. :param course_id: The course for which consent is granted. :param enterprise_customer_uuid: The consent requester. :return: The data sharing consent object
consent/helpers.py
def get_course_data_sharing_consent(username, course_id, enterprise_customer_uuid): """ Get the data sharing consent object associated with a certain user of a customer for a course. :param username: The user that grants consent. :param course_id: The course for which consent is granted. :param ent...
def get_course_data_sharing_consent(username, course_id, enterprise_customer_uuid): """ Get the data sharing consent object associated with a certain user of a customer for a course. :param username: The user that grants consent. :param course_id: The course for which consent is granted. :param ent...
[ "Get", "the", "data", "sharing", "consent", "object", "associated", "with", "a", "certain", "user", "of", "a", "customer", "for", "a", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/helpers.py#L34-L49
[ "def", "get_course_data_sharing_consent", "(", "username", ",", "course_id", ",", "enterprise_customer_uuid", ")", ":", "# Prevent circular imports.", "DataSharingConsent", "=", "apps", ".", "get_model", "(", "'consent'", ",", "'DataSharingConsent'", ")", "# pylint: disable...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_program_data_sharing_consent
Get the data sharing consent object associated with a certain user of a customer for a program. :param username: The user that grants consent. :param program_uuid: The program for which consent is granted. :param enterprise_customer_uuid: The consent requester. :return: The data sharing consent object
consent/helpers.py
def get_program_data_sharing_consent(username, program_uuid, enterprise_customer_uuid): """ Get the data sharing consent object associated with a certain user of a customer for a program. :param username: The user that grants consent. :param program_uuid: The program for which consent is granted. :...
def get_program_data_sharing_consent(username, program_uuid, enterprise_customer_uuid): """ Get the data sharing consent object associated with a certain user of a customer for a program. :param username: The user that grants consent. :param program_uuid: The program for which consent is granted. :...
[ "Get", "the", "data", "sharing", "consent", "object", "associated", "with", "a", "certain", "user", "of", "a", "customer", "for", "a", "program", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/helpers.py#L52-L68
[ "def", "get_program_data_sharing_consent", "(", "username", ",", "program_uuid", ",", "enterprise_customer_uuid", ")", ":", "enterprise_customer", "=", "get_enterprise_customer", "(", "enterprise_customer_uuid", ")", "discovery_client", "=", "CourseCatalogApiServiceClient", "("...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
send_course_enrollment_statement
Send xAPI statement for course enrollment. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. course_enrollment (CourseEnrollment): Course enrollment object.
integrated_channels/xapi/utils.py
def send_course_enrollment_statement(lrs_configuration, course_enrollment): """ Send xAPI statement for course enrollment. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. course_enrollment (CourseEnrollment): Course enrollment o...
def send_course_enrollment_statement(lrs_configuration, course_enrollment): """ Send xAPI statement for course enrollment. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. course_enrollment (CourseEnrollment): Course enrollment o...
[ "Send", "xAPI", "statement", "for", "course", "enrollment", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/utils.py#L15-L32
[ "def", "send_course_enrollment_statement", "(", "lrs_configuration", ",", "course_enrollment", ")", ":", "user_details", "=", "LearnerInfoSerializer", "(", "course_enrollment", ".", "user", ")", "course_details", "=", "CourseInfoSerializer", "(", "course_enrollment", ".", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
send_course_completion_statement
Send xAPI statement for course completion. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. user (User): Django User object. course_overview (CourseOverview): Course over view object containing course details. course_gr...
integrated_channels/xapi/utils.py
def send_course_completion_statement(lrs_configuration, user, course_overview, course_grade): """ Send xAPI statement for course completion. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. user (User): Django User object. ...
def send_course_completion_statement(lrs_configuration, user, course_overview, course_grade): """ Send xAPI statement for course completion. Arguments: lrs_configuration (XAPILRSConfiguration): XAPILRSConfiguration instance where to send statements. user (User): Django User object. ...
[ "Send", "xAPI", "statement", "for", "course", "completion", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/utils.py#L35-L55
[ "def", "send_course_completion_statement", "(", "lrs_configuration", ",", "user", ",", "course_overview", ",", "course_grade", ")", ":", "user_details", "=", "LearnerInfoSerializer", "(", "user", ")", "course_details", "=", "CourseInfoSerializer", "(", "course_overview", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ContentMetadataExporter.export
Return the exported and transformed content metadata as a dictionary.
integrated_channels/integrated_channel/exporters/content_metadata.py
def export(self): """ Return the exported and transformed content metadata as a dictionary. """ content_metadata_export = {} content_metadata_items = self.enterprise_api.get_content_metadata(self.enterprise_customer) LOGGER.info('Retrieved content metadata for enterprise ...
def export(self): """ Return the exported and transformed content metadata as a dictionary. """ content_metadata_export = {} content_metadata_items = self.enterprise_api.get_content_metadata(self.enterprise_customer) LOGGER.info('Retrieved content metadata for enterprise ...
[ "Return", "the", "exported", "and", "transformed", "content", "metadata", "as", "a", "dictionary", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/content_metadata.py#L73-L89
[ "def", "export", "(", "self", ")", ":", "content_metadata_export", "=", "{", "}", "content_metadata_items", "=", "self", ".", "enterprise_api", ".", "get_content_metadata", "(", "self", ".", "enterprise_customer", ")", "LOGGER", ".", "info", "(", "'Retrieved conte...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ContentMetadataExporter._transform_item
Transform the provided content metadata item to the schema expected by the integrated channel.
integrated_channels/integrated_channel/exporters/content_metadata.py
def _transform_item(self, content_metadata_item): """ Transform the provided content metadata item to the schema expected by the integrated channel. """ content_metadata_type = content_metadata_item['content_type'] transformed_item = {} for integrated_channel_schema_key, ...
def _transform_item(self, content_metadata_item): """ Transform the provided content metadata item to the schema expected by the integrated channel. """ content_metadata_type = content_metadata_item['content_type'] transformed_item = {} for integrated_channel_schema_key, ...
[ "Transform", "the", "provided", "content", "metadata", "item", "to", "the", "schema", "expected", "by", "the", "integrated", "channel", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/integrated_channel/exporters/content_metadata.py#L91-L136
[ "def", "_transform_item", "(", "self", ",", "content_metadata_item", ")", ":", "content_metadata_type", "=", "content_metadata_item", "[", "'content_type'", "]", "transformed_item", "=", "{", "}", "for", "integrated_channel_schema_key", ",", "edx_data_schema_key", "in", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.get_consent_record
Get the consent record relevant to the request at hand.
consent/api/v1/views.py
def get_consent_record(self, request): """ Get the consent record relevant to the request at hand. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params(request) return get_data_sharing_consent( username, enterpri...
def get_consent_record(self, request): """ Get the consent record relevant to the request at hand. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params(request) return get_data_sharing_consent( username, enterpri...
[ "Get", "the", "consent", "record", "relevant", "to", "the", "request", "at", "hand", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L83-L93
[ "def", "get_consent_record", "(", "self", ",", "request", ")", ":", "username", ",", "course_id", ",", "program_uuid", ",", "enterprise_customer_uuid", "=", "self", ".", "get_required_query_params", "(", "request", ")", "return", "get_data_sharing_consent", "(", "us...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.get_required_query_params
Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``, which are the relevant query parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``username``, ``course_id``, and ``enterprise_customer_uuid`` from the request.
consent/api/v1/views.py
def get_required_query_params(self, request): """ Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``, which are the relevant query parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``username``, ``course_id``, and ``ente...
def get_required_query_params(self, request): """ Gets ``username``, ``course_id``, and ``enterprise_customer_uuid``, which are the relevant query parameters for this API endpoint. :param request: The request to this endpoint. :return: The ``username``, ``course_id``, and ``ente...
[ "Gets", "username", "course_id", "and", "enterprise_customer_uuid", "which", "are", "the", "relevant", "query", "parameters", "for", "this", "API", "endpoint", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L95-L115
[ "def", "get_required_query_params", "(", "self", ",", "request", ")", ":", "username", "=", "get_request_value", "(", "request", ",", "self", ".", "REQUIRED_PARAM_USERNAME", ",", "''", ")", "course_id", "=", "get_request_value", "(", "request", ",", "self", ".",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.get_no_record_response
Get an HTTPResponse that can be used when there's no related EnterpriseCustomer.
consent/api/v1/views.py
def get_no_record_response(self, request): """ Get an HTTPResponse that can be used when there's no related EnterpriseCustomer. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params(request) data = { self.REQUIRED_PARAM_USERN...
def get_no_record_response(self, request): """ Get an HTTPResponse that can be used when there's no related EnterpriseCustomer. """ username, course_id, program_uuid, enterprise_customer_uuid = self.get_required_query_params(request) data = { self.REQUIRED_PARAM_USERN...
[ "Get", "an", "HTTPResponse", "that", "can", "be", "used", "when", "there", "s", "no", "related", "EnterpriseCustomer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L124-L142
[ "def", "get_no_record_response", "(", "self", ",", "request", ")", ":", "username", ",", "course_id", ",", "program_uuid", ",", "enterprise_customer_uuid", "=", "self", ".", "get_required_query_params", "(", "request", ")", "data", "=", "{", "self", ".", "REQUIR...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.get
GET /consent/api/v1/data_sharing_consent?username=bob&course_id=id&enterprise_customer_uuid=uuid *username* The edX username from whom to get consent. *course_id* The course for which consent is granted. *enterprise_customer_uuid* The UUID of the enterprise cu...
consent/api/v1/views.py
def get(self, request): """ GET /consent/api/v1/data_sharing_consent?username=bob&course_id=id&enterprise_customer_uuid=uuid *username* The edX username from whom to get consent. *course_id* The course for which consent is granted. *enterprise_customer_uui...
def get(self, request): """ GET /consent/api/v1/data_sharing_consent?username=bob&course_id=id&enterprise_customer_uuid=uuid *username* The edX username from whom to get consent. *course_id* The course for which consent is granted. *enterprise_customer_uui...
[ "GET", "/", "consent", "/", "api", "/", "v1", "/", "data_sharing_consent?username", "=", "bob&course_id", "=", "id&enterprise_customer_uuid", "=", "uuid", "*", "username", "*", "The", "edX", "username", "from", "whom", "to", "get", "consent", ".", "*", "course...
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L144-L161
[ "def", "get", "(", "self", ",", "request", ")", ":", "try", ":", "consent_record", "=", "self", ".", "get_consent_record", "(", "request", ")", "if", "consent_record", "is", "None", ":", "return", "self", ".", "get_no_record_response", "(", "request", ")", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.post
POST /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uuid-goes-right-here" >>> } Keys: ...
consent/api/v1/views.py
def post(self, request): """ POST /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uuid-go...
def post(self, request): """ POST /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uuid-go...
[ "POST", "/", "consent", "/", "api", "/", "v1", "/", "data_sharing_consent" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L163-L200
[ "def", "post", "(", "self", ",", "request", ")", ":", "try", ":", "consent_record", "=", "self", ".", "get_consent_record", "(", "request", ")", "if", "consent_record", "is", "None", ":", "return", "self", ".", "get_no_record_response", "(", "request", ")", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
DataSharingConsentView.delete
DELETE /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uuid-goes-right-here" >>> } Keys:...
consent/api/v1/views.py
def delete(self, request): """ DELETE /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uui...
def delete(self, request): """ DELETE /consent/api/v1/data_sharing_consent Requires a JSON object of the following format: >>> { >>> "username": "bob", >>> "course_id": "course-v1:edX+DemoX+Demo_Course", >>> "enterprise_customer_uuid": "enterprise-uui...
[ "DELETE", "/", "consent", "/", "api", "/", "v1", "/", "data_sharing_consent" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/consent/api/v1/views.py#L202-L238
[ "def", "delete", "(", "self", ",", "request", ")", ":", "try", ":", "consent_record", "=", "self", ".", "get_consent_record", "(", "request", ")", "if", "consent_record", "is", "None", ":", "return", "self", ".", "get_no_record_response", "(", "request", ")"...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseConfig.ready
Perform other one-time initialization steps.
enterprise/apps.py
def ready(self): """ Perform other one-time initialization steps. """ from enterprise.signals import handle_user_post_save from django.db.models.signals import pre_migrate, post_save post_save.connect(handle_user_post_save, sender=self.auth_user_model, dispatch_uid=USER_...
def ready(self): """ Perform other one-time initialization steps. """ from enterprise.signals import handle_user_post_save from django.db.models.signals import pre_migrate, post_save post_save.connect(handle_user_post_save, sender=self.auth_user_model, dispatch_uid=USER_...
[ "Perform", "other", "one", "-", "time", "initialization", "steps", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/apps.py#L31-L39
[ "def", "ready", "(", "self", ")", ":", "from", "enterprise", ".", "signals", "import", "handle_user_post_save", "from", "django", ".", "db", ".", "models", ".", "signals", "import", "pre_migrate", ",", "post_save", "post_save", ".", "connect", "(", "handle_use...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseConfig._disconnect_user_post_save_for_migrations
Handle pre_migrate signal - disconnect User post_save handler.
enterprise/apps.py
def _disconnect_user_post_save_for_migrations(self, sender, **kwargs): # pylint: disable=unused-argument """ Handle pre_migrate signal - disconnect User post_save handler. """ from django.db.models.signals import post_save post_save.disconnect(sender=self.auth_user_model, dispat...
def _disconnect_user_post_save_for_migrations(self, sender, **kwargs): # pylint: disable=unused-argument """ Handle pre_migrate signal - disconnect User post_save handler. """ from django.db.models.signals import post_save post_save.disconnect(sender=self.auth_user_model, dispat...
[ "Handle", "pre_migrate", "signal", "-", "disconnect", "User", "post_save", "handler", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/apps.py#L41-L46
[ "def", "_disconnect_user_post_save_for_migrations", "(", "self", ",", "sender", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=unused-argument", "from", "django", ".", "db", ".", "models", ".", "signals", "import", "post_save", "post_save", ".", "disconnect",...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseStatement.get_actor
Get actor for the statement.
integrated_channels/xapi/statements/base.py
def get_actor(self, username, email): """ Get actor for the statement. """ return Agent( name=username, mbox='mailto:{email}'.format(email=email), )
def get_actor(self, username, email): """ Get actor for the statement. """ return Agent( name=username, mbox='mailto:{email}'.format(email=email), )
[ "Get", "actor", "for", "the", "statement", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/statements/base.py#L18-L25
[ "def", "get_actor", "(", "self", ",", "username", ",", "email", ")", ":", "return", "Agent", "(", "name", "=", "username", ",", "mbox", "=", "'mailto:{email}'", ".", "format", "(", "email", "=", "email", ")", ",", ")" ]
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseStatement.get_object
Get object for the statement.
integrated_channels/xapi/statements/base.py
def get_object(self, name, description): """ Get object for the statement. """ return Activity( id=X_API_ACTIVITY_COURSE, definition=ActivityDefinition( name=LanguageMap({'en-US': (name or '').encode("ascii", "ignore").decode('ascii')}), ...
def get_object(self, name, description): """ Get object for the statement. """ return Activity( id=X_API_ACTIVITY_COURSE, definition=ActivityDefinition( name=LanguageMap({'en-US': (name or '').encode("ascii", "ignore").decode('ascii')}), ...
[ "Get", "object", "for", "the", "statement", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/integrated_channels/xapi/statements/base.py#L40-L50
[ "def", "get_object", "(", "self", ",", "name", ",", "description", ")", ":", "return", "Activity", "(", "id", "=", "X_API_ACTIVITY_COURSE", ",", "definition", "=", "ActivityDefinition", "(", "name", "=", "LanguageMap", "(", "{", "'en-US'", ":", "(", "name", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
parse_csv
Parse csv file and return a stream of dictionaries representing each row. First line of CSV file must contain column headers. Arguments: file_stream: input file expected_columns (set[unicode]): columns that are expected to be present Yields: dict: CSV line parsed into a dictiona...
enterprise/admin/utils.py
def parse_csv(file_stream, expected_columns=None): """ Parse csv file and return a stream of dictionaries representing each row. First line of CSV file must contain column headers. Arguments: file_stream: input file expected_columns (set[unicode]): columns that are expected to be pre...
def parse_csv(file_stream, expected_columns=None): """ Parse csv file and return a stream of dictionaries representing each row. First line of CSV file must contain column headers. Arguments: file_stream: input file expected_columns (set[unicode]): columns that are expected to be pre...
[ "Parse", "csv", "file", "and", "return", "a", "stream", "of", "dictionaries", "representing", "each", "row", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/utils.py#L101-L123
[ "def", "parse_csv", "(", "file_stream", ",", "expected_columns", "=", "None", ")", ":", "reader", "=", "unicodecsv", ".", "DictReader", "(", "file_stream", ",", "encoding", "=", "\"utf-8\"", ")", "if", "expected_columns", "and", "set", "(", "expected_columns", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
validate_email_to_link
Validate email to be linked to Enterprise Customer. Performs two checks: * Checks that email is valid * Checks that it is not already linked to any Enterprise Customer Arguments: email (str): user email to link raw_email (str): raw value as it was passed by user - used in error...
enterprise/admin/utils.py
def validate_email_to_link(email, raw_email=None, message_template=None, ignore_existing=False): """ Validate email to be linked to Enterprise Customer. Performs two checks: * Checks that email is valid * Checks that it is not already linked to any Enterprise Customer Arguments: ...
def validate_email_to_link(email, raw_email=None, message_template=None, ignore_existing=False): """ Validate email to be linked to Enterprise Customer. Performs two checks: * Checks that email is valid * Checks that it is not already linked to any Enterprise Customer Arguments: ...
[ "Validate", "email", "to", "be", "linked", "to", "Enterprise", "Customer", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/utils.py#L141-L173
[ "def", "validate_email_to_link", "(", "email", ",", "raw_email", "=", "None", ",", "message_template", "=", "None", ",", "ignore_existing", "=", "False", ")", ":", "raw_email", "=", "raw_email", "if", "raw_email", "is", "not", "None", "else", "email", "message...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_course_runs_from_program
Return course runs from program data. Arguments: program(dict): Program data from Course Catalog API Returns: set: course runs in given program
enterprise/admin/utils.py
def get_course_runs_from_program(program): """ Return course runs from program data. Arguments: program(dict): Program data from Course Catalog API Returns: set: course runs in given program """ course_runs = set() for course in program.get("courses", []): for run i...
def get_course_runs_from_program(program): """ Return course runs from program data. Arguments: program(dict): Program data from Course Catalog API Returns: set: course runs in given program """ course_runs = set() for course in program.get("courses", []): for run i...
[ "Return", "course", "runs", "from", "program", "data", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/utils.py#L176-L192
[ "def", "get_course_runs_from_program", "(", "program", ")", ":", "course_runs", "=", "set", "(", ")", "for", "course", "in", "program", ".", "get", "(", "\"courses\"", ",", "[", "]", ")", ":", "for", "run", "in", "course", ".", "get", "(", "\"course_runs...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_earliest_start_date_from_program
Get the earliest date that one of the courses in the program was available. For the sake of emails to new learners, we treat this as the program start date. Arguemnts: program (dict): Program data from Course Catalog API returns: datetime.datetime: The date and time at which the first cour...
enterprise/admin/utils.py
def get_earliest_start_date_from_program(program): """ Get the earliest date that one of the courses in the program was available. For the sake of emails to new learners, we treat this as the program start date. Arguemnts: program (dict): Program data from Course Catalog API returns: ...
def get_earliest_start_date_from_program(program): """ Get the earliest date that one of the courses in the program was available. For the sake of emails to new learners, we treat this as the program start date. Arguemnts: program (dict): Program data from Course Catalog API returns: ...
[ "Get", "the", "earliest", "date", "that", "one", "of", "the", "courses", "in", "the", "program", "was", "available", ".", "For", "the", "sake", "of", "emails", "to", "new", "learners", "we", "treat", "this", "as", "the", "program", "start", "date", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/utils.py#L195-L213
[ "def", "get_earliest_start_date_from_program", "(", "program", ")", ":", "start_dates", "=", "[", "]", "for", "course", "in", "program", ".", "get", "(", "'courses'", ",", "[", "]", ")", ":", "for", "run", "in", "course", ".", "get", "(", "'course_runs'", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
paginated_list
Returns paginated list. Arguments: object_list (QuerySet): A list of records to be paginated. page (int): Current page number. page_size (int): Number of records displayed in each paginated set. show_all (bool): Whether to show all records. Adopted from django/contrib/admin/tem...
enterprise/admin/utils.py
def paginated_list(object_list, page, page_size=25): """ Returns paginated list. Arguments: object_list (QuerySet): A list of records to be paginated. page (int): Current page number. page_size (int): Number of records displayed in each paginated set. show_all (bool): Whethe...
def paginated_list(object_list, page, page_size=25): """ Returns paginated list. Arguments: object_list (QuerySet): A list of records to be paginated. page (int): Current page number. page_size (int): Number of records displayed in each paginated set. show_all (bool): Whethe...
[ "Returns", "paginated", "list", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/utils.py#L228-L276
[ "def", "paginated_list", "(", "object_list", ",", "page", ",", "page_size", "=", "25", ")", ":", "paginator", "=", "CustomPaginator", "(", "object_list", ",", "page_size", ")", "try", ":", "object_list", "=", "paginator", ".", "page", "(", "page", ")", "ex...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm.clean_email_or_username
Clean email form field Returns: str: the cleaned value, converted to an email address (or an empty string)
enterprise/admin/forms.py
def clean_email_or_username(self): """ Clean email form field Returns: str: the cleaned value, converted to an email address (or an empty string) """ email_or_username = self.cleaned_data[self.Fields.EMAIL_OR_USERNAME].strip() if not email_or_username: ...
def clean_email_or_username(self): """ Clean email form field Returns: str: the cleaned value, converted to an email address (or an empty string) """ email_or_username = self.cleaned_data[self.Fields.EMAIL_OR_USERNAME].strip() if not email_or_username: ...
[ "Clean", "email", "form", "field" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L149-L181
[ "def", "clean_email_or_username", "(", "self", ")", ":", "email_or_username", "=", "self", ".", "cleaned_data", "[", "self", ".", "Fields", ".", "EMAIL_OR_USERNAME", "]", ".", "strip", "(", ")", "if", "not", "email_or_username", ":", "# The field is blank; we just...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm.clean_course
Verify course ID and retrieve course details.
enterprise/admin/forms.py
def clean_course(self): """ Verify course ID and retrieve course details. """ course_id = self.cleaned_data[self.Fields.COURSE].strip() if not course_id: return None try: client = EnrollmentApiClient() return client.get_course_details(c...
def clean_course(self): """ Verify course ID and retrieve course details. """ course_id = self.cleaned_data[self.Fields.COURSE].strip() if not course_id: return None try: client = EnrollmentApiClient() return client.get_course_details(c...
[ "Verify", "course", "ID", "and", "retrieve", "course", "details", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L183-L194
[ "def", "clean_course", "(", "self", ")", ":", "course_id", "=", "self", ".", "cleaned_data", "[", "self", ".", "Fields", ".", "COURSE", "]", ".", "strip", "(", ")", "if", "not", "course_id", ":", "return", "None", "try", ":", "client", "=", "Enrollment...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm.clean_program
Clean program. Try obtaining program treating form value as program UUID or title. Returns: dict: Program information if program found
enterprise/admin/forms.py
def clean_program(self): """ Clean program. Try obtaining program treating form value as program UUID or title. Returns: dict: Program information if program found """ program_id = self.cleaned_data[self.Fields.PROGRAM].strip() if not program_id: ...
def clean_program(self): """ Clean program. Try obtaining program treating form value as program UUID or title. Returns: dict: Program information if program found """ program_id = self.cleaned_data[self.Fields.PROGRAM].strip() if not program_id: ...
[ "Clean", "program", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L196-L225
[ "def", "clean_program", "(", "self", ")", ":", "program_id", "=", "self", ".", "cleaned_data", "[", "self", ".", "Fields", ".", "PROGRAM", "]", ".", "strip", "(", ")", "if", "not", "program_id", ":", "return", "None", "try", ":", "client", "=", "Course...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm.clean_notify
Clean the notify_on_enrollment field.
enterprise/admin/forms.py
def clean_notify(self): """ Clean the notify_on_enrollment field. """ return self.cleaned_data.get(self.Fields.NOTIFY, self.NotificationTypes.DEFAULT)
def clean_notify(self): """ Clean the notify_on_enrollment field. """ return self.cleaned_data.get(self.Fields.NOTIFY, self.NotificationTypes.DEFAULT)
[ "Clean", "the", "notify_on_enrollment", "field", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L227-L231
[ "def", "clean_notify", "(", "self", ")", ":", "return", "self", ".", "cleaned_data", ".", "get", "(", "self", ".", "Fields", ".", "NOTIFY", ",", "self", ".", "NotificationTypes", ".", "DEFAULT", ")" ]
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm.clean
Clean fields that depend on each other. In this case, the form can be used to link single user or bulk link multiple users. These are mutually exclusive modes, so this method checks that only one field is passed.
enterprise/admin/forms.py
def clean(self): """ Clean fields that depend on each other. In this case, the form can be used to link single user or bulk link multiple users. These are mutually exclusive modes, so this method checks that only one field is passed. """ cleaned_data = super(ManageLearne...
def clean(self): """ Clean fields that depend on each other. In this case, the form can be used to link single user or bulk link multiple users. These are mutually exclusive modes, so this method checks that only one field is passed. """ cleaned_data = super(ManageLearne...
[ "Clean", "fields", "that", "depend", "on", "each", "other", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L233-L267
[ "def", "clean", "(", "self", ")", ":", "cleaned_data", "=", "super", "(", "ManageLearnersForm", ",", "self", ")", ".", "clean", "(", ")", "# Here we take values from `data` (and not `cleaned_data`) as we need raw values - field clean methods", "# might \"invalidate\" the value ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm._validate_course
Verify that the selected mode is valid for the given course .
enterprise/admin/forms.py
def _validate_course(self): """ Verify that the selected mode is valid for the given course . """ # Verify that the selected mode is valid for the given course . course_details = self.cleaned_data.get(self.Fields.COURSE) if course_details: course_mode = self.c...
def _validate_course(self): """ Verify that the selected mode is valid for the given course . """ # Verify that the selected mode is valid for the given course . course_details = self.cleaned_data.get(self.Fields.COURSE) if course_details: course_mode = self.c...
[ "Verify", "that", "the", "selected", "mode", "is", "valid", "for", "the", "given", "course", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L269-L285
[ "def", "_validate_course", "(", "self", ")", ":", "# Verify that the selected mode is valid for the given course .", "course_details", "=", "self", ".", "cleaned_data", ".", "get", "(", "self", ".", "Fields", ".", "COURSE", ")", "if", "course_details", ":", "course_mo...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
ManageLearnersForm._validate_program
Verify that selected mode is available for program and all courses in the program
enterprise/admin/forms.py
def _validate_program(self): """ Verify that selected mode is available for program and all courses in the program """ program = self.cleaned_data.get(self.Fields.PROGRAM) if not program: return course_runs = get_course_runs_from_program(program) try:...
def _validate_program(self): """ Verify that selected mode is available for program and all courses in the program """ program = self.cleaned_data.get(self.Fields.PROGRAM) if not program: return course_runs = get_course_runs_from_program(program) try:...
[ "Verify", "that", "selected", "mode", "is", "available", "for", "program", "and", "all", "courses", "in", "the", "program" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L287-L310
[ "def", "_validate_program", "(", "self", ")", ":", "program", "=", "self", ".", "cleaned_data", ".", "get", "(", "self", ".", "Fields", ".", "PROGRAM", ")", "if", "not", "program", ":", "return", "course_runs", "=", "get_course_runs_from_program", "(", "prog...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerAdminForm.get_catalog_options
Retrieve a list of catalog ID and name pairs. Once retrieved, these name pairs can be used directly as a value for the `choices` argument to a ChoiceField.
enterprise/admin/forms.py
def get_catalog_options(self): """ Retrieve a list of catalog ID and name pairs. Once retrieved, these name pairs can be used directly as a value for the `choices` argument to a ChoiceField. """ # TODO: We will remove the discovery service catalog implementation ...
def get_catalog_options(self): """ Retrieve a list of catalog ID and name pairs. Once retrieved, these name pairs can be used directly as a value for the `choices` argument to a ChoiceField. """ # TODO: We will remove the discovery service catalog implementation ...
[ "Retrieve", "a", "list", "of", "catalog", "ID", "and", "name", "pairs", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L362-L386
[ "def", "get_catalog_options", "(", "self", ")", ":", "# TODO: We will remove the discovery service catalog implementation", "# once we have fully migrated customer's to EnterpriseCustomerCatalogs.", "# For now, this code will prevent an admin from creating a new", "# EnterpriseCustomer with a disc...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerAdminForm.clean
Clean form fields prior to database entry. In this case, the major cleaning operation is substituting a None value for a blank value in the Catalog field.
enterprise/admin/forms.py
def clean(self): """ Clean form fields prior to database entry. In this case, the major cleaning operation is substituting a None value for a blank value in the Catalog field. """ cleaned_data = super(EnterpriseCustomerAdminForm, self).clean() if 'catalog' in cle...
def clean(self): """ Clean form fields prior to database entry. In this case, the major cleaning operation is substituting a None value for a blank value in the Catalog field. """ cleaned_data = super(EnterpriseCustomerAdminForm, self).clean() if 'catalog' in cle...
[ "Clean", "form", "fields", "prior", "to", "database", "entry", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L388-L398
[ "def", "clean", "(", "self", ")", ":", "cleaned_data", "=", "super", "(", "EnterpriseCustomerAdminForm", ",", "self", ")", ".", "clean", "(", ")", "if", "'catalog'", "in", "cleaned_data", "and", "not", "cleaned_data", "[", "'catalog'", "]", ":", "cleaned_dat...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerIdentityProviderAdminForm.clean
Final validations of model fields. 1. Validate that selected site for enterprise customer matches with the selected identity provider's site.
enterprise/admin/forms.py
def clean(self): """ Final validations of model fields. 1. Validate that selected site for enterprise customer matches with the selected identity provider's site. """ super(EnterpriseCustomerIdentityProviderAdminForm, self).clean() provider_id = self.cleaned_data.get('p...
def clean(self): """ Final validations of model fields. 1. Validate that selected site for enterprise customer matches with the selected identity provider's site. """ super(EnterpriseCustomerIdentityProviderAdminForm, self).clean() provider_id = self.cleaned_data.get('p...
[ "Final", "validations", "of", "model", "fields", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L445-L486
[ "def", "clean", "(", "self", ")", ":", "super", "(", "EnterpriseCustomerIdentityProviderAdminForm", ",", "self", ")", ".", "clean", "(", ")", "provider_id", "=", "self", ".", "cleaned_data", ".", "get", "(", "'provider_id'", ",", "None", ")", "enterprise_custo...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
EnterpriseCustomerReportingConfigAdminForm.clean
Override of clean method to perform additional validation
enterprise/admin/forms.py
def clean(self): """ Override of clean method to perform additional validation """ cleaned_data = super(EnterpriseCustomerReportingConfigAdminForm, self).clean() report_customer = cleaned_data.get('enterprise_customer') # Check that any selected catalogs are tied to the ...
def clean(self): """ Override of clean method to perform additional validation """ cleaned_data = super(EnterpriseCustomerReportingConfigAdminForm, self).clean() report_customer = cleaned_data.get('enterprise_customer') # Check that any selected catalogs are tied to the ...
[ "Override", "of", "clean", "method", "to", "perform", "additional", "validation" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L528-L550
[ "def", "clean", "(", "self", ")", ":", "cleaned_data", "=", "super", "(", "EnterpriseCustomerReportingConfigAdminForm", ",", "self", ")", ".", "clean", "(", ")", "report_customer", "=", "cleaned_data", ".", "get", "(", "'enterprise_customer'", ")", "# Check that a...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
TransmitEnterpriseCoursesForm.clean_channel_worker_username
Clean enterprise channel worker user form field Returns: str: the cleaned value of channel user username for transmitting courses metadata.
enterprise/admin/forms.py
def clean_channel_worker_username(self): """ Clean enterprise channel worker user form field Returns: str: the cleaned value of channel user username for transmitting courses metadata. """ channel_worker_username = self.cleaned_data['channel_worker_username'].strip()...
def clean_channel_worker_username(self): """ Clean enterprise channel worker user form field Returns: str: the cleaned value of channel user username for transmitting courses metadata. """ channel_worker_username = self.cleaned_data['channel_worker_username'].strip()...
[ "Clean", "enterprise", "channel", "worker", "user", "form", "field" ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/admin/forms.py#L562-L580
[ "def", "clean_channel_worker_username", "(", "self", ")", ":", "channel_worker_username", "=", "self", ".", "cleaned_data", "[", "'channel_worker_username'", "]", ".", "strip", "(", ")", "try", ":", "User", ".", "objects", ".", "get", "(", "username", "=", "ch...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
verify_edx_resources
Ensure that all necessary resources to render the view are present.
enterprise/views.py
def verify_edx_resources(): """ Ensure that all necessary resources to render the view are present. """ required_methods = { 'ProgramDataExtender': ProgramDataExtender, } for method in required_methods: if required_methods[method] is None: raise NotConnectedToOpenEdX...
def verify_edx_resources(): """ Ensure that all necessary resources to render the view are present. """ required_methods = { 'ProgramDataExtender': ProgramDataExtender, } for method in required_methods: if required_methods[method] is None: raise NotConnectedToOpenEdX...
[ "Ensure", "that", "all", "necessary", "resources", "to", "render", "the", "view", "are", "present", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L77-L90
[ "def", "verify_edx_resources", "(", ")", ":", "required_methods", "=", "{", "'ProgramDataExtender'", ":", "ProgramDataExtender", ",", "}", "for", "method", "in", "required_methods", ":", "if", "required_methods", "[", "method", "]", "is", "None", ":", "raise", "...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_global_context
Get the set of variables that are needed by default across views.
enterprise/views.py
def get_global_context(request, enterprise_customer): """ Get the set of variables that are needed by default across views. """ platform_name = get_configuration_value("PLATFORM_NAME", settings.PLATFORM_NAME) # pylint: disable=no-member return { 'enterprise_customer': enterprise_customer...
def get_global_context(request, enterprise_customer): """ Get the set of variables that are needed by default across views. """ platform_name = get_configuration_value("PLATFORM_NAME", settings.PLATFORM_NAME) # pylint: disable=no-member return { 'enterprise_customer': enterprise_customer...
[ "Get", "the", "set", "of", "variables", "that", "are", "needed", "by", "default", "across", "views", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L93-L123
[ "def", "get_global_context", "(", "request", ",", "enterprise_customer", ")", ":", "platform_name", "=", "get_configuration_value", "(", "\"PLATFORM_NAME\"", ",", "settings", ".", "PLATFORM_NAME", ")", "# pylint: disable=no-member", "return", "{", "'enterprise_customer'", ...
aea91379ab0a87cd3bc798961fce28b60ee49a80
valid
get_price_text
Return the localized converted price as string (ex. '$150 USD'). If the local_currency switch is enabled and the users location has been determined this will convert the given price based on conversion rate from the Catalog service and return a localized string
enterprise/views.py
def get_price_text(price, request): """ Return the localized converted price as string (ex. '$150 USD'). If the local_currency switch is enabled and the users location has been determined this will convert the given price based on conversion rate from the Catalog service and return a localized string ...
def get_price_text(price, request): """ Return the localized converted price as string (ex. '$150 USD'). If the local_currency switch is enabled and the users location has been determined this will convert the given price based on conversion rate from the Catalog service and return a localized string ...
[ "Return", "the", "localized", "converted", "price", "as", "string", "(", "ex", ".", "$150", "USD", ")", "." ]
edx/edx-enterprise
python
https://github.com/edx/edx-enterprise/blob/aea91379ab0a87cd3bc798961fce28b60ee49a80/enterprise/views.py#L126-L136
[ "def", "get_price_text", "(", "price", ",", "request", ")", ":", "if", "waffle", ".", "switch_is_active", "(", "'local_currency'", ")", "and", "get_localized_price_text", ":", "return", "get_localized_price_text", "(", "price", ",", "request", ")", "return", "form...
aea91379ab0a87cd3bc798961fce28b60ee49a80