This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| array_qs = re.compile(r'(\w+)\[(\d*)\]$') | |
| class UnPHPify(object): | |
| def process_request(self, request): | |
| """ | |
| Iterate request.GET, request.POST and request.FILES and amend the dict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __module_name__ = 'Filter' | |
| __module_version__ = '1.0.custom' | |
| __module_description__ = 'Filters join/part/voice messages' | |
| import hexchat | |
| import collections | |
| from time import time | |
| last_seen = {} # For each entry: the key is the user's nickname, the entry | |
| # is a list: element 0: last seen time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def user_in_group(user, group_id=None, group_id_list=None): | |
| if group_id_list is None: | |
| group_id_list = set(group_id] | |
| if not hasattr(user, 'group_ids'): | |
| user.group_ids = set(user.groups.values_list('pk', flat=True)) | |
| return user.group_ids.intersection(group_id_list) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class AccountsStatisticsDetail(TemplateView): | |
| template_name = 'grow/accountsstatistics.html' | |
| def get_context_data(self, **kwargs): | |
| context = super().get_context_data(**kwargs) | |
| username = self.kwargs.get('username') | |
| if username: | |
| context['username'] = username | |
| context['account_stats'] = ( | |
| AccountsStatistics.objects |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import mimetypes | |
| from django.contrib.staticfiles.storage import staticfiles_storage | |
| from django.http import Http404, FileResponse | |
| def static_file(request, path, content_type=None): | |
| if not staticfiles_storage.exists(path): | |
| raise Http404() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| from typing import Optional, Any, List, Tuple | |
| consonant_initial_digraphs = set( | |
| ["ch", "sh", "th", "thr", "ph", "wh", "ck", "kn", "wr"] | |
| ) | |
| consonant_final_digraphs = set(["ch", "ng", "sh", "th", "tch"]) | |
| vowel_digraphs = [ | |
| "ai", |
OlderNewer