Search is not available for this dataset
text stringlengths 75 104k |
|---|
def does_not_contain_value(self, *values):
"""Asserts that val is a dict and does not contain the given value or values."""
self._check_dict_like(self.val, check_getitem=False)
if len(values) == 0:
raise ValueError('one or more value args must be given')
else:
fou... |
def contains_entry(self, *args, **kwargs):
"""Asserts that val is a dict and contains the given entry or entries."""
self._check_dict_like(self.val, check_values=False)
entries = list(args) + [{k:v} for k,v in kwargs.items()]
if len(entries) == 0:
raise ValueError('one or mor... |
def is_before(self, other):
"""Asserts that val is a date and is before other date."""
if type(self.val) is not datetime.datetime:
raise TypeError('val must be datetime, but was type <%s>' % type(self.val).__name__)
if type(other) is not datetime.datetime:
raise TypeError... |
def exists(self):
"""Asserts that val is a path and that it exists."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a path')
if not os.path.exists(self.val):
self._err('Expected <%s> to exist, but was not found.' % self.val)
return self |
def is_file(self):
"""Asserts that val is an existing path to a file."""
self.exists()
if not os.path.isfile(self.val):
self._err('Expected <%s> to be a file, but was not.' % self.val)
return self |
def is_directory(self):
"""Asserts that val is an existing path to a directory."""
self.exists()
if not os.path.isdir(self.val):
self._err('Expected <%s> to be a directory, but was not.' % self.val)
return self |
def is_named(self, filename):
"""Asserts that val is an existing path to a file and that file is named filename."""
self.is_file()
if not isinstance(filename, str_types):
raise TypeError('given filename arg must be a path')
val_filename = os.path.basename(os.path.abspath(self... |
def is_child_of(self, parent):
"""Asserts that val is an existing path to a file and that file is a child of parent."""
self.is_file()
if not isinstance(parent, str_types):
raise TypeError('given parent directory arg must be a path')
val_abspath = os.path.abspath(self.val)
... |
def extracting(self, *names, **kwargs):
"""Asserts that val is collection, then extracts the named properties or named zero-arg methods into a list (or list of tuples if multiple names are given)."""
if not isinstance(self.val, Iterable):
raise TypeError('val is not iterable')
if isi... |
def raises(self, ex):
"""Asserts that val is callable and that when called raises the given error."""
if not callable(self.val):
raise TypeError('val must be callable')
if not issubclass(ex, BaseException):
raise TypeError('given arg must be exception')
return Ass... |
def when_called_with(self, *some_args, **some_kwargs):
"""Asserts the val callable when invoked with the given args and kwargs raises the expected exception."""
if not self.expected:
raise TypeError('expected exception not set, raises() must be called first')
try:
self.va... |
def _err(self, msg):
"""Helper to raise an AssertionError, and optionally prepend custom description."""
out = '%s%s' % ('[%s] ' % self.description if len(self.description) > 0 else '', msg)
if self.kind == 'warn':
print(out)
return self
elif self.kind == 'soft':
... |
def _fmt_args_kwargs(self, *some_args, **some_kwargs):
"""Helper to convert the given args and kwargs into a string."""
if some_args:
out_args = str(some_args).lstrip('(').rstrip(',)')
if some_kwargs:
out_kwargs = ', '.join([str(i).lstrip('(').rstrip(')').replace(', ',': ... |
def generate_words(files):
"""
Transform list of files to list of words,
removing new line character
and replace name entity '<NE>...</NE>' and abbreviation '<AB>...</AB>' symbol
"""
repls = {'<NE>' : '','</NE>' : '','<AB>': '','</AB>': ''}
words_all = []
for i, file in enumerate(files... |
def create_char_dataframe(words):
"""
Give list of input tokenized words,
create dataframe of characters where first character of
the word is tagged as 1, otherwise 0
Example
=======
['กิน', 'หมด'] to dataframe of
[{'char': 'ก', 'type': ..., 'target': 1}, ...,
{'char': 'ด', 'type':... |
def generate_best_dataset(best_path, output_path='cleaned_data', create_val=False):
"""
Generate CSV file for training and testing data
Input
=====
best_path: str, path to BEST folder which contains unzipped subfolder
'article', 'encyclopedia', 'news', 'novel'
cleaned_data: str, path t... |
def prepare_feature(best_processed_path, option='train'):
"""
Transform processed path into feature matrix and output array
Input
=====
best_processed_path: str, path to processed BEST dataset
option: str, 'train' or 'test'
"""
# padding for training and testing set
n_pad = 21
... |
def train_model(best_processed_path, weight_path='../weight/model_weight.h5', verbose=2):
"""
Given path to processed BEST dataset,
train CNN model for words beginning alongside with
character label encoder and character type label encoder
Input
=====
best_processed_path: str, path to proce... |
def evaluate(best_processed_path, model):
"""
Evaluate model on splitted 10 percent testing set
"""
x_test_char, x_test_type, y_test = prepare_feature(best_processed_path, option='test')
y_predict = model.predict([x_test_char, x_test_type])
y_predict = (y_predict.ravel() > 0.5).astype(int)
... |
def tokenize(text, custom_dict=None):
"""
Tokenize given Thai text string
Input
=====
text: str, Thai text string
custom_dict: str (or list), path to customized dictionary file
It allows the function not to tokenize given dictionary wrongly.
The file should contain custom words ... |
def _document_frequency(X):
"""
Count the number of non-zero values for each feature in sparse X.
"""
if sp.isspmatrix_csr(X):
return np.bincount(X.indices, minlength=X.shape[1])
return np.diff(sp.csc_matrix(X, copy=False).indptr) |
def _check_stop_list(stop):
"""
Check stop words list
ref: https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/feature_extraction/text.py#L87-L95
"""
if stop == "thai":
return THAI_STOP_WORDS
elif isinstance(stop, six.string_types):
raise ValueError("not a built-in s... |
def _word_ngrams(self, tokens):
"""
Turn tokens into a tokens of n-grams
ref: https://github.com/scikit-learn/scikit-learn/blob/ef5cb84a/sklearn/feature_extraction/text.py#L124-L153
"""
# handle stop words
if self.stop_words is not None:
tokens = [w for w in ... |
def fit_tranform(self, raw_documents):
"""
Transform given list of raw_documents to document-term matrix in
sparse CSR format (see scipy)
"""
X = self.transform(raw_documents, new_document=True)
return X |
def create_feature_array(text, n_pad=21):
"""
Create feature array of character and surrounding characters
"""
n = len(text)
n_pad_2 = int((n_pad - 1)/2)
text_pad = [' '] * n_pad_2 + [t for t in text] + [' '] * n_pad_2
x_char, x_type = [], []
for i in range(n_pad_2, n_pad_2 + n):
... |
def create_n_gram_df(df, n_pad):
"""
Given input dataframe, create feature dataframe of shifted characters
"""
n_pad_2 = int((n_pad - 1)/2)
for i in range(n_pad_2):
df['char-{}'.format(i+1)] = df['char'].shift(i + 1)
df['type-{}'.format(i+1)] = df['type'].shift(i + 1)
df['cha... |
def _fetch_course_enrollment_data(self, enterprise_customer_uuid):
"""
Return enterprise customer UUID/user_id/course_run_id triples which represent CourseEnrollment records
which do not have a matching EnterpriseCourseEnrollment record.
The query used below looks for CourseEnrollment r... |
def _dictfetchall(self, cursor):
""" Return all rows from a cursor as a dict. """
columns = [col[0] for col in cursor.description]
return [
dict(zip(columns, row))
for row in cursor.fetchall()
] |
def parse_lms_api_datetime(datetime_string, datetime_format=LMS_API_DATETIME_FORMAT):
"""
Parse a received datetime into a timezone-aware, Python datetime object.
Arguments:
datetime_string: A string to be parsed.
datetime_format: A datetime format string to be used for parsing
"""
... |
def connect(self):
"""
Connect to the REST API, authenticating with a JWT for the current user.
"""
if JwtBuilder is None:
raise NotConnectedToOpenEdX("This package must be installed in an OpenEdX environment.")
now = int(time())
jwt = JwtBuilder.create_jwt_f... |
def refresh_token(func):
"""
Use this method decorator to ensure the JWT token is refreshed when needed.
"""
@wraps(func)
def inner(self, *args, **kwargs):
"""
Before calling the wrapped function, we check if the JWT token is expired, and if so, re-connect... |
def redirect_if_blocked(course_run_ids, user=None, ip_address=None, url=None):
"""
Return redirect to embargo error page if the given user is blocked.
"""
for course_run_id in course_run_ids:
redirect_url = embargo_api.redirect_if_blocked(
CourseKey.from_strin... |
def get_course_details(self, course_id):
"""
Query the Enrollment API for the course details of the given course_id.
Args:
course_id (str): The string value of the course's unique identifier
Returns:
dict: A dictionary containing details about the course, in an ... |
def _sort_course_modes(self, modes):
"""
Sort the course mode dictionaries by slug according to the COURSE_MODE_SORT_ORDER constant.
Arguments:
modes (list): A list of course mode dictionaries.
Returns:
list: A list with the course modes dictionaries sorted by sl... |
def get_course_modes(self, course_id):
"""
Query the Enrollment API for the specific course modes that are available for the given course_id.
Arguments:
course_id (str): The string value of the course's unique identifier
Returns:
list: A list of course mode dict... |
def has_course_mode(self, course_run_id, mode):
"""
Query the Enrollment API to see whether a course run has a given course mode available.
Arguments:
course_run_id (str): The string value of the course run's unique identifier
Returns:
bool: Whether the course r... |
def enroll_user_in_course(self, username, course_id, mode, cohort=None):
"""
Call the enrollment API to enroll the user in the course specified by course_id.
Args:
username (str): The username by which the user goes on the OpenEdX platform
course_id (str): The string val... |
def unenroll_user_from_course(self, username, course_id):
"""
Call the enrollment API to unenroll the user in the course specified by course_id.
Args:
username (str): The username by which the user goes on the OpenEdx platform
course_id (str): The string value of the cour... |
def get_course_enrollment(self, username, course_id):
"""
Query the enrollment API to get information about a single course enrollment.
Args:
username (str): The username by which the user goes on the OpenEdX platform
course_id (str): The string value of the course's uni... |
def is_enrolled(self, username, course_run_id):
"""
Query the enrollment API and determine if a learner is enrolled in a course run.
Args:
username (str): The username by which the user goes on the OpenEdX platform
course_run_id (str): The string value of the course's un... |
def _get_results(self, identity_provider, param_name, param_value, result_field_name):
"""
Calls the third party auth api endpoint to get the mapping between usernames and remote ids.
"""
try:
kwargs = {param_name: param_value}
returned = self.client.providers(ide... |
def get_course_grade(self, course_id, username):
"""
Retrieve the grade for the given username for the given course_id.
Args:
* ``course_id`` (str): The string value of the course's unique identifier
* ``username`` (str): The username ID identifying the user for which to retriev... |
def get_course_certificate(self, course_id, username):
"""
Retrieve the certificate for the given username for the given course_id.
Args:
* ``course_id`` (str): The string value of the course's unique identifier
* ``username`` (str): The username ID identifying the user for whic... |
def course_discovery_api_client(user, catalog_url):
"""
Return a Course Discovery API client setup with authentication for the specified user.
"""
if JwtBuilder is None:
raise NotConnectedToOpenEdX(
_("To get a Catalog API client, this package must be "
"installed in an... |
def traverse_pagination(response, endpoint, content_filter_query, query_params):
"""
Traverse a paginated API response and extracts and concatenates "results" returned by API.
Arguments:
response (dict): API response object.
endpoint (Slumber.Resource): API endpoint obje... |
def get_catalog_results(self, content_filter_query, query_params=None, traverse_pagination=False):
"""
Return results from the discovery service's search/all endpoint.
Arguments:
content_filter_query (dict): query parameters used to filter catalog results.
query_params (... |
def get_catalog(self, catalog_id):
"""
Return specified course catalog.
Returns:
dict: catalog details if it is available for the user.
"""
return self._load_data(
self.CATALOGS_ENDPOINT,
default=[],
resource_id=catalog_id
... |
def get_paginated_catalog_courses(self, catalog_id, querystring=None):
"""
Return paginated response for all catalog courses.
Returns:
dict: API response with links to next and previous pages.
"""
return self._load_data(
self.CATALOGS_COURSES_ENDPOINT.fo... |
def get_paginated_catalogs(self, querystring=None):
"""
Return a paginated list of course catalogs, including name and ID.
Returns:
dict: Paginated response containing catalogs available for the user.
"""
return self._load_data(
self.CATALOGS_ENDPOINT,
... |
def get_catalog_courses(self, catalog_id):
"""
Return the courses included in a single course catalog by ID.
Args:
catalog_id (int): The catalog ID we want to retrieve.
Returns:
list: Courses of the catalog in question
"""
return self._load_data... |
def get_course_and_course_run(self, course_run_id):
"""
Return the course and course run metadata for the given course run ID.
Arguments:
course_run_id (str): The course run ID.
Returns:
tuple: The course metadata and the course run metadata.
"""
... |
def get_course_details(self, course_id):
"""
Return the details of a single course by id - not a course run id.
Args:
course_id (str): The unique id for the course in question.
Returns:
dict: Details of the course in question.
"""
return self._l... |
def get_program_by_title(self, program_title):
"""
Return single program by name, or None if not found.
Arguments:
program_title(string): Program title as seen by students and in Course Catalog Admin
Returns:
dict: Program data provided by Course Catalog API
... |
def get_program_by_uuid(self, program_uuid):
"""
Return single program by UUID, or None if not found.
Arguments:
program_uuid(string): Program UUID in string form
Returns:
dict: Program data provided by Course Catalog API
"""
return self._load_d... |
def get_program_course_keys(self, program_uuid):
"""
Get a list of the course IDs (not course run IDs) contained in the program.
Arguments:
program_uuid (str): Program UUID in string form
Returns:
list(str): List of course keys in string form that are included i... |
def get_program_type_by_slug(self, slug):
"""
Get a program type by its slug.
Arguments:
slug (str): The slug to identify the program type.
Returns:
dict: A program type object.
"""
return self._load_data(
self.PROGRAM_TYPES_ENDPOINT... |
def get_common_course_modes(self, course_run_ids):
"""
Find common course modes for a set of course runs.
This function essentially returns an intersection of types of seats available
for each course run.
Arguments:
course_run_ids(Iterable[str]): Target Course run I... |
def is_course_in_catalog(self, catalog_id, course_id):
"""
Determine if the given course or course run ID is contained in the catalog with the given ID.
Args:
catalog_id (int): The ID of the catalog
course_id (str): The ID of the course or course run
Returns:
... |
def _load_data(self, resource, default=DEFAULT_VALUE_SAFEGUARD, **kwargs):
"""
Load data from API client.
Arguments:
resource(string): type of resource to load
default(any): value to return if API query returned empty result. Sensible values: [], {}, None etc.
R... |
def get_content_metadata(self, enterprise_customer):
"""
Return all content metadata contained in the catalogs associated with the EnterpriseCustomer.
Arguments:
enterprise_customer (EnterpriseCustomer): The EnterpriseCustomer to return content metadata for.
Returns:
... |
def _load_data(
self,
resource,
detail_resource=None,
resource_id=None,
querystring=None,
traverse_pagination=False,
default=DEFAULT_VALUE_SAFEGUARD,
):
"""
Loads a response from a call to one of the Enterprise endpo... |
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._transmit_delete(items_to_delete)
self._transmit_create(item... |
def _partition_items(self, channel_metadata_item_map):
"""
Return items that need to be created, updated, and deleted along with the
current ContentMetadataItemTransmissions.
"""
items_to_create = {}
items_to_update = {}
items_to_delete = {}
transmission_m... |
def _serialize_items(self, channel_metadata_items):
"""
Serialize content metadata items for a create transmission to the integrated channel.
"""
return json.dumps(
self._prepare_items_for_transmission(channel_metadata_items),
sort_keys=True
).encode('utf-... |
def _transmit_create(self, channel_metadata_item_map):
"""
Transmit content metadata creation to integrated channel.
"""
for chunk in chunks(channel_metadata_item_map, self.enterprise_configuration.transmission_chunk_size):
serialized_chunk = self._serialize_items(list(chunk.... |
def _transmit_update(self, channel_metadata_item_map, transmission_map):
"""
Transmit content metadata update to integrated channel.
"""
for chunk in chunks(channel_metadata_item_map, self.enterprise_configuration.transmission_chunk_size):
serialized_chunk = self._serialize_i... |
def _transmit_delete(self, channel_metadata_item_map):
"""
Transmit content metadata deletion to integrated channel.
"""
for chunk in chunks(channel_metadata_item_map, self.enterprise_configuration.transmission_chunk_size):
serialized_chunk = self._serialize_items(list(chunk.... |
def _get_transmissions(self):
"""
Return the ContentMetadataItemTransmision models for previously
transmitted content metadata items.
"""
# pylint: disable=invalid-name
ContentMetadataItemTransmission = apps.get_model(
'integrated_channel',
'Conten... |
def _create_transmissions(self, content_metadata_item_map):
"""
Create ContentMetadataItemTransmision models for the given content metadata items.
"""
# pylint: disable=invalid-name
ContentMetadataItemTransmission = apps.get_model(
'integrated_channel',
'C... |
def _update_transmissions(self, content_metadata_item_map, transmission_map):
"""
Update ContentMetadataItemTransmision models for the given content metadata items.
"""
for content_id, channel_metadata in content_metadata_item_map.items():
transmission = transmission_map[cont... |
def _delete_transmissions(self, content_metadata_item_ids):
"""
Delete ContentMetadataItemTransmision models associated with the given content metadata items.
"""
# pylint: disable=invalid-name
ContentMetadataItemTransmission = apps.get_model(
'integrated_channel',
... |
def deprecated(extra):
"""
Flag a method as deprecated.
:param extra: Extra text you'd like to display after the default text.
"""
def decorator(func):
"""
Return a decorated function that emits a deprecation warning on use.
"""
@wraps(func)
def wrapper(*args... |
def ignore_warning(warning):
"""
Ignore any emitted warnings from a function.
:param warning: The category of warning to ignore.
"""
def decorator(func):
"""
Return a decorated function whose emitted warnings are ignored.
"""
@wraps(func)
def wrapper(*args, *... |
def enterprise_login_required(view):
"""
View decorator for allowing authenticated user with valid enterprise UUID.
This decorator requires enterprise identifier as a parameter
`enterprise_uuid`.
This decorator will throw 404 if no kwarg `enterprise_uuid` is provided to
the decorated view .
... |
def force_fresh_session(view):
"""
View decorator which terminates stale TPA sessions.
This decorator forces the user to obtain a new session
the first time they access the decorated view. This prevents
TPA-authenticated users from hijacking the session of another
user who may have been previou... |
def validate_username(self, value):
"""
Verify that the username has a matching user, and that the user has an associated EnterpriseCustomerUser.
"""
try:
user = User.objects.get(username=value)
except User.DoesNotExist:
raise serializers.ValidationError("... |
def save(self): # pylint: disable=arguments-differ
"""
Save the model with the found EnterpriseCustomerUser.
"""
course_id = self.validated_data['course_id']
__, created = models.EnterpriseCourseEnrollment.objects.get_or_create(
enterprise_customer_user=self.enterpr... |
def to_representation(self, instance):
"""
Serialize the EnterpriseCustomerCatalog object.
Arguments:
instance (EnterpriseCustomerCatalog): The EnterpriseCustomerCatalog to serialize.
Returns:
dict: The EnterpriseCustomerCatalog converted to a dict.
"""
... |
def get_groups(self, obj):
"""
Return the enterprise related django groups that this user is a part of.
"""
if obj.user:
return [group.name for group in obj.user.groups.filter(name__in=ENTERPRISE_PERMISSION_GROUPS)]
return [] |
def validate_username(self, value):
"""
Verify that the username has a matching user.
"""
try:
self.user = User.objects.get(username=value)
except User.DoesNotExist:
raise serializers.ValidationError("User does not exist")
return value |
def save(self): # pylint: disable=arguments-differ
"""
Save the EnterpriseCustomerUser.
"""
enterprise_customer = self.validated_data['enterprise_customer']
ecu = models.EnterpriseCustomerUser(
user_id=self.user.pk,
enterprise_customer=enterprise_custome... |
def to_representation(self, instance):
"""
Return the updated course data dictionary.
Arguments:
instance (dict): The course data.
Returns:
dict: The updated course data.
"""
updated_course = copy.deepcopy(instance)
enterprise_customer_ca... |
def to_representation(self, instance):
"""
Return the updated course run data dictionary.
Arguments:
instance (dict): The course run data.
Returns:
dict: The updated course run data.
"""
updated_course_run = copy.deepcopy(instance)
enterp... |
def to_representation(self, instance):
"""
Return the updated program data dictionary.
Arguments:
instance (dict): The program data.
Returns:
dict: The updated program data.
"""
updated_program = copy.deepcopy(instance)
enterprise_custome... |
def to_internal_value(self, data):
"""
This implements the same relevant logic as ListSerializer except that if one or more items fail validation,
processing for other items that did not fail will continue.
"""
if not isinstance(data, list):
message = self.error_mess... |
def create(self, validated_data):
"""
This selectively calls the child create method based on whether or not validation failed for each payload.
"""
ret = []
for attrs in validated_data:
if 'non_field_errors' not in attrs and not any(isinstance(attrs[field], list) for... |
def to_representation(self, data):
"""
This selectively calls to_representation on each result that was processed by create.
"""
return [
self.child.to_representation(item) if 'detail' in item else item for item in data
] |
def create(self, validated_data):
"""
Perform the enrollment for existing enterprise customer users, or create the pending objects for new users.
"""
enterprise_customer = self.context.get('enterprise_customer')
lms_user = validated_data.get('lms_user_id')
tpa_user = vali... |
def validate_lms_user_id(self, value):
"""
Validates the lms_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
"""
enterprise_customer = self.context.get('enterprise_customer')
try:
# Ensure the given user is associated with the ente... |
def validate_tpa_user_id(self, value):
"""
Validates the tpa_user_id, if is given, to see if there is an existing EnterpriseCustomerUser for it.
It first uses the third party auth api to find the associated username to do the lookup.
"""
enterprise_customer = self.context.get('e... |
def validate_user_email(self, value):
"""
Validates the user_email, if given, to see if an existing EnterpriseCustomerUser exists for it.
If it does not, it does not fail validation, unlike for the other field validation methods above.
"""
enterprise_customer = self.context.get(... |
def validate_course_run_id(self, value):
"""
Validates that the course run id is part of the Enterprise Customer's catalog.
"""
enterprise_customer = self.context.get('enterprise_customer')
if not enterprise_customer.catalog_contains_course(value):
raise serializers.... |
def validate(self, data): # pylint: disable=arguments-differ
"""
Validate that at least one of the user identifier fields has been passed in.
"""
lms_user_id = data.get('lms_user_id')
tpa_user_id = data.get('tpa_user_id')
user_email = data.get('user_email')
if no... |
def get_paginated_response(data, request):
"""
Update pagination links in course catalog data and return DRF Response.
Arguments:
data (dict): Dictionary containing catalog courses.
request (HttpRequest): Current request object.
Returns:
(Response): DRF response object containi... |
def create_switch(apps, schema_editor):
"""Create the `role_based_access_control` switch if it does not already exist."""
Switch = apps.get_model('waffle', 'Switch')
Switch.objects.update_or_create(name=ENTERPRISE_ROLE_BASED_ACCESS_CONTROL_SWITCH, defaults={'active': False}) |
def delete_switch(apps, schema_editor):
"""Delete the `role_based_access_control` switch."""
Switch = apps.get_model('waffle', 'Switch')
Switch.objects.filter(name=ENTERPRISE_ROLE_BASED_ACCESS_CONTROL_SWITCH).delete() |
def create_switch(apps, schema_editor):
"""Create and activate the SAP_USE_ENTERPRISE_ENROLLMENT_PAGE switch if it does not already exist."""
Switch = apps.get_model('waffle', 'Switch')
Switch.objects.get_or_create(name='SAP_USE_ENTERPRISE_ENROLLMENT_PAGE', defaults={'active': False}) |
def transmit(self, payload, **kwargs):
"""
Send a completion status call to SAP SuccessFactors using the client.
Args:
payload: The learner completion data payload to send to SAP SuccessFactors
"""
kwargs['app_label'] = 'sap_success_factors'
kwargs['model_nam... |
def handle_transmission_error(self, learner_data, request_exception):
"""Handle the case where the employee on SAPSF's side is marked as inactive."""
try:
sys_msg = request_exception.response.content
except AttributeError:
pass
else:
if 'user account i... |
def allow_request(self, request, view):
"""
Modify throttling for service users.
Updates throttling rate if the request is coming from the service user, and
defaults to UserRateThrottle's configured setting otherwise.
Updated throttling rate comes from `DEFAULT_THROTTLE_RATES` ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.