init
This commit is contained in:
parent
497f07ae56
commit
25a05dadc9
2
django后端代码/blockchainApp/__init__.py
Normal file
2
django后端代码/blockchainApp/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
import pymysql
|
||||
pymysql.install_as_MySQLdb()
|
||||
16
django后端代码/blockchainApp/asgi.py
Normal file
16
django后端代码/blockchainApp/asgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
ASGI config for blockchainApp project.
|
||||
|
||||
It exposes the ASGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blockchainApp.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
137
django后端代码/blockchainApp/settings.py
Normal file
137
django后端代码/blockchainApp/settings.py
Normal file
@ -0,0 +1,137 @@
|
||||
"""
|
||||
Django settings for blockchainApp project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 3.1.4.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/3.1/ref/settings/
|
||||
"""
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/3.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '_(_@9r(%q9ioa6^6-r^#@+o*elly3dyoz_fy)%8ln)z9sl2h(6'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
|
||||
'user'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
# 'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'blockchainApp.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [BASE_DIR / 'templates']
|
||||
,
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'blockchainApp.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.mysql', # 数据库引擎
|
||||
'NAME': 'blockchainApp', # 数据库名,先前创建的
|
||||
'USER': 'root', # 用户名,可以自己创建用户
|
||||
# 'PASSWORD': '928492516@Linux.', # 密码
|
||||
'PASSWORD': 'Jiang.123', # 密码
|
||||
'HOST': 'localhost', # mysql服务所在的主机ip
|
||||
'PORT': '3306', # mysql服务端口
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/3.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'zh-hans'
|
||||
|
||||
TIME_ZONE = 'Asia/Shanghai'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = False
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/3.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
|
||||
# python3 manage.py collectstatic在执行时,django默认会去查看定义在STATICFILES_DIRS里的目录,
|
||||
# 以及在INSTALLED_APPS里定义了的app的static目录。如果这些目录下有文件,则把文件全部收集起来,拷贝到STATIC_ROOT目录下。
|
||||
|
||||
MEDIA_URL = '/media/'
|
||||
|
||||
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
|
||||
APPEND_SLASH = False
|
||||
|
||||
22
django后端代码/blockchainApp/urls.py
Normal file
22
django后端代码/blockchainApp/urls.py
Normal file
@ -0,0 +1,22 @@
|
||||
"""blockchainApp URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/3.1/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path, include
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('user/', include('user.urls')),
|
||||
]
|
||||
16
django后端代码/blockchainApp/wsgi.py
Normal file
16
django后端代码/blockchainApp/wsgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for blockchainApp project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blockchainApp.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
22
django后端代码/manage.py
Normal file
22
django后端代码/manage.py
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
"""Run administrative tasks."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'blockchainApp.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
0
django后端代码/user/__init__.py
Normal file
0
django后端代码/user/__init__.py
Normal file
19
django后端代码/user/admin.py
Normal file
19
django后端代码/user/admin.py
Normal file
@ -0,0 +1,19 @@
|
||||
from django.contrib import admin
|
||||
from user.models import User, Suggest, OfficeFile, Office, OfficeMember, DataDisclosure
|
||||
|
||||
|
||||
# Register your models here.
|
||||
|
||||
"""class InformationDisclosureAdmin(admin.ModelAdmin):
|
||||
fields = ('info4', 'info5', 'target1', 'target2', 'target3')"""
|
||||
|
||||
|
||||
admin.site.register(User)
|
||||
admin.site.register(Suggest)
|
||||
admin.site.register(OfficeFile)
|
||||
admin.site.register(Office)
|
||||
admin.site.register(OfficeMember)
|
||||
admin.site.register(DataDisclosure)
|
||||
# admin.site.register(Data)
|
||||
# admin.site.register(DownloadRecord)
|
||||
# admin.site.register(InformationDisclosure, InformationDisclosureAdmin)
|
||||
5
django后端代码/user/apps.py
Normal file
5
django后端代码/user/apps.py
Normal file
@ -0,0 +1,5 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class UserConfig(AppConfig):
|
||||
name = 'user'
|
||||
0
django后端代码/user/migrations/__init__.py
Normal file
0
django后端代码/user/migrations/__init__.py
Normal file
164
django后端代码/user/models.py
Normal file
164
django后端代码/user/models.py
Normal file
@ -0,0 +1,164 @@
|
||||
from django.db import models
|
||||
|
||||
|
||||
# Create your models here.
|
||||
class User(models.Model):
|
||||
openId = models.CharField(db_index=True, max_length=100, default='0', null=True) # 唯一表示微信用户的id
|
||||
userWxName = models.CharField(verbose_name='用户微信名', max_length=40, null=True) # 用户微信名
|
||||
userLoginName = models.CharField(verbose_name='用户登录名', max_length=10, null=True)
|
||||
userPassword = models.CharField(verbose_name='用户登录名拼接用户密码后计算的hash值', max_length=64, null=True)
|
||||
avatarUrl = models.URLField(max_length=255, null=True) # 用户头像
|
||||
activateTime = models.DateTimeField(verbose_name='注册时间', null=True)
|
||||
registeredStatus = models.BooleanField(verbose_name='注册状态', default=False)
|
||||
userCreditPoint = models.IntegerField(verbose_name='信用积分', default=100)
|
||||
accountAddress = models.CharField(verbose_name='用户账号地址', max_length=255, null=True, default='', blank=True)
|
||||
accountPk = models.CharField(verbose_name='用户公钥', max_length=255, null=True, default='', blank=True)
|
||||
accountSk = models.CharField(verbose_name='用户私钥', max_length=255, null=True, default='', blank=True)
|
||||
accountBalance = models.CharField(verbose_name='用户余额', max_length=50, null=True, default='', blank=True)
|
||||
userTypeChoices = [(0, '个人'), (1, '企业'), (2, '行政机关')]
|
||||
userType = models.PositiveSmallIntegerField(verbose_name='用户类型', choices=userTypeChoices, null=True, blank=True)
|
||||
downloadRecord = models.ManyToManyField("OfficeFile", blank=True, through='DownloadRecord',
|
||||
through_fields=('user', 'officeFile'), related_name='userDownloadRecord')
|
||||
|
||||
# hadApply = models.BooleanField("已提交保研申请", default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "用户"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.userWxName) + "_" + str(self.userLoginName) + '_' + str(self.id)
|
||||
|
||||
|
||||
class Suggest(models.Model):
|
||||
user = models.ForeignKey(User, verbose_name='用户主键', on_delete=models.CASCADE)
|
||||
# titleChioces = [(, '后勤问题'), (, '交通问题'), (, '运动'), (, ''), ]
|
||||
suggestTitle = models.CharField(verbose_name='留言标题', max_length=50)
|
||||
suggestContent = models.TextField(verbose_name='留言内容')
|
||||
changeSuggestTitle = models.TextField(verbose_name='替换违禁词后的留言标题', null=True)
|
||||
changeSuggestContent = models.TextField(verbose_name='替换违禁词后的留言内容', null=True)
|
||||
suggestTime = models.DateTimeField(auto_now_add=True)
|
||||
isCompliance = models.BooleanField(verbose_name='合规', default=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "建议"
|
||||
|
||||
def __str__(self):
|
||||
return self.suggestTitle
|
||||
|
||||
|
||||
"""class Data(models.Model):
|
||||
user = models.ForeignKey(User, verbose_name='用户主键', on_delete=models.CASCADE)
|
||||
dataTitle = models.CharField('资源标题', max_length=30)
|
||||
dataIntroduction = models.CharField('资源简介', max_length=255)
|
||||
dataLink = models.CharField('资源链接', max_length=255)
|
||||
dataHash = models.CharField('数据哈希值', max_length=64)
|
||||
uploadTime = models.DateTimeField(verbose_name='上传时间', auto_now_add=True)
|
||||
downloadsNum = models.IntegerField('下载次数', default=0)
|
||||
dataValue = models.PositiveSmallIntegerField('数据价格', default=0)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "数据上传"
|
||||
|
||||
def __str__(self):
|
||||
return self.dataTitle"""
|
||||
|
||||
|
||||
class Office(models.Model):
|
||||
departmentName = models.CharField('部门名称', max_length=100, null=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "部门"
|
||||
|
||||
def __str__(self):
|
||||
return self.departmentName
|
||||
|
||||
|
||||
class OfficeMember(models.Model):
|
||||
department = models.ForeignKey(Office, on_delete=models.CASCADE, blank=True, null=True)
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
account = models.CharField(verbose_name='成员登录名', max_length=10, null=True, unique=True)
|
||||
password = models.CharField(verbose_name='成员密码', max_length=30, null=True)
|
||||
identityChoices = [(0, '科员'), (1, '科长'), (2, '处长'), (3, '校验员')]
|
||||
identity = models.PositiveSmallIntegerField(verbose_name='成员身份', choices=identityChoices, null=True, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "部门成员"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.department) + '_' + str(self.user.userLoginName) + '_' + str(
|
||||
self.identityChoices[self.identity][1])
|
||||
|
||||
|
||||
class OfficeFile(models.Model):
|
||||
officeMember = models.ForeignKey(OfficeMember, on_delete=models.CASCADE, blank=True, null=True)
|
||||
dataTitle = models.CharField('资源标题', max_length=50)
|
||||
dataIntroduction = models.CharField('资源简介', max_length=255)
|
||||
informationLink = models.CharField('材料链接', max_length=255)
|
||||
informationHash = models.CharField('材料哈希值', max_length=64)
|
||||
uploadTime = models.DateTimeField(verbose_name='上传时间', auto_now_add=True)
|
||||
downloadsNum = models.IntegerField('下载次数', default=0)
|
||||
|
||||
boss1SignLink = models.CharField('签字图片1下载链接', max_length=255, null=True)
|
||||
boss1SignHash = models.CharField('签字图片1哈希值', max_length=64, null=True)
|
||||
boss1Opinion = models.BooleanField('领导1意见', null=True)
|
||||
boss2SignLink = models.CharField('签字图片2下载链接', max_length=255, null=True)
|
||||
boss2SignHash = models.CharField('签字图片2哈希值', max_length=64, null=True)
|
||||
boss2Opinion = models.BooleanField('领导2意见', null=True)
|
||||
checkHash = models.CharField(verbose_name='审核结果哈希值', null=True, max_length=64)
|
||||
reviewResult = models.BooleanField(verbose_name='秘书长审核结果', null=True)
|
||||
researchResult = models.BooleanField(verbose_name='最终结果', null=True) # 最终意见opinion
|
||||
workingStatus = models.BooleanField(verbose_name='工作已经完成', default=False, null=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "办公流程"
|
||||
|
||||
def __str__(self):
|
||||
return self.dataTitle
|
||||
|
||||
|
||||
class DownloadRecord(models.Model):
|
||||
user = models.ForeignKey('User', on_delete=models.CASCADE, blank=True)
|
||||
officeFile = models.ForeignKey('OfficeFile', on_delete=models.CASCADE, blank=True)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "下载记录"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user.userLoginName) + "_下载_" + str(self.officeFile.dataTitle)
|
||||
|
||||
|
||||
class DataDisclosure(models.Model):
|
||||
economic = models.BooleanField('经济', default=False)
|
||||
population = models.BooleanField('人口', default=False)
|
||||
agriculture = models.BooleanField('农业', default=False)
|
||||
industry = models.BooleanField('工业', default=False)
|
||||
serviceIndustry = models.BooleanField('服务业', default=False)
|
||||
peopleLivelihood = models.BooleanField('民生', default=False)
|
||||
naturalResources = models.BooleanField('自然资源', default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "政府数据披露"
|
||||
|
||||
def __str__(self):
|
||||
return User.userTypeChoices[self.id - 1][1]
|
||||
|
||||
"""class InformationDisclosure(models.Model):
|
||||
user = models.ForeignKey(User, verbose_name='用户主键', on_delete=models.CASCADE)
|
||||
info1 = models.BooleanField("披露头像", default=False)
|
||||
info2 = models.BooleanField("披露ID", default=False)
|
||||
info3 = models.BooleanField("披露身份", default=False)
|
||||
info4 = models.BooleanField("披露地址", default=False)
|
||||
info5 = models.BooleanField("披露公钥", default=False)
|
||||
info6 = models.BooleanField("披露私钥", default=False)
|
||||
target1 = models.BooleanField("披露对象学生", default=False)
|
||||
target2 = models.BooleanField("披露对象教师", default=False)
|
||||
target3 = models.BooleanField("披露对象行政人员", default=False)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "信息披露"
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user.userLoginName) + '_信息披露' """
|
||||
|
||||
|
||||
|
||||
3
django后端代码/user/tests.py
Normal file
3
django后端代码/user/tests.py
Normal file
@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
41
django后端代码/user/urls.py
Normal file
41
django后端代码/user/urls.py
Normal file
@ -0,0 +1,41 @@
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('get_openid_session_key', views.get_openid_session_key, name='get_openid_session_key'),
|
||||
path('check_token', views.check_token, name='check_token'),
|
||||
path('getUserInfo', views.getUserInfo, name='getUserInfo'),
|
||||
path('setPassword', views.setPassword, name='setPassword'),
|
||||
path('addSuggest', views.addSuggest, name='addSuggest'),
|
||||
path('return_qiniu_upload_token', views.return_qiniu_upload_token, name='return_qiniu_upload_token'),
|
||||
# path('getData', views.getData, name='getData'),
|
||||
path('returnSuggestList', views.returnSuggestList, name='returnSuggestList'),
|
||||
# path('returnResourceList', views.returnResourceList, name='returnResourceList'),
|
||||
path('dataDownload', views.dataDownload, name='dataDownload'),
|
||||
path('returnFileListToStaff', views.returnFileListToStaff, name='returnFileListToStaff'),
|
||||
path('getApplyData', views.getApplyData, name='getApplyData'),
|
||||
path('returnApplyStatus', views.returnApplyStatus, name='returnApplyStatus'),
|
||||
path('postApplicationListToAdminToSign', views.postApplicationListToAdminToSign,
|
||||
name='postApplicationListToAdminToSign'),
|
||||
path('postPublicityList', views.postPublicityList, name='postPublicityList'),
|
||||
path('bossSign', views.bossSign, name='bossSign'),
|
||||
path('bossCheck', views.bossCheck, name='bossCheck'),
|
||||
path('getAdminPassword', views.getAdminPassword, name='getAdminPassword'),
|
||||
|
||||
|
||||
path('returnDisclosureInfo', views.returnDisclosureInfo, name='returnDisclosureInfo'),
|
||||
path('setDisclosureObject', views.setDisclosureObject, name='setDisclosureObject'),
|
||||
path('returnDataDisclosure', views.returnDataDisclosure, name='returnDataDisclosure'),
|
||||
path('setHighDiskArea', views.setHighDiskArea, name='setHighDiskArea'),
|
||||
path('setLowDiskArea', views.setLowDiskArea, name='setLowDiskArea'),
|
||||
path('setUserPassingArea', views.setUserPassingArea, name='setUserPassingArea'),
|
||||
path('getUserPassingArea', views.getUserPassingArea, name='getUserPassingArea'),
|
||||
# path('getInformationDisclosure', views.getInformationDisclosure, name='getInformationDisclosure'),
|
||||
# path('returnInformationDisclosure', views.returnInformationDisclosure, name='returnInformationDisclosure'),
|
||||
# path('getOwnList', views.getOwnList, name='getOwnList'),
|
||||
path('getOwnSuggestList', views.getOwnSuggestList, name='getOwnSuggestList'),
|
||||
# path('getResourceUpList', views.getResourceUpList, name='getResourceUpList'),
|
||||
path('getResourceDownList', views.getResourceDownList, name='getResourceDownList'),
|
||||
# path('getDownloaderList', views.getDownloaderList, name='getDownloaderList'),
|
||||
]
|
||||
822
django后端代码/user/views.py
Normal file
822
django后端代码/user/views.py
Normal file
@ -0,0 +1,822 @@
|
||||
import json
|
||||
import datetime
|
||||
import re
|
||||
import time
|
||||
|
||||
# Create your views here.
|
||||
from user.models import User, Suggest, OfficeFile, OfficeMember, Office, DownloadRecord, DataDisclosure
|
||||
from jwt import ExpiredSignatureError
|
||||
|
||||
from utils.apiTest import registered, updateUserCredit, addSuggestToChain, getSuggesterId, \
|
||||
bossSignOnChain, checkResultOnChain, getSuggestFromChain, uploadOfficeFile, turnToShowFileToPeople, \
|
||||
updateFileDownloadNum, setLogForDatePublic
|
||||
from utils.appInfo import miniProgramAppID, miniProgramApp, Bucket, SecretKey, AccessKey
|
||||
import jwt
|
||||
from django.http import JsonResponse, HttpResponse
|
||||
import requests
|
||||
import qiniu
|
||||
import datetime
|
||||
import hashlib
|
||||
|
||||
from utils.checkContent import checkContent
|
||||
from utils.getUser import get_user
|
||||
|
||||
|
||||
def get_openid_session_key(request): # 获取openid和session_key,创建用户数据,并返回加密token给前端
|
||||
appid = miniProgramAppID
|
||||
app_secret = miniProgramApp
|
||||
# primary_key_id = 0 # 记录用户主键
|
||||
js_code = json.loads(request.body) # js_code为dict = {'code': '……'}
|
||||
"""js_code = str(request.body)[2:-1] # request.body为b'code',类型为bytes,故将其转为string且用字符串方法去掉b''"""
|
||||
# js_code = request.GET.get('code') # get方法
|
||||
url = 'https://api.weixin.qq.com/sns/jscode2session' + '?appid=' + appid + '&secret=' + app_secret + '&js_code=' + \
|
||||
js_code['code'] + '&grant_type=authorization_code'
|
||||
r = requests.get(url)
|
||||
# print(r.json())
|
||||
openId = r.json()['openid']
|
||||
"""try:
|
||||
UnionId = r.json()['unionid']
|
||||
except Exception as e:
|
||||
print(e)
|
||||
UnionId = None"""
|
||||
# session_key = r.json()['session_key']
|
||||
try:
|
||||
user = User.objects.get(openId=openId)
|
||||
except Exception as e:
|
||||
user = None
|
||||
if user:
|
||||
primary_key_id = user.id
|
||||
print('数据库中有该用户\n')
|
||||
else:
|
||||
print('注册新用户\n')
|
||||
user = User(openId=openId)
|
||||
user.userLoginName = str(int(time.time()))
|
||||
user.save()
|
||||
primary_key_id = user.id # 主键
|
||||
secret = b'\x3d\xef\x87\xd5\xf8\xbb\xff\xfc\x80\x91\x06\x91\xfd\xfc\xed\x69'
|
||||
dic = {
|
||||
'exp': datetime.datetime.now() + datetime.timedelta(hours=3), # 过期时间
|
||||
'iat': datetime.datetime.now(), # 开始时间
|
||||
'iss': 'cyb', # 签名
|
||||
'data': { # 内容,一般存放该用户id和开始时间
|
||||
'id': primary_key_id,
|
||||
'openId': openId,
|
||||
},
|
||||
} # 由此生成的token将由用户保存,不存入数据库。用户传回服务端后,解析出整数型主键id(用以检索,速度比检索openid快)
|
||||
encrypted_string = jwt.encode(dic, secret, algorithm='HS256')
|
||||
# jwt.encode为加密生成字节流,为b'code',类型为bytes,故将其转为string且用字符串方法去掉b'
|
||||
# print('get_openid_session_key运行结束\n')
|
||||
dicIncludeTokenAndUserid = {
|
||||
'token': encrypted_string, # 学长服务器那里不知道为啥不用转换
|
||||
# 'token': str(encrypted_string, encoding='utf-8'), # encrypted_string为bytes类型,需转为字符串才能通过jsonResponse传输
|
||||
'userId': primary_key_id, # 若直接把字节型的encrypted_string通过HttpResponse传给前端,前端会自动转为字符串
|
||||
'idNumber': user.userLoginName,
|
||||
# 'registeredStatus': checkRegistered(user.id),
|
||||
# 'creditPoint': user.userCreditPoint,
|
||||
'addressToCopy': user.accountAddress,
|
||||
'publicKeyToCopy': user.accountPk,
|
||||
'privateKeyToCopy': user.accountSk,
|
||||
# 'hadApply': user.hadApply,
|
||||
'userType': user.userType,
|
||||
"userWxName": user.userWxName,
|
||||
"avatarUrl": user.avatarUrl,
|
||||
}
|
||||
# print('返回dicIncludeTokenAndUserid')
|
||||
return JsonResponse(dicIncludeTokenAndUserid, safe=False)
|
||||
|
||||
|
||||
def check_token(request):
|
||||
secret = b'\x3d\xef\x87\xd5\xf8\xbb\xff\xfc\x80\x91\x06\x91\xfd\xfc\xed\x69'
|
||||
encrypted_string = json.loads(request.body)
|
||||
print('check_token开始运行\n')
|
||||
try:
|
||||
decrypt_string = jwt.decode(encrypted_string['token'], secret, issuer='cyb', algorithms=['HS256']) # 解密,校验签名
|
||||
print('check_token运行结束,返回true\n')
|
||||
primary_key = (decrypt_string['data'])['id']
|
||||
user = User.objects.get(id=primary_key)
|
||||
data = {
|
||||
'idNumber': user.userLoginName,
|
||||
"tokenActivate": "true",
|
||||
'userId': primary_key,
|
||||
'userType': user.userType,
|
||||
# 'registeredStatus': checkRegistered(user.id),
|
||||
# 'creditPoint': getCredit(user.id),
|
||||
'addressToCopy': user.accountAddress,
|
||||
'publicKeyToCopy': user.accountPk,
|
||||
'privateKeyToCopy': user.accountSk,
|
||||
# 'hadApply': user.hadApply,
|
||||
"userWxName": user.userWxName,
|
||||
"avatarUrl": user.avatarUrl,
|
||||
}
|
||||
return JsonResponse(data) # 没过期
|
||||
except ExpiredSignatureError:
|
||||
print('check_token运行结束,返回false\n')
|
||||
data = {"token": "false"}
|
||||
return JsonResponse(data) # 过期,令前端重新调用函数get_openid_session_key
|
||||
except jwt.exceptions.DecodeError:
|
||||
print('check_token运行结束,getProxy返回false\n')
|
||||
data = {"token": "false"}
|
||||
return JsonResponse(data) # 过期,令前端重新调用函数get_openid_session_key
|
||||
|
||||
|
||||
def getUserInfo(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
if obj['funType'] == 0:
|
||||
user.userWxName = obj['name']
|
||||
user.avatarUrl = obj['avatarUrl']
|
||||
user.save()
|
||||
userTypeList = []
|
||||
choices = User.userTypeChoices
|
||||
for c in choices:
|
||||
userTypeList.append(c[1])
|
||||
data = {'userType': user.userType, 'userTypeList': userTypeList}
|
||||
if obj['funType'] == 1:
|
||||
data['avatarUrl'] = user.avatarUrl
|
||||
data['nickName'] = user.userWxName
|
||||
return JsonResponse(data, safe=False)
|
||||
|
||||
|
||||
def setPassword(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
s = hashlib.sha256() # Get the hash algorithm.
|
||||
s.update(obj['password'].encode("utf8")) # Hash the data.
|
||||
user.userPassword = s.hexdigest() # Get he hash value.
|
||||
user.registeredStatus = True
|
||||
user.userType = int(obj['userType'])
|
||||
user.save()
|
||||
user.activateTime = datetime.datetime.now()
|
||||
registered(user.userLoginName, user.userWxName, obj['password'], User.userTypeChoices[int(obj['userType'])][1])
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/privateKey?type=0&userName=' + str(user.userLoginName)
|
||||
print("url:")
|
||||
print(url)
|
||||
r = requests.get(url)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
user.accountAddress = obj['address']
|
||||
user.accountPk = obj['publicKey']
|
||||
user.accountSk = obj['privateKey']
|
||||
user.save()
|
||||
print('注册结果:')
|
||||
print(obj)
|
||||
return HttpResponse("true")
|
||||
|
||||
|
||||
def addSuggest(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
suggest = Suggest(user_id=user.id, suggestTitle=obj['suggestTitle'], suggestContent=obj['suggestContent'])
|
||||
suggest.save()
|
||||
addSuggestToChain(suggest.id, user.userLoginName, suggest.suggestTitle, suggest.suggestContent)
|
||||
content = getSuggestFromChain(suggest.id)[1]
|
||||
suggestFromChain = content[1]
|
||||
titleStartIndex = re.search('建议标题为:', suggestFromChain).span()[1]
|
||||
contentStartIndex = re.search('建议内容为:', suggestFromChain).span()[1]
|
||||
data1 = checkContent(suggestFromChain[titleStartIndex:contentStartIndex - 6])
|
||||
data2 = checkContent(suggestFromChain[contentStartIndex:])
|
||||
suggest.changeSuggestTitle = data1['text']
|
||||
suggest.changeSuggestContent = data2['text']
|
||||
if data1['num'] > 0 or data2['num'] > 0:
|
||||
suggest.isCompliance = False
|
||||
user.userCreditPoint = user.userCreditPoint - 1
|
||||
user.save()
|
||||
else:
|
||||
suggest.isCompliance = True
|
||||
suggest.save()
|
||||
if suggest.isCompliance is False:
|
||||
suggesterId = getSuggesterId(suggest.id)
|
||||
updateUserCredit(suggesterId, 1, 0)
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def return_qiniu_upload_token(request):
|
||||
bucket = Bucket # 上传的空间名
|
||||
key = "" # 上传的文件名,默认为空
|
||||
auth = qiniu.Auth(AccessKey, SecretKey)
|
||||
policy = {
|
||||
# "mimeLimit": "image/*"
|
||||
}
|
||||
upToken = auth.upload_token(bucket, policy=policy) # 生成上传凭证
|
||||
# upToken = auth.upload_token(bucket) # 生成上传凭证
|
||||
# print('upToken:')
|
||||
# print(upToken)
|
||||
data = {"uptoken": upToken}
|
||||
return JsonResponse(data, safe=False)
|
||||
|
||||
|
||||
"""def getData(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
data = Data(user_id=user.id, dataTitle=obj['dataTitle'], dataIntroduction=obj['dataIntroduction'],
|
||||
dataHash=obj['dataHash'], dataLink=obj['dataLink'], dataValue=obj['dataValue'])
|
||||
data.save()
|
||||
uploadDateResource(data.id, user.userLoginName, data.dataHash, data.dataValue,
|
||||
data.uploadTime.strftime("%Y年%m月%d日"))
|
||||
return HttpResponse('success')"""
|
||||
|
||||
|
||||
def returnSuggestList(request):
|
||||
obj = json.loads(request.body)
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
suggests = Suggest.objects.all().order_by('-id')[startRow:endRow]
|
||||
suggestList = []
|
||||
for s in suggests:
|
||||
obj = {"id": s.id, "userId": s.user.userLoginName, 'title': s.changeSuggestTitle,
|
||||
"content": s.changeSuggestContent,
|
||||
"isCompliance": s.isCompliance, "suggestTime": s.suggestTime.strftime("%Y.%m.%d")}
|
||||
suggestList.append(obj)
|
||||
return JsonResponse({"suggestList": suggestList})
|
||||
|
||||
|
||||
"""def returnResourceList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
resources = Data.objects.all().order_by('-id')[startRow:endRow]
|
||||
dataList = []
|
||||
for r in resources:
|
||||
obj = {"id": r.id, "userId": r.user.userLoginName, 'title': r.dataTitle, "introduction": r.dataIntroduction,
|
||||
"dataLink": r.dataLink, "downloadNum": r.downloadsNum, "dataValue": r.dataValue,
|
||||
"uploadTime": r.uploadTime.strftime("%Y.%m.%d"), 'dataHash': r.dataHash}
|
||||
dataList.append(obj)
|
||||
return JsonResponse({"dataList": dataList})"""
|
||||
|
||||
|
||||
def dataDownload(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
data = OfficeFile.objects.get(id=int(obj['dataId']))
|
||||
data.downloadsNum = data.downloadsNum + 1
|
||||
data.save()
|
||||
downloadRecord = DownloadRecord.objects.create(user_id=user.id, officeFile_id=data.id)
|
||||
downloadRecord.save()
|
||||
updateFileDownloadNum(user.userLoginName, data.id)
|
||||
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def getAdminPassword(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
officeMember = OfficeMember.objects.get(account=obj['account'])
|
||||
if obj['password'] == officeMember.password:
|
||||
choices = OfficeMember.identityChoices
|
||||
adminTypeList = []
|
||||
for c in choices:
|
||||
adminTypeList.append(c[1])
|
||||
return JsonResponse(
|
||||
{'identity': officeMember.identity, 'id': officeMember.id, 'departmentId': officeMember.department.id,
|
||||
'departmentName': officeMember.department.departmentName, 'status': 'success',
|
||||
'adminTypeList': adminTypeList})
|
||||
else:
|
||||
return JsonResponse({'status': 'failed'})
|
||||
|
||||
|
||||
def getApplyData(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
officeFile = OfficeFile(officeMember_id=obj['officeMemberId'], dataTitle=obj['dataTitle'],
|
||||
dataIntroduction=obj['dataIntroduction'],
|
||||
informationLink=obj['informationLink'], informationHash=obj['informationHash'])
|
||||
officeFile.save()
|
||||
if uploadOfficeFile(officeFile.id, user.userLoginName, obj['informationHash']):
|
||||
return HttpResponse("success")
|
||||
else:
|
||||
return HttpResponse("failed")
|
||||
# user.hadApply = True
|
||||
# user.save()
|
||||
|
||||
|
||||
def returnFileListToStaff(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
officeFiles = OfficeFile.objects.filter(officeMember_id=obj['memberId']).order_by('-id')[startRow:endRow]
|
||||
officeFileList = []
|
||||
for o in officeFiles:
|
||||
data = {'fileId': o.id, 'uploadTime': o.uploadTime.strftime("%Y.%m.%d"), 'workingStatus': o.workingStatus,
|
||||
'userId': o.officeMember.user.userLoginName, "downloadNum": o.downloadsNum,
|
||||
"informationLink": o.informationLink, "informationHash": o.informationHash, 'title': o.dataTitle,
|
||||
"introduction": o.dataIntroduction, 'researchResult': o.researchResult,
|
||||
"boss1Opinion": o.boss1Opinion, "boss1SignLink": o.boss1SignLink, "boss1SignHash": o.boss1SignHash,
|
||||
"boss2Opinion": o.boss2Opinion, "boss2SignLink": o.boss2SignLink, "boss2SignHash": o.boss2SignHash,
|
||||
'reviewResult': o.reviewResult}
|
||||
officeFileList.append(data)
|
||||
return JsonResponse({'officeFileList': officeFileList})
|
||||
|
||||
|
||||
# 给申请人看当前申请状态
|
||||
def returnApplyStatus(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
a = OfficeFile.objects.get(id=obj['fileId'])
|
||||
data = {'uploadTime': a.uploadTime.strftime("%Y.%m.%d"),
|
||||
"informationLink": a.informationLink, "informationHash": a.informationHash,
|
||||
"boss1Opinion": a.boss1Opinion, "boss1SignLink": a.boss1SignLink, "boss1SignHash": a.boss1SignHash,
|
||||
"boss2Opinion": a.boss2Opinion, "boss2SignLink": a.boss2SignLink, "boss2SignHash": a.boss2SignHash,
|
||||
"checkHash": a.checkHash, "researchResult": a.researchResult, 'reviewResult': a.reviewResult
|
||||
}
|
||||
return JsonResponse(data)
|
||||
|
||||
|
||||
def postApplicationListToAdminToSign(request): # 领导签字列表推送
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
whichBoss = obj['identity']
|
||||
departmentId = obj['departmentId']
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
if whichBoss == 1:
|
||||
officeFiles = OfficeFile.objects.filter(workingStatus=False, boss1Opinion=None,
|
||||
officeMember__department__id=departmentId).order_by('-id')[
|
||||
startRow:endRow]
|
||||
else:
|
||||
officeFiles = OfficeFile.objects.filter(workingStatus=False, boss2Opinion=None,
|
||||
officeMember__department__id=departmentId).exclude(
|
||||
boss1Opinion=None).order_by('-id')[startRow:endRow]
|
||||
officeFileList = []
|
||||
for o in officeFiles:
|
||||
data = {"fileId": o.id, 'uploadTime': o.uploadTime.strftime("%Y.%m.%d"),
|
||||
"informationLink": o.informationLink, "informationHash": o.informationHash, 'title': o.dataTitle,
|
||||
"introduction": o.dataIntroduction, 'userId': o.officeMember.user.userLoginName}
|
||||
officeFileList.append(data)
|
||||
return JsonResponse({"officeFileList": officeFileList})
|
||||
|
||||
|
||||
def bossSign(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
whichBoss = obj['whichBoss']
|
||||
applicationForm = OfficeFile.objects.get(id=obj['id'])
|
||||
if whichBoss == 1:
|
||||
applicationForm.boss1Opinion = obj['boss1Opinion']
|
||||
applicationForm.boss1SignLink = obj['boss1SignLink']
|
||||
applicationForm.boss1SignHash = obj['boss1SignHash']
|
||||
if obj['boss1Opinion'] is False:
|
||||
applicationForm.researchResult = False
|
||||
applicationForm.workingStatus = False
|
||||
else:
|
||||
applicationForm.boss2Opinion = obj['boss2Opinion']
|
||||
applicationForm.boss2SignLink = obj['boss2SignLink']
|
||||
applicationForm.boss2SignHash = obj['boss2SignHash']
|
||||
if obj['boss2Opinion'] is False:
|
||||
applicationForm.researchResult = False
|
||||
applicationForm.workingStatus = False
|
||||
if applicationForm.boss1Opinion is not None and applicationForm.boss2Opinion is not None:
|
||||
s = hashlib.sha256() # Get the hash algorithm.
|
||||
s.update((applicationForm.boss1SignHash + applicationForm.boss2SignHash).encode("utf8")) # Hash the data.
|
||||
applicationForm.checkHash = s.hexdigest() # Get he hash value.
|
||||
bossSignOnChain(obj['id'], s.hexdigest())
|
||||
applicationForm.save()
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def postPublicityList(request): # 公示列表推送或人事处审核列表推送 由obj['workingStatus'] 决定是哪个
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
if obj['workingStatus']:
|
||||
officeFiles = OfficeFile.objects.filter(workingStatus=True, researchResult=True).order_by('-id')[
|
||||
startRow:endRow]
|
||||
else:
|
||||
departmentId = obj['departmentId']
|
||||
officeFiles = OfficeFile.objects.filter(workingStatus=False, reviewResult=None,
|
||||
officeMember__department__id=departmentId).exclude(
|
||||
boss1Opinion=None).exclude(boss2Opinion=None).order_by('-id')[startRow:endRow]
|
||||
officeFileList = []
|
||||
for a in officeFiles:
|
||||
data = {"fileId": a.id, 'title': a.dataTitle, "introduction": a.dataIntroduction,
|
||||
'uploadTime': a.uploadTime.strftime("%Y.%m.%d"), 'userId': a.officeMember.user.userLoginName,
|
||||
"informationLink": a.informationLink, "informationHash": a.informationHash,
|
||||
"boss1Opinion": a.boss1Opinion, "boss1SignLink": a.boss1SignLink, "boss1SignHash": a.boss1SignHash,
|
||||
"boss2Opinion": a.boss2Opinion, "boss2SignLink": a.boss2SignLink, "boss2SignHash": a.boss2SignHash,
|
||||
"checkHash": a.checkHash, "researchResult": a.researchResult, 'reviewResult': a.reviewResult}
|
||||
officeFileList.append(data)
|
||||
return JsonResponse({"officeFileList": officeFileList})
|
||||
|
||||
|
||||
def bossCheck(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
applicationForm = OfficeFile.objects.get(id=obj['id'])
|
||||
applicationForm.reviewResult = obj['reviewResult']
|
||||
applicationForm.workingStatus = True
|
||||
if applicationForm.boss1Opinion and applicationForm.boss2Opinion:
|
||||
applicationForm.researchResult = True
|
||||
checkResultOnChain(user.userWxName, obj['id'], '通过')
|
||||
turnToShowFileToPeople(obj['id'], user.userLoginName, applicationForm.informationHash)
|
||||
else:
|
||||
applicationForm.researchResult = False
|
||||
checkResultOnChain(user.userWxName, obj['id'], '不通过')
|
||||
applicationForm.save()
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
# 返回用户身份信息和披露数据信息
|
||||
def returnDisclosureInfo(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
list0 = [
|
||||
{'title': "经济", 'checked': False, 'value': 'c0'},
|
||||
{'title': "人口", 'checked': False, 'value': 'c1'},
|
||||
{'title': "农业", 'checked': False, 'value': 'c2'},
|
||||
{'title': "工业", 'checked': False, 'value': 'c3'},
|
||||
{'title': "服务业", 'checked': False, 'value': 'c4'},
|
||||
{'title': "民生", 'checked': False, 'value': 'c5'},
|
||||
{'title': "自然资源", 'checked': False, 'value': 'c6'},
|
||||
]
|
||||
list1 = []
|
||||
userTypeChoices = User.userTypeChoices
|
||||
for index in range(len(userTypeChoices)):
|
||||
list1.append({"title": userTypeChoices[index][1], 'checked': False, 'value': index})
|
||||
return JsonResponse({'list0': list0, 'list1': list1})
|
||||
|
||||
|
||||
# 设置披露的对象
|
||||
def setDisclosureObject(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
showPeopleArray = obj['targetList']
|
||||
showObjectArray = obj['infoList']
|
||||
objText = ''
|
||||
infoText = []
|
||||
for p in showPeopleArray:
|
||||
targetId = int(p) + 1
|
||||
if targetId == 1:
|
||||
objText = '个人'
|
||||
if targetId == 2:
|
||||
objText = '企业'
|
||||
if targetId == 3:
|
||||
objText = '行政机关'
|
||||
dataDisclosure = DataDisclosure.objects.get(id=targetId)
|
||||
dataDisclosure.economic = False
|
||||
dataDisclosure.population = False
|
||||
dataDisclosure.agriculture = False
|
||||
dataDisclosure.industry = False
|
||||
dataDisclosure.serviceIndustry = False
|
||||
dataDisclosure.peopleLivelihood = False
|
||||
dataDisclosure.naturalResources = False
|
||||
|
||||
if 'c0' in showObjectArray:
|
||||
dataDisclosure.economic = True
|
||||
infoText.append('经济')
|
||||
if 'c1' in showObjectArray:
|
||||
dataDisclosure.population = True
|
||||
infoText.append('人口')
|
||||
if 'c2' in showObjectArray:
|
||||
dataDisclosure.agriculture = True
|
||||
infoText.append('农业')
|
||||
if 'c3' in showObjectArray:
|
||||
dataDisclosure.industry = True
|
||||
infoText.append('工业')
|
||||
if 'c4' in showObjectArray:
|
||||
dataDisclosure.serviceIndustry = True
|
||||
infoText.append('服务业')
|
||||
if 'c5' in showObjectArray:
|
||||
dataDisclosure.peopleLivelihood = True
|
||||
infoText.append('民生')
|
||||
if 'c6' in showObjectArray:
|
||||
dataDisclosure.naturalResources = True
|
||||
infoText.append('自然资源')
|
||||
dataDisclosure.save()
|
||||
setLogForDatePublic(user.userLoginName, objText, '、'.join(infoText))
|
||||
objText = ''
|
||||
infoText = []
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def returnDataDisclosure(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
dataLinkArray = [
|
||||
{'name': "经济", 'link': "https://onestopimages.luckydraw.net.cn/%E7%BB%8F%E6%B5%8E.png", 'hadCheck': False},
|
||||
{'name': "人口", 'link': "https://onestopimages.luckydraw.net.cn/%E4%BA%BA%E5%8F%A3.png", 'hadCheck': False},
|
||||
{'name': "农业", 'link': "https://onestopimages.luckydraw.net.cn/%E5%86%9C%E4%B8%9A.png", 'hadCheck': False},
|
||||
{'name': "工业", 'link': "https://onestopimages.luckydraw.net.cn/%E5%B7%A5%E4%B8%9A.png", 'hadCheck': False},
|
||||
{'name': "服务业", 'link': "https://onestopimages.luckydraw.net.cn/%E6%9C%8D%E5%8A%A1%E4%B8%9A.png",
|
||||
'hadCheck': False},
|
||||
{'name': "民生", 'link': "https://onestopimages.luckydraw.net.cn/%E6%B0%91%E7%94%9F.png", 'hadCheck': False},
|
||||
{'name': "自然资源", 'link': "https://onestopimages.luckydraw.net.cn/%E8%87%AA%E7%84%B6%E8%B5%84%E6%BA%90.png",
|
||||
'hadCheck': False},
|
||||
]
|
||||
userType = user.userType + 1
|
||||
dataDisclosure = DataDisclosure.objects.get(id=userType)
|
||||
|
||||
if dataDisclosure.economic is False:
|
||||
dataLinkArray[0]['link'] = None
|
||||
if dataDisclosure.population is False:
|
||||
dataLinkArray[1]['link'] = None
|
||||
if dataDisclosure.agriculture is False:
|
||||
dataLinkArray[2]['link'] = None
|
||||
if dataDisclosure.industry is False:
|
||||
dataLinkArray[3]['link'] = None
|
||||
if dataDisclosure.serviceIndustry is False:
|
||||
dataLinkArray[4]['link'] = None
|
||||
if dataDisclosure.peopleLivelihood is False:
|
||||
dataLinkArray[5]['link'] = None
|
||||
if dataDisclosure.naturalResources is False:
|
||||
dataLinkArray[6]['link'] = None
|
||||
return JsonResponse({"dataLinkArray": dataLinkArray})
|
||||
|
||||
|
||||
def setHighDiskArea(request):
|
||||
obj = json.loads(request.body)
|
||||
highDiskArea = obj['highDiskArea']
|
||||
print(highDiskArea)
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def setLowDiskArea(request):
|
||||
obj = json.loads(request.body)
|
||||
lowDiskArea = obj['lowDiskArea']
|
||||
print(lowDiskArea)
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def setUserPassingArea(request):
|
||||
obj = json.loads(request.body)
|
||||
userID = obj['userID']
|
||||
passingArea = obj['passingArea']
|
||||
print(userID)
|
||||
print(passingArea)
|
||||
return HttpResponse("success")
|
||||
|
||||
|
||||
def getUserPassingArea(request):
|
||||
obj = json.loads(request.body)
|
||||
userID = obj['userID']
|
||||
print(userID)
|
||||
passingAreaList = [{"name": '南昌', "isRisky": False}, {"name": '南昌', "isRisky": False}]
|
||||
return JsonResponse({"passingAreaList": passingAreaList})
|
||||
|
||||
|
||||
"""def getInformationDisclosure(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
informationDisclosure = InformationDisclosure(user_id=user.id)
|
||||
infoList = obj['infoList']
|
||||
targetList = obj['targetList']
|
||||
infoToPost = []
|
||||
targetToPost = []
|
||||
if 'c1' in infoList:
|
||||
informationDisclosure.info1 = True
|
||||
infoToPost.append('头像')
|
||||
if 'c2' in infoList:
|
||||
informationDisclosure.info2 = True
|
||||
infoToPost.append('ID')
|
||||
if 'c3' in infoList:
|
||||
informationDisclosure.info3 = True
|
||||
infoToPost.append('身份')
|
||||
if 'c4' in infoList:
|
||||
informationDisclosure.info4 = True
|
||||
infoToPost.append('地址')
|
||||
if 'c5' in infoList:
|
||||
informationDisclosure.info5 = True
|
||||
infoToPost.append('公钥')
|
||||
if 'c6' in infoList:
|
||||
informationDisclosure.info6 = True
|
||||
infoToPost.append('私钥')
|
||||
|
||||
if 'c1' in targetList:
|
||||
informationDisclosure.target1 = True
|
||||
targetToPost.append('学生')
|
||||
if 'c2' in targetList:
|
||||
informationDisclosure.target2 = True
|
||||
targetToPost.append('教师')
|
||||
if 'c3' in targetList:
|
||||
informationDisclosure.target3 = True
|
||||
targetToPost.append('行政人员')
|
||||
informationDisclosure.save()
|
||||
setMyInfoPublic(user.userLoginName, "、".join(infoToPost), "、".join(targetToPost))
|
||||
return HttpResponse("success")"""
|
||||
|
||||
"""def returnInformationDisclosure(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
userType = obj['userType']
|
||||
informationDisclosureList = []
|
||||
informationDisclosures = None
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
if userType == 0:
|
||||
informationDisclosures = InformationDisclosure.objects.filter(target1=True).order_by('-id')[
|
||||
startRow:endRow]
|
||||
elif userType == 1:
|
||||
informationDisclosures = InformationDisclosure.objects.filter(target2=True).order_by('-id')[
|
||||
startRow:endRow]
|
||||
else:
|
||||
informationDisclosures = InformationDisclosure.objects.filter(target3=True).order_by('-id')[
|
||||
startRow:endRow]
|
||||
for i in informationDisclosures:
|
||||
# '/images/avatar.png'
|
||||
data = {'userAvatar': i.user.avatarUrl, 'userIdNumber': i.user.userLoginName, 'userType': None,
|
||||
'publicKey': None, 'privateKey': None, 'userWxName': i.user.userWxName, 'id': i.id, 'address': None}
|
||||
if i.info1:
|
||||
data['userAvatar'] = i.user.avatarUrl
|
||||
if i.info2:
|
||||
data['userIdNumber'] = i.user.userLoginName
|
||||
if i.info3:
|
||||
data['userType'] = i.user.userType
|
||||
if i.info4:
|
||||
data['address'] = i.user.accountAddress
|
||||
if i.info5:
|
||||
data['publicKey'] = i.user.accountPk
|
||||
if i.info6:
|
||||
data['privateKey'] = i.user.accountSk
|
||||
informationDisclosureList.append(data)
|
||||
userTypeList = []
|
||||
choices = User.userTypeChoices
|
||||
for c in choices:
|
||||
userTypeList.append(c[1])
|
||||
return JsonResponse({'informationDisclosureList': informationDisclosureList, 'userTypeList': userTypeList})"""
|
||||
|
||||
"""def getOwnList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
suggestList = []
|
||||
suggests = Suggest.objects.filter(user_id=user.id).order_by('-id')[0:10]
|
||||
for s in suggests:
|
||||
obj = {"id": s.id, "userId": s.user.userLoginName, 'title': s.changeSuggestTitle,
|
||||
"content": s.changeSuggestContent,
|
||||
"isCompliance": s.isCompliance, "suggestTime": s.suggestTime.strftime("%Y.%m.%d")}
|
||||
suggestList.append(obj)
|
||||
|
||||
resourceUpList = []
|
||||
ups = Data.objects.filter(user_id=user.id).order_by('-id')[0:10]
|
||||
for u in ups:
|
||||
obj = {"id": u.id, "userId": u.user.userLoginName, 'title': u.dataTitle, "introduction": u.dataIntroduction,
|
||||
"dataLink": u.dataLink, "downloadNum": u.downloadsNum, "dataValue": u.dataValue,
|
||||
"uploadTime": u.uploadTime.strftime("%Y.%m.%d"), 'dataHash': u.dataHash}
|
||||
resourceUpList.append(obj)
|
||||
|
||||
resourceDownList = []
|
||||
downs = Data.objects.filter(downloadrecord__user_id=user.id).order_by('-id')[0:10]
|
||||
for d in downs:
|
||||
obj = {"id": d.id, "userId": d.user.userLoginName, 'title': d.dataTitle, "introduction": d.dataIntroduction,
|
||||
"dataLink": d.dataLink, "downloadNum": d.downloadsNum, "dataValue": d.dataValue,
|
||||
"uploadTime": d.uploadTime.strftime("%Y.%m.%d"), 'dataHash': d.dataHash}
|
||||
resourceDownList.append(obj)
|
||||
data = {
|
||||
'suggestList': suggestList,
|
||||
'resourceUpList': resourceUpList,
|
||||
'resourceDownList': resourceDownList,
|
||||
}
|
||||
return JsonResponse(data, safe=False)"""
|
||||
|
||||
|
||||
def getOwnSuggestList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
suggestList = []
|
||||
suggests = Suggest.objects.filter(user_id=user.id).order_by('-id')[startRow:endRow]
|
||||
for s in suggests:
|
||||
obj = {"id": s.id, "userId": s.user.userLoginName, 'title': s.changeSuggestTitle,
|
||||
"content": s.changeSuggestContent,
|
||||
"isCompliance": s.isCompliance, "suggestTime": s.suggestTime.strftime("%Y.%m.%d")}
|
||||
suggestList.append(obj)
|
||||
return JsonResponse({"suggestList": suggestList}, safe=False)
|
||||
|
||||
|
||||
"""def getResourceUpList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
resourceUpList = []
|
||||
ups = Data.objects.filter(user_id=user.id).order_by('-id')[startRow:endRow]
|
||||
for u in ups:
|
||||
obj = {"id": u.id, "userId": u.user.userLoginName, 'title': u.dataTitle, "introduction": u.dataIntroduction,
|
||||
"dataLink": u.dataLink, "downloadNum": u.downloadsNum, "dataValue": u.dataValue,
|
||||
"uploadTime": u.uploadTime.strftime("%Y.%m.%d"), 'dataHash': u.dataHash}
|
||||
resourceUpList.append(obj)
|
||||
|
||||
return JsonResponse({"resourceUpList": resourceUpList}, safe=False)"""
|
||||
|
||||
|
||||
def getResourceDownList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
resourceDownList = []
|
||||
downs = OfficeFile.objects.filter(downloadrecord__user_id=user.id).order_by('-id')[startRow:endRow]
|
||||
for a in downs:
|
||||
obj = {"fileId": a.id, 'title': a.dataTitle, "introduction": a.dataIntroduction,
|
||||
'downloadNum': a.downloadsNum,
|
||||
'uploadTime': a.uploadTime.strftime("%Y.%m.%d"), 'userId': a.officeMember.user.userLoginName,
|
||||
"informationLink": a.informationLink, "informationHash": a.informationHash,
|
||||
"boss1Opinion": a.boss1Opinion, "boss1SignLink": a.boss1SignLink, "boss1SignHash": a.boss1SignHash,
|
||||
"boss2Opinion": a.boss2Opinion, "boss2SignLink": a.boss2SignLink, "boss2SignHash": a.boss2SignHash,
|
||||
"checkHash": a.checkHash, "researchResult": a.researchResult, 'reviewResult': a.reviewResult}
|
||||
resourceDownList.append(obj)
|
||||
return JsonResponse({"resourceDownList": resourceDownList}, safe=False)
|
||||
|
||||
|
||||
"""def getDownloaderList(request):
|
||||
obj = json.loads(request.body)
|
||||
user = get_user(obj)
|
||||
if not user:
|
||||
return HttpResponse('false') # token过期
|
||||
else:
|
||||
pageSize = 10
|
||||
currentPage = obj['currentPage']
|
||||
startRow = (currentPage - 1) * pageSize
|
||||
endRow = currentPage * pageSize
|
||||
downloaderList = []
|
||||
downloaders = DownloadRecord.objects.filter(data_id=obj['dataId']) .order_by('-id')[startRow:endRow]
|
||||
for d in downloaders:
|
||||
downloaderList.append(d.user.userLoginName)
|
||||
return JsonResponse({"downloaderList": downloaderList}, safe=False)"""
|
||||
286
django后端代码/utils/apiTest.py
Normal file
286
django后端代码/utils/apiTest.py
Normal file
@ -0,0 +1,286 @@
|
||||
import datetime
|
||||
import json
|
||||
|
||||
import requests
|
||||
|
||||
|
||||
# 1.注册
|
||||
def registered(key, userID, password, userType):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"isUserActivated","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"getUserType","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_userid","type":"string"},{"name":"_integral","type":"uint256"},{"name":"_opcode","type":"int8"}],"name":"updateUserIntegral","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_userid","type":"string"},{"name":"_username","type":"string"},{"name":"_userpassword","type":"string"},{"name":"_usertype","type":"string"}],"name":"activateUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"},{"name":"_userpassword","type":"string"}],"name":"Login","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"getUserCreditNum","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"userid","type":"string"}],"name":"getUserRecordArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"userid","type":"string"},{"indexed":False,"name":"usertype","type":"string"},{"indexed":False,"name":"activatetime","type":"string"}],"name":"REGISTER_USER_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"user_id","type":"string"},{"indexed":False,"name":"grade","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"DEL_CREDITPOINT_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"user_id","type":"string"},{"indexed":False,"name":"grade","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"ADD_CREDITPOINT_EVENT","type":"event"}],
|
||||
"contractAddress":"0xaa2d2ae8c0be3c025ec87233eb68d7f7a9ad8012",
|
||||
"funcName":"activateUser",
|
||||
"funcParam":["1611541715","Daniel","123456","个人"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(key), str(userID), str(password), userType]
|
||||
}
|
||||
print("用户注册传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print('注册结果:')
|
||||
print(obj)
|
||||
print(obj['message'].lower())
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# 2.更新用户信用值
|
||||
def updateUserCredit(key, creditPoint, action):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"isUserActivated","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"getUserType","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_userid","type":"string"},{"name":"_integral","type":"uint256"},{"name":"_opcode","type":"int8"}],"name":"updateUserIntegral","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_userid","type":"string"},{"name":"_username","type":"string"},{"name":"_userpassword","type":"string"},{"name":"_usertype","type":"string"}],"name":"activateUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"},{"name":"_userpassword","type":"string"}],"name":"Login","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_userid","type":"string"}],"name":"getUserCreditNum","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"userid","type":"string"}],"name":"getUserRecordArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"userid","type":"string"},{"indexed":False,"name":"usertype","type":"string"},{"indexed":False,"name":"activatetime","type":"string"}],"name":"REGISTER_USER_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"user_id","type":"string"},{"indexed":False,"name":"grade","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"DEL_CREDITPOINT_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"user_id","type":"string"},{"indexed":False,"name":"grade","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"ADD_CREDITPOINT_EVENT","type":"event"}],
|
||||
"contractAddress":"0xaa2d2ae8c0be3c025ec87233eb68d7f7a9ad8012",
|
||||
"funcName":"updateUserIntegral",
|
||||
"funcParam":["1611541715",1,0],
|
||||
"useCns":False,
|
||||
"funcParam": [str(key), creditPoint, action]
|
||||
}
|
||||
print("升级用户信用传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# 3.建言上链
|
||||
def addSuggestToChain(suggestKey, userKey, suggestTitle, suggestContent):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestId","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestContent","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_proposeid","type":"string"},{"name":"_userid","type":"string"},{"name":"_title","type":"string"},{"name":"_content","type":"string"}],"name":"suggestUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"Proposeid","type":"string"},{"indexed":False,"name":"Userid","type":"string"},{"indexed":False,"name":"_title","type":"string"},{"indexed":False,"name":"SuggestContent","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"SUGGEST","type":"event"}],
|
||||
"contractAddress":"0x651ed36dfdbfd6dc50447a468d3749e25f7316ec",
|
||||
"funcName":"suggestUser",
|
||||
"funcParam":["17846","1611541715","关于提供退役军人金融优惠措施的建议","尊敬的领导,本人通过网络知道了了去年事务部和十大银行签了优抚协议,其它省份落实的很好,希望江西省也能对接下江西银行,江西农商银行等"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(suggestKey), str(userKey), suggestTitle, suggestContent]
|
||||
}
|
||||
print("传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print("增加用户留言返回结果")
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# 4.链上获取建言内容
|
||||
def getSuggestFromChain(suggestKey):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestId","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestContent","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_proposeid","type":"string"},{"name":"_userid","type":"string"},{"name":"_title","type":"string"},{"name":"_content","type":"string"}],"name":"suggestUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"Proposeid","type":"string"},{"indexed":False,"name":"Userid","type":"string"},{"indexed":False,"name":"_title","type":"string"},{"indexed":False,"name":"SuggestContent","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"SUGGEST","type":"event"}],
|
||||
"contractAddress":"0x651ed36dfdbfd6dc50447a468d3749e25f7316ec",
|
||||
"funcName":"getSuggestRecordArray",
|
||||
"funcParam":["17846"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(suggestKey)]
|
||||
}
|
||||
print("获取建言内容传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print("增加用户留言返回结果")
|
||||
print(obj)
|
||||
return obj
|
||||
|
||||
|
||||
# 5链上获取建言者id,用于信用管理
|
||||
def getSuggesterId(suggestKey):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestRecordJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestId","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_proposeid","type":"string"}],"name":"getSuggestContent","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_proposeid","type":"string"},{"name":"_userid","type":"string"},{"name":"_title","type":"string"},{"name":"_content","type":"string"}],"name":"suggestUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"Proposeid","type":"string"},{"indexed":False,"name":"Userid","type":"string"},{"indexed":False,"name":"_title","type":"string"},{"indexed":False,"name":"SuggestContent","type":"string"},{"indexed":False,"name":"time","type":"string"}],"name":"SUGGEST","type":"event"}],
|
||||
"contractAddress":"0x651ed36dfdbfd6dc50447a468d3749e25f7316ec",
|
||||
"funcName":"getSuggestId",
|
||||
"funcParam":["17846"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(suggestKey)]
|
||||
}
|
||||
print("获取建言内容传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print("增加用户留言返回结果")
|
||||
print(obj)
|
||||
return int(obj[0])
|
||||
|
||||
|
||||
# 6公文材料文件信息上链
|
||||
def uploadOfficeFile(fileKey, userKey, dataHash):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_userid","type":"string"},{"name":"_informationhash","type":"string"}],"name":"applyForDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getLeaderSignHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_checkerid","type":"string"},{"name":"_applicationid","type":"string"},{"name":"checkresult","type":"string"}],"name":"GiveResultToUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"checkhash","type":"string"}],"name":"checkApplyResearch","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getUserApplyArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"userid","type":"string"},{"indexed":False,"name":"application_id","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"APPLY_DOCUMENT_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"signHash","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_LeaderSignature","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"checkerid","type":"string"},{"indexed":False,"name":"result","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Tack_Final_Result","type":"event"}],
|
||||
"contractAddress":"0x98b9db3f2db6df5d912551b6672a87ae0e9202d7",
|
||||
"funcName":"applyForDocument",
|
||||
"funcParam":["1976945","1611541715","f44e39c1fc14dc05143eeba2065a921bbbc1bba5"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(fileKey), str(userKey), dataHash]
|
||||
}
|
||||
print("传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#7领导签字
|
||||
def bossSignOnChain(fileKey, signHash):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_userid","type":"string"},{"name":"_informationhash","type":"string"}],"name":"applyForDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getLeaderSignHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_checkerid","type":"string"},{"name":"_applicationid","type":"string"},{"name":"checkresult","type":"string"}],"name":"GiveResultToUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"checkhash","type":"string"}],"name":"checkApplyResearch","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getUserApplyArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"userid","type":"string"},{"indexed":False,"name":"application_id","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"APPLY_DOCUMENT_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"signHash","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_LeaderSignature","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"checkerid","type":"string"},{"indexed":False,"name":"result","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Tack_Final_Result","type":"event"}],
|
||||
"contractAddress":"0x98b9db3f2db6df5d912551b6672a87ae0e9202d7",
|
||||
"funcName":"checkApplyResearch",
|
||||
"funcParam":["1976945","f88r46f6ki14dc05143eeba2065a921bbbc1bbqi5"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(fileKey), signHash]
|
||||
}
|
||||
|
||||
print("bossSign传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#8结果上链
|
||||
def checkResultOnChain(userKey, fileKey, result): # result为"通过","不通过"
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_userid","type":"string"},{"name":"_informationhash","type":"string"}],"name":"applyForDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getLeaderSignHash","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getApplyJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_checkerid","type":"string"},{"name":"_applicationid","type":"string"},{"name":"checkresult","type":"string"}],"name":"GiveResultToUser","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"checkhash","type":"string"}],"name":"checkApplyResearch","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getUserApplyArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"userid","type":"string"},{"indexed":False,"name":"application_id","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"APPLY_DOCUMENT_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"signHash","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_LeaderSignature","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"checkerid","type":"string"},{"indexed":False,"name":"result","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Tack_Final_Result","type":"event"}],
|
||||
"contractAddress":"0x98b9db3f2db6df5d912551b6672a87ae0e9202d7",
|
||||
"funcName":"GiveResultToUser",
|
||||
"funcParam":["1671641799","1976945","通过"],
|
||||
"useCns":False,
|
||||
"funcParam": [userKey, str(fileKey), result]
|
||||
}
|
||||
print("checkResultOnChain传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#9公开结果
|
||||
def turnToShowFileToPeople(fileKey, userId, fileHash):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_leaderid","type":"string"},{"name":"_usertype","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDatePublic","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_documentid","type":"string"}],"name":"getDownloadsNum","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"downloadsid","type":"string"},{"name":"_documentid","type":"string"}],"name":"UpdateDownloadsNum","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_fields","type":"string"}],"name":"PublicDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_downloadsid","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDateDownload","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"date","type":"string"},{"indexed":False,"name":"downloadsnum","type":"string"}],"name":"DownLoads_Document_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"_datatype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"DateLog_Track_Event","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"leaderid","type":"string"},{"indexed":False,"name":"usertype","type":"string"},{"indexed":False,"name":"datetype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_DatePublish","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"fields","type":"string"}],"name":"Public_Document","type":"event"}],
|
||||
"contractAddress":"0x4ff98862186ada02effaba06bdc891cb9b037c01",
|
||||
"funcName":"PublicDocument",
|
||||
"funcParam":["1976946","1671681769,f44e39c1fc14dc05143eeba2065a921bbbc1bba5,2021年1月19日14点28分"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(fileKey),
|
||||
userId + ',' + fileHash + ',' + datetime.datetime.now().strftime('%Y年%m月%d日 %H点%M分')]
|
||||
}
|
||||
print('turnToShowFileToPeople执行')
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
#10更新下载次数
|
||||
def updateFileDownloadNum(userKey, fileKey):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_leaderid","type":"string"},{"name":"_usertype","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDatePublic","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_documentid","type":"string"}],"name":"getDownloadsNum","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"downloadsid","type":"string"},{"name":"_documentid","type":"string"}],"name":"UpdateDownloadsNum","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_fields","type":"string"}],"name":"PublicDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_downloadsid","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDateDownload","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"date","type":"string"},{"indexed":False,"name":"downloadsnum","type":"string"}],"name":"DownLoads_Document_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"_datatype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"DateLog_Track_Event","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"leaderid","type":"string"},{"indexed":False,"name":"usertype","type":"string"},{"indexed":False,"name":"datetype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_DatePublish","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"fields","type":"string"}],"name":"Public_Document","type":"event"}],
|
||||
"contractAddress":"0x4ff98862186ada02effaba06bdc891cb9b037c01",
|
||||
"funcName":"UpdateDownloadsNum",
|
||||
"funcParam":["1976946","1976946"],
|
||||
"useCns":False,
|
||||
"funcParam": [str(userKey), str(fileKey)]
|
||||
}
|
||||
print("bossCheck传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
#11数据追踪
|
||||
def setLogForDatePublic(userKey, objText, infoText):
|
||||
url = 'https://frontjhw.jhw66.cn/WeBASE-Front/trans/handleWithSign'
|
||||
obj = {
|
||||
"groupId" :5,
|
||||
"signUserId": "fee97843cf0c45d683bade8fdebe724f",
|
||||
"contractAbi":[{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentJson","outputs":[{"name":"","type":"int8"},{"name":"","type":"string"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_leaderid","type":"string"},{"name":"_usertype","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDatePublic","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"_documentid","type":"string"}],"name":"getDownloadsNum","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"_applicationid","type":"string"}],"name":"getDocumentArray","outputs":[{"name":"","type":"int8"},{"name":"","type":"string[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"_fields","type":"string[]"},{"name":"index","type":"uint256"},{"name":"values","type":"string"}],"name":"getChangeFieldsString","outputs":[{"name":"","type":"string"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"downloadsid","type":"string"},{"name":"_documentid","type":"string"}],"name":"UpdateDownloadsNum","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_applicationid","type":"string"},{"name":"_fields","type":"string"}],"name":"PublicDocument","outputs":[{"name":"","type":"int8"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"_downloadsid","type":"string"},{"name":"_datatype","type":"string"}],"name":"SetLogForDateDownload","outputs":[{"name":"","type":"bool"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"date","type":"string"},{"indexed":False,"name":"downloadsnum","type":"string"}],"name":"DownLoads_Document_EVENT","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"downloadid","type":"string"},{"indexed":False,"name":"_datatype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"DateLog_Track_Event","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"leaderid","type":"string"},{"indexed":False,"name":"usertype","type":"string"},{"indexed":False,"name":"datetype","type":"string"},{"indexed":False,"name":"date","type":"string"}],"name":"Track_DatePublish","type":"event"},{"anonymous":False,"inputs":[{"indexed":False,"name":"applicationid","type":"string"},{"indexed":False,"name":"fields","type":"string"}],"name":"Public_Document","type":"event"}],
|
||||
"contractAddress":"0x4ff98862186ada02effaba06bdc891cb9b037c01",
|
||||
"funcName":"SetLogForDatePublic",
|
||||
"useCns":False,
|
||||
"funcParam": [userKey, objText, infoText]
|
||||
}
|
||||
print("setLogForDatePublic传的参数:")
|
||||
print(obj['funcParam'])
|
||||
data = json.dumps(obj)
|
||||
headers = {"Content-Type": "application/json"} # 指定提交的是json
|
||||
r = requests.post(url, data=data, headers=headers)
|
||||
obj = json.loads(r.content.decode('utf-8'))
|
||||
print(obj)
|
||||
if obj['message'].lower() == 'success':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
18
django后端代码/utils/appInfo.py
Normal file
18
django后端代码/utils/appInfo.py
Normal file
@ -0,0 +1,18 @@
|
||||
#最新版本服务器
|
||||
miniProgramAppID = "wxa00c3e706ee7d889"
|
||||
miniProgramApp = "d71eabe10b72eb7836aaaa68bc245cf1"
|
||||
|
||||
|
||||
|
||||
# 七牛云key
|
||||
AccessKey = '3QeKd51jEBv62Wvxn8QPSkRBdVCm1nT1XdwAF4Zi'
|
||||
SecretKey = '115kaklqgLgmISwzrHHgOIBDYb_fYH2Kp1Ff7JFN'
|
||||
Bucket = "onestop-gym"
|
||||
policy = { # 七牛云上传策略——https://developer.qiniu.com/kodo/manual/1206/put-policy
|
||||
'callbackUrl': 'get_qiniu_info', # 回调URL 上传成功后,七牛云向业务服务器发送 POST 请求的 URL。
|
||||
'callbackHost': 'blockchain.luckydraw.net.cn',
|
||||
# 回调URL指定的Host 上传成功后,七牛云向业务服务器发送回调通知时的 Host 值。与 callbackUrl 配合使用,仅当设置了 callbackUrl 时才有效。
|
||||
'callbackBodyType': 'application/json',
|
||||
# 回调Body的Content-Type 上传成功后,七牛云向业务服务器发送回调通知 callbackBody 的 Content-Type。默认为 application/x-www-form-urlencoded,也可设置为 application/json。
|
||||
"mimeLimit": 'image/*', # 只允许上传图片类型
|
||||
}
|
||||
195
django后端代码/utils/checkContent.py
Normal file
195
django后端代码/utils/checkContent.py
Normal file
@ -0,0 +1,195 @@
|
||||
import json
|
||||
import re
|
||||
|
||||
import requests
|
||||
|
||||
from collections import defaultdict
|
||||
import re
|
||||
import os.path
|
||||
|
||||
base_path = os.path.dirname(os.path.realpath(__file__)) # 获取当前路径
|
||||
|
||||
|
||||
__all__ = ['NaiveFilter', 'BSFilter', 'DFAFilter']
|
||||
__author__ = 'observer'
|
||||
__date__ = '2012.01.05'
|
||||
|
||||
from idna import unicode
|
||||
|
||||
|
||||
class NaiveFilter():
|
||||
'''Filter Messages from keywords.txt
|
||||
very simple filter implementation
|
||||
>>> f = NaiveFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keywords = set([])
|
||||
|
||||
def parse(self, path):
|
||||
for keyword in open(path):
|
||||
self.keywords.add(keyword.strip().decode('utf-8').lower())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
message = unicode(message).lower()
|
||||
for kw in self.keywords:
|
||||
message = message.replace(kw, repl)
|
||||
return message
|
||||
|
||||
|
||||
class BSFilter:
|
||||
'''Filter Messages from keywords.txt
|
||||
Use Back Sorted Mapping to reduce replacement times
|
||||
>>> f = BSFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keywords = []
|
||||
self.kwsets = set([])
|
||||
self.bsdict = defaultdict(set)
|
||||
self.pat_en = re.compile(r'^[0-9a-zA-Z]+$') # english phrase or not
|
||||
|
||||
def add(self, keyword):
|
||||
if not isinstance(keyword, unicode):
|
||||
keyword = keyword.decode('utf-8')
|
||||
keyword = keyword.lower()
|
||||
if keyword not in self.kwsets:
|
||||
self.keywords.append(keyword)
|
||||
self.kwsets.add(keyword)
|
||||
index = len(self.keywords) - 1
|
||||
for word in keyword.split():
|
||||
if self.pat_en.search(word):
|
||||
self.bsdict[word].add(index)
|
||||
else:
|
||||
for char in word:
|
||||
self.bsdict[char].add(index)
|
||||
|
||||
def parse(self, path):
|
||||
with open(path, "r") as f:
|
||||
for keyword in f:
|
||||
self.add(keyword.strip())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
if not isinstance(message, unicode):
|
||||
message = message.decode('utf-8')
|
||||
message = message.lower()
|
||||
for word in message.split():
|
||||
if self.pat_en.search(word):
|
||||
for index in self.bsdict[word]:
|
||||
message = message.replace(self.keywords[index], repl)
|
||||
else:
|
||||
for char in word:
|
||||
for index in self.bsdict[char]:
|
||||
message = message.replace(self.keywords[index], repl)
|
||||
return message
|
||||
|
||||
|
||||
class DFAFilter():
|
||||
'''Filter Messages from keywords.txt
|
||||
Use DFA to keep algorithm perform constantly
|
||||
>>> f = DFAFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keyword_chains = {}
|
||||
self.delimit = '\x00'
|
||||
|
||||
def add(self, keyword):
|
||||
if not isinstance(keyword, unicode):
|
||||
keyword = keyword.decode('utf-8')
|
||||
keyword = keyword.lower()
|
||||
chars = keyword.strip()
|
||||
if not chars:
|
||||
return
|
||||
level = self.keyword_chains
|
||||
for i in range(len(chars)):
|
||||
if chars[i] in level:
|
||||
level = level[chars[i]]
|
||||
else:
|
||||
if not isinstance(level, dict):
|
||||
break
|
||||
for j in range(i, len(chars)):
|
||||
level[chars[j]] = {}
|
||||
last_level, last_char = level, chars[j]
|
||||
level = level[chars[j]]
|
||||
last_level[last_char] = {self.delimit: 0}
|
||||
break
|
||||
if i == len(chars) - 1:
|
||||
level[self.delimit] = 0
|
||||
|
||||
def parse(self, path):
|
||||
file_path = os.path.join(base_path, path)
|
||||
with open(file_path) as f:
|
||||
for keyword in f:
|
||||
self.add(keyword.strip())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
if not isinstance(message, unicode):
|
||||
message = message.decode('utf-8')
|
||||
message = message.lower()
|
||||
ret = []
|
||||
start = 0
|
||||
while start < len(message):
|
||||
level = self.keyword_chains
|
||||
step_ins = 0
|
||||
for char in message[start:]:
|
||||
if char in level:
|
||||
step_ins += 1
|
||||
if self.delimit not in level[char]:
|
||||
level = level[char]
|
||||
else:
|
||||
ret.append(repl * step_ins)
|
||||
start += step_ins - 1
|
||||
break
|
||||
else:
|
||||
ret.append(message[start])
|
||||
break
|
||||
else:
|
||||
ret.append(message[start])
|
||||
start += 1
|
||||
|
||||
return ''.join(ret)
|
||||
|
||||
|
||||
def checkContent(content):
|
||||
gfw = DFAFilter()
|
||||
gfw.parse("keywords.txt")
|
||||
number = len(content.split("*"))-1
|
||||
text = gfw.filter(content, "*")
|
||||
data = {"num": len(text.split("*"))-1-number, "text": text}
|
||||
return data
|
||||
|
||||
|
||||
|
||||
"""def checkContent(keywords.txt, text):
|
||||
return re.sub("|".join(keywords.txt), "***", text)
|
||||
|
||||
|
||||
url = 'https://api.hcfpz.cn/other/search-ban-word'
|
||||
title = '哈哈哈哈艹'
|
||||
content = '哈哈哈哈fuck大师傅艹 草'
|
||||
data = {'content': title + content}
|
||||
result = requests.post(url, data)
|
||||
print(result)
|
||||
print(result.text)
|
||||
print(result.content)
|
||||
print(result.json())
|
||||
obj = result.json()
|
||||
sensitiveWordArr = obj['data']['result']['minganArr']
|
||||
print(sensitiveWordArr)"""
|
||||
"""sensitiveWordCount = result.result.minganCount
|
||||
forbiddenWordArr = result.result.weijinArr
|
||||
forbiddenWordCount = result.result.weijinCount
|
||||
count = result.result.minganCount + result.result.weijinCount
|
||||
arr = result.result.minganArr.extent(result.result.weijinArr)
|
||||
print(checkContent(arr, title))
|
||||
print(checkContent(arr, content))"""
|
||||
164
django后端代码/utils/filter.py
Normal file
164
django后端代码/utils/filter.py
Normal file
@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding:utf-8 -*-
|
||||
from collections import defaultdict
|
||||
import re
|
||||
|
||||
__all__ = ['NaiveFilter', 'BSFilter', 'DFAFilter']
|
||||
__author__ = 'observer'
|
||||
__date__ = '2012.01.05'
|
||||
|
||||
from idna import unicode
|
||||
|
||||
|
||||
class NaiveFilter():
|
||||
|
||||
'''Filter Messages from keywords.txt
|
||||
|
||||
very simple filter implementation
|
||||
|
||||
>>> f = NaiveFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keywords = set([])
|
||||
|
||||
def parse(self, path):
|
||||
for keyword in open(path):
|
||||
self.keywords.add(keyword.strip().decode('utf-8').lower())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
message = unicode(message).lower()
|
||||
for kw in self.keywords:
|
||||
message = message.replace(kw, repl)
|
||||
return message
|
||||
|
||||
|
||||
class BSFilter:
|
||||
|
||||
'''Filter Messages from keywords.txt
|
||||
|
||||
Use Back Sorted Mapping to reduce replacement times
|
||||
|
||||
>>> f = BSFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keywords = []
|
||||
self.kwsets = set([])
|
||||
self.bsdict = defaultdict(set)
|
||||
self.pat_en = re.compile(r'^[0-9a-zA-Z]+$') # english phrase or not
|
||||
|
||||
def add(self, keyword):
|
||||
if not isinstance(keyword, unicode):
|
||||
keyword = keyword.decode('utf-8')
|
||||
keyword = keyword.lower()
|
||||
if keyword not in self.kwsets:
|
||||
self.keywords.append(keyword)
|
||||
self.kwsets.add(keyword)
|
||||
index = len(self.keywords) - 1
|
||||
for word in keyword.split():
|
||||
if self.pat_en.search(word):
|
||||
self.bsdict[word].add(index)
|
||||
else:
|
||||
for char in word:
|
||||
self.bsdict[char].add(index)
|
||||
|
||||
def parse(self, path):
|
||||
with open(path, "r") as f:
|
||||
for keyword in f:
|
||||
self.add(keyword.strip())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
if not isinstance(message, unicode):
|
||||
message = message.decode('utf-8')
|
||||
message = message.lower()
|
||||
for word in message.split():
|
||||
if self.pat_en.search(word):
|
||||
for index in self.bsdict[word]:
|
||||
message = message.replace(self.keywords[index], repl)
|
||||
else:
|
||||
for char in word:
|
||||
for index in self.bsdict[char]:
|
||||
message = message.replace(self.keywords[index], repl)
|
||||
return message
|
||||
|
||||
|
||||
class DFAFilter():
|
||||
|
||||
'''Filter Messages from keywords.txt
|
||||
|
||||
Use DFA to keep algorithm perform constantly
|
||||
|
||||
>>> f = DFAFilter()
|
||||
>>> f.add("sexy")
|
||||
>>> f.filter("hello sexy baby")
|
||||
hello **** baby
|
||||
'''
|
||||
|
||||
def __init__(self):
|
||||
self.keyword_chains = {}
|
||||
self.delimit = '\x00'
|
||||
|
||||
def add(self, keyword):
|
||||
if not isinstance(keyword, unicode):
|
||||
keyword = keyword.decode('utf-8')
|
||||
keyword = keyword.lower()
|
||||
chars = keyword.strip()
|
||||
if not chars:
|
||||
return
|
||||
level = self.keyword_chains
|
||||
for i in range(len(chars)):
|
||||
if chars[i] in level:
|
||||
level = level[chars[i]]
|
||||
else:
|
||||
if not isinstance(level, dict):
|
||||
break
|
||||
for j in range(i, len(chars)):
|
||||
level[chars[j]] = {}
|
||||
last_level, last_char = level, chars[j]
|
||||
level = level[chars[j]]
|
||||
last_level[last_char] = {self.delimit: 0}
|
||||
break
|
||||
if i == len(chars) - 1:
|
||||
level[self.delimit] = 0
|
||||
|
||||
def parse(self, path):
|
||||
with open(path) as f:
|
||||
for keyword in f:
|
||||
self.add(keyword.strip())
|
||||
|
||||
def filter(self, message, repl="*"):
|
||||
if not isinstance(message, unicode):
|
||||
message = message.decode('utf-8')
|
||||
message = message.lower()
|
||||
ret = []
|
||||
start = 0
|
||||
while start < len(message):
|
||||
level = self.keyword_chains
|
||||
step_ins = 0
|
||||
for char in message[start:]:
|
||||
if char in level:
|
||||
step_ins += 1
|
||||
if self.delimit not in level[char]:
|
||||
level = level[char]
|
||||
else:
|
||||
ret.append(repl * step_ins)
|
||||
start += step_ins - 1
|
||||
break
|
||||
else:
|
||||
ret.append(message[start])
|
||||
break
|
||||
else:
|
||||
ret.append(message[start])
|
||||
start += 1
|
||||
|
||||
return ''.join(ret)
|
||||
|
||||
|
||||
|
||||
28
django后端代码/utils/getUser.py
Normal file
28
django后端代码/utils/getUser.py
Normal file
@ -0,0 +1,28 @@
|
||||
import jwt
|
||||
from jwt import ExpiredSignatureError
|
||||
|
||||
from user.models import User
|
||||
|
||||
|
||||
def get_user(obj):
|
||||
token = obj['token']
|
||||
secret = b'\x3d\xef\x87\xd5\xf8\xbb\xff\xfc\x80\x91\x06\x91\xfd\xfc\xed\x69'
|
||||
EncryptedString = token
|
||||
"""#print(type(EncryptedString))
|
||||
#print("EncryptedString:")
|
||||
#print(EncryptedString)"""
|
||||
try:
|
||||
EncryptedString = jwt.decode(token, secret, issuer='cyb', algorithms=['HS256']) # 解密,校验签名
|
||||
# print(type(EncryptedString))
|
||||
# print(EncryptedString)
|
||||
primary_key = (EncryptedString['data'])['id']
|
||||
# print('primary_key')
|
||||
# print(primary_key)
|
||||
# print(type(primary_key))
|
||||
# print(primary_key)
|
||||
user = User.objects.get(id=primary_key) # 通过openid获取user
|
||||
# print(type(user))
|
||||
# print(user)
|
||||
return user
|
||||
except ExpiredSignatureError:
|
||||
return False
|
||||
13520
django后端代码/utils/keywords.txt
Normal file
13520
django后端代码/utils/keywords.txt
Normal file
File diff suppressed because it is too large
Load Diff
76
django后端代码/venv/bin/activate
Normal file
76
django后端代码/venv/bin/activate
Normal file
@ -0,0 +1,76 @@
|
||||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
deactivate () {
|
||||
# reset old environment variables
|
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
||||
export PATH
|
||||
unset _OLD_VIRTUAL_PATH
|
||||
fi
|
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
||||
export PYTHONHOME
|
||||
unset _OLD_VIRTUAL_PYTHONHOME
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
||||
export PS1
|
||||
unset _OLD_VIRTUAL_PS1
|
||||
fi
|
||||
|
||||
unset VIRTUAL_ENV
|
||||
if [ ! "$1" = "nondestructive" ] ; then
|
||||
# Self destruct!
|
||||
unset -f deactivate
|
||||
fi
|
||||
}
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
VIRTUAL_ENV="/Users/apple/PycharmProjects/blockchainApp/venv"
|
||||
export VIRTUAL_ENV
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||
export PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
||||
unset PYTHONHOME
|
||||
fi
|
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
||||
if [ "x(venv) " != x ] ; then
|
||||
PS1="(venv) ${PS1:-}"
|
||||
else
|
||||
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
PS1="[`basename \`dirname \"$VIRTUAL_ENV\"\``] $PS1"
|
||||
else
|
||||
PS1="(`basename \"$VIRTUAL_ENV\"`)$PS1"
|
||||
fi
|
||||
fi
|
||||
export PS1
|
||||
fi
|
||||
|
||||
# This should detect bash and zsh, which have a hash command that must
|
||||
# be called to get it to forget past commands. Without forgetting
|
||||
# past commands the $PATH changes we made may not be respected
|
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
|
||||
hash -r
|
||||
fi
|
||||
37
django后端代码/venv/bin/activate.csh
Normal file
37
django后端代码/venv/bin/activate.csh
Normal file
@ -0,0 +1,37 @@
|
||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
||||
# You cannot run it directly.
|
||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate'
|
||||
|
||||
# Unset irrelevant variables.
|
||||
deactivate nondestructive
|
||||
|
||||
setenv VIRTUAL_ENV "/Users/apple/PycharmProjects/blockchainApp/venv"
|
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH"
|
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH"
|
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
||||
if ("venv" != "") then
|
||||
set env_name = "venv"
|
||||
else
|
||||
if (`basename "VIRTUAL_ENV"` == "__") then
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
set env_name = `basename \`dirname "$VIRTUAL_ENV"\``
|
||||
else
|
||||
set env_name = `basename "$VIRTUAL_ENV"`
|
||||
endif
|
||||
endif
|
||||
set prompt = "[$env_name] $prompt"
|
||||
unset env_name
|
||||
endif
|
||||
|
||||
alias pydoc python -m pydoc
|
||||
|
||||
rehash
|
||||
75
django后端代码/venv/bin/activate.fish
Normal file
75
django后端代码/venv/bin/activate.fish
Normal file
@ -0,0 +1,75 @@
|
||||
# This file must be used with ". bin/activate.fish" *from fish* (http://fishshell.org)
|
||||
# you cannot run it directly
|
||||
|
||||
function deactivate -d "Exit virtualenv and return to normal shell environment"
|
||||
# reset old environment variables
|
||||
if test -n "$_OLD_VIRTUAL_PATH"
|
||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
||||
set -e _OLD_VIRTUAL_PATH
|
||||
end
|
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
||||
end
|
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
||||
functions -e fish_prompt
|
||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
||||
functions -c _old_fish_prompt fish_prompt
|
||||
functions -e _old_fish_prompt
|
||||
end
|
||||
|
||||
set -e VIRTUAL_ENV
|
||||
if test "$argv[1]" != "nondestructive"
|
||||
# Self destruct!
|
||||
functions -e deactivate
|
||||
end
|
||||
end
|
||||
|
||||
# unset irrelevant variables
|
||||
deactivate nondestructive
|
||||
|
||||
set -gx VIRTUAL_ENV "/Users/apple/PycharmProjects/blockchainApp/venv"
|
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH
|
||||
|
||||
# unset PYTHONHOME if set
|
||||
if set -q PYTHONHOME
|
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
||||
set -e PYTHONHOME
|
||||
end
|
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
||||
# fish uses a function instead of an env var to generate the prompt.
|
||||
|
||||
# save the current fish_prompt function as the function _old_fish_prompt
|
||||
functions -c fish_prompt _old_fish_prompt
|
||||
|
||||
# with the original prompt function renamed, we can override with our own.
|
||||
function fish_prompt
|
||||
# Save the return status of the last command
|
||||
set -l old_status $status
|
||||
|
||||
# Prompt override?
|
||||
if test -n "(venv) "
|
||||
printf "%s%s" "(venv) " (set_color normal)
|
||||
else
|
||||
# ...Otherwise, prepend env
|
||||
set -l _checkbase (basename "$VIRTUAL_ENV")
|
||||
if test $_checkbase = "__"
|
||||
# special case for Aspen magic directories
|
||||
# see http://www.zetadev.com/software/aspen/
|
||||
printf "%s[%s]%s " (set_color -b blue white) (basename (dirname "$VIRTUAL_ENV")) (set_color normal)
|
||||
else
|
||||
printf "%s(%s)%s" (set_color -b blue white) (basename "$VIRTUAL_ENV") (set_color normal)
|
||||
end
|
||||
end
|
||||
|
||||
# Restore the return status of the previous command.
|
||||
echo "exit $old_status" | .
|
||||
_old_fish_prompt
|
||||
end
|
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
||||
end
|
||||
8
django后端代码/venv/bin/chardetect
Normal file
8
django后端代码/venv/bin/chardetect
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from chardet.cli.chardetect import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/django-admin
Normal file
8
django后端代码/venv/bin/django-admin
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from django.core.management import execute_from_command_line
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(execute_from_command_line())
|
||||
21
django后端代码/venv/bin/django-admin.py
Normal file
21
django后端代码/venv/bin/django-admin.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# When the django-admin.py deprecation ends, remove this script.
|
||||
import warnings
|
||||
|
||||
from django.core import management
|
||||
|
||||
try:
|
||||
from django.utils.deprecation import RemovedInDjango40Warning
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
'django-admin.py was deprecated in Django 3.1 and removed in Django '
|
||||
'4.0. Please manually remove this script from your virtual environment '
|
||||
'and use django-admin instead.'
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
warnings.warn(
|
||||
'django-admin.py is deprecated in favor of django-admin.',
|
||||
RemovedInDjango40Warning,
|
||||
)
|
||||
management.execute_from_command_line()
|
||||
8
django后端代码/venv/bin/easy_install
Normal file
8
django后端代码/venv/bin/easy_install
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from setuptools.command.easy_install import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/easy_install-3.7
Normal file
8
django后端代码/venv/bin/easy_install-3.7
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from setuptools.command.easy_install import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/pip
Normal file
8
django后端代码/venv/bin/pip
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/pip3
Normal file
8
django后端代码/venv/bin/pip3
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/pip3.7
Normal file
8
django后端代码/venv/bin/pip3.7
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from pip._internal.cli.main import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
8
django后端代码/venv/bin/pyjwt
Normal file
8
django后端代码/venv/bin/pyjwt
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from jwt.__main__ import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
33
django后端代码/venv/bin/qiniupy
Normal file
33
django后端代码/venv/bin/qiniupy
Normal file
@ -0,0 +1,33 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# EASY-INSTALL-ENTRY-SCRIPT: 'qiniu==7.3.0','console_scripts','qiniupy'
|
||||
import re
|
||||
import sys
|
||||
|
||||
# for compatibility with easy_install; see #2198
|
||||
__requires__ = 'qiniu==7.3.0'
|
||||
|
||||
try:
|
||||
from importlib.metadata import distribution
|
||||
except ImportError:
|
||||
try:
|
||||
from importlib_metadata import distribution
|
||||
except ImportError:
|
||||
from pkg_resources import load_entry_point
|
||||
|
||||
|
||||
def importlib_load_entry_point(spec, group, name):
|
||||
dist_name, _, _ = spec.partition('==')
|
||||
matches = (
|
||||
entry_point
|
||||
for entry_point in distribution(dist_name).entry_points
|
||||
if entry_point.group == group and entry_point.name == name
|
||||
)
|
||||
return next(matches).load()
|
||||
|
||||
|
||||
globals().setdefault('load_entry_point', importlib_load_entry_point)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(load_entry_point('qiniu==7.3.0', 'console_scripts', 'qiniupy')())
|
||||
8
django后端代码/venv/bin/sqlformat
Normal file
8
django后端代码/venv/bin/sqlformat
Normal file
@ -0,0 +1,8 @@
|
||||
#!/Users/apple/PycharmProjects/blockchainApp/venv/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import sys
|
||||
from sqlparse.__main__ import main
|
||||
if __name__ == '__main__':
|
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
||||
sys.exit(main())
|
||||
@ -0,0 +1,982 @@
|
||||
Django was originally created in late 2003 at World Online, the Web division
|
||||
of the Lawrence Journal-World newspaper in Lawrence, Kansas.
|
||||
|
||||
Here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS --
|
||||
people who have submitted patches, reported bugs, added translations, helped
|
||||
answer newbie questions, and generally made Django that much better:
|
||||
|
||||
Aaron Cannon <cannona@fireantproductions.com>
|
||||
Aaron Swartz <http://www.aaronsw.com/>
|
||||
Aaron T. Myers <atmyers@gmail.com>
|
||||
Abeer Upadhyay <ab.esquarer@gmail.com>
|
||||
Abhijeet Viswa <abhijeetviswa@gmail.com>
|
||||
Abhinav Patil <https://github.com/ubadub/>
|
||||
Abhishek Gautam <abhishekg1128@yahoo.com>
|
||||
Adam Allred <adam.w.allred@gmail.com>
|
||||
Adam Bogdał <adam@bogdal.pl>
|
||||
Adam Donaghy
|
||||
Adam Johnson <https://github.com/adamchainz>
|
||||
Adam Malinowski <https://adammalinowski.co.uk/>
|
||||
Adam Vandenberg
|
||||
Adiyat Mubarak <adiyatmubarak@gmail.com>
|
||||
Adnan Umer <u.adnan@outlook.com>
|
||||
Adrian Holovaty <adrian@holovaty.com>
|
||||
Adrien Lemaire <lemaire.adrien@gmail.com>
|
||||
Afonso Fernández Nogueira <fonzzo.django@gmail.com>
|
||||
AgarFu <heaven@croasanaso.sytes.net>
|
||||
Ahmad Alhashemi <trans@ahmadh.com>
|
||||
Ahmad Al-Ibrahim
|
||||
Ahmed Eltawela <https://github.com/ahmedabt>
|
||||
ajs <adi@sieker.info>
|
||||
Akash Agrawal <akashrocksha@gmail.com>
|
||||
Akis Kesoglou <akiskesoglou@gmail.com>
|
||||
Aksel Ethem <aksel.ethem@gmail.com>
|
||||
Akshesh Doshi <aksheshdoshi+django@gmail.com>
|
||||
alang@bright-green.com
|
||||
Alasdair Nicol <https://al.sdair.co.uk/>
|
||||
Albert Wang <https://github.com/albertyw/>
|
||||
Alcides Fonseca
|
||||
Aldian Fazrihady <mobile@aldian.net>
|
||||
Aleksandra Sendecka <asendecka@hauru.eu>
|
||||
Aleksi Häkli <aleksi.hakli@iki.fi>
|
||||
Alexander Dutton <dev@alexdutton.co.uk>
|
||||
Alexander Myodov <alex@myodov.com>
|
||||
Alexandr Tatarinov <tatarinov1997@gmail.com>
|
||||
Alex Aktsipetrov <alex.akts@gmail.com>
|
||||
Alex Becker <https://alexcbecker.net/>
|
||||
Alex Couper <http://alexcouper.com/>
|
||||
Alex Dedul
|
||||
Alex Gaynor <alex.gaynor@gmail.com>
|
||||
Alex Hill <alex@hill.net.au>
|
||||
Alex Ogier <alex.ogier@gmail.com>
|
||||
Alex Robbins <alexander.j.robbins@gmail.com>
|
||||
Alexey Boriskin <alex@boriskin.me>
|
||||
Alexey Tsivunin <most-208@yandex.ru>
|
||||
Aljosa Mohorovic <aljosa.mohorovic@gmail.com>
|
||||
Amit Chakradeo <https://amit.chakradeo.net/>
|
||||
Amit Ramon <amit.ramon@gmail.com>
|
||||
Amit Upadhyay <http://www.amitu.com/blog/>
|
||||
A. Murat Eren <meren@pardus.org.tr>
|
||||
Ana Belen Sarabia <belensarabia@gmail.com>
|
||||
Ana Krivokapic <https://github.com/infraredgirl>
|
||||
Andi Albrecht <albrecht.andi@gmail.com>
|
||||
André Ericson <de.ericson@gmail.com>
|
||||
Andrei Kulakov <andrei.avk@gmail.com>
|
||||
Andreas
|
||||
Andreas Mock <andreas.mock@web.de>
|
||||
Andreas Pelme <andreas@pelme.se>
|
||||
Andrés Torres Marroquín <andres.torres.marroquin@gmail.com>
|
||||
Andrew Brehaut <https://brehaut.net/blog>
|
||||
Andrew Clark <amclark7@gmail.com>
|
||||
Andrew Durdin <adurdin@gmail.com>
|
||||
Andrew Godwin <andrew@aeracode.org>
|
||||
Andrew Pinkham <http://AndrewsForge.com>
|
||||
Andrews Medina <andrewsmedina@gmail.com>
|
||||
Andriy Sokolovskiy <me@asokolovskiy.com>
|
||||
Andy Dustman <farcepest@gmail.com>
|
||||
Andy Gayton <andy-django@thecablelounge.com>
|
||||
andy@jadedplanet.net
|
||||
Anssi Kääriäinen <akaariai@gmail.com>
|
||||
ant9000@netwise.it
|
||||
Anthony Briggs <anthony.briggs@gmail.com>
|
||||
Anton Samarchyan <desecho@gmail.com>
|
||||
Antoni Aloy
|
||||
Antonio Cavedoni <http://cavedoni.com/>
|
||||
Antonis Christofides <anthony@itia.ntua.gr>
|
||||
Antti Haapala <antti@industrialwebandmagic.com>
|
||||
Antti Kaihola <http://djangopeople.net/akaihola/>
|
||||
Anubhav Joshi <anubhav9042@gmail.com>
|
||||
Aram Dulyan
|
||||
arien <regexbot@gmail.com>
|
||||
Armin Ronacher
|
||||
Aron Podrigal <aronp@guaranteedplus.com>
|
||||
Artem Gnilov <boobsd@gmail.com>
|
||||
Arthur <avandorp@gmail.com>
|
||||
Arthur Koziel <http://arthurkoziel.com>
|
||||
Arthur Rio <arthur.rio44@gmail.com>
|
||||
Arvis Bickovskis <viestards.lists@gmail.com>
|
||||
Aryeh Leib Taurog <http://www.aryehleib.com/>
|
||||
A S Alam <aalam@users.sf.net>
|
||||
Asif Saif Uddin <auvipy@gmail.com>
|
||||
atlithorn <atlithorn@gmail.com>
|
||||
Audrey Roy <http://audreymroy.com/>
|
||||
av0000@mail.ru
|
||||
Axel Haustant <noirbizarre@gmail.com>
|
||||
Aymeric Augustin <aymeric.augustin@m4x.org>
|
||||
Bahadır Kandemir <bahadir@pardus.org.tr>
|
||||
Baishampayan Ghose
|
||||
Baptiste Mispelon <bmispelon@gmail.com>
|
||||
Barry Pederson <bp@barryp.org>
|
||||
Bartolome Sanchez Salado <i42sasab@uco.es>
|
||||
Bartosz Grabski <bartosz.grabski@gmail.com>
|
||||
Bashar Al-Abdulhadi
|
||||
Bastian Kleineidam <calvin@debian.org>
|
||||
Batiste Bieler <batiste.bieler@gmail.com>
|
||||
Batman
|
||||
Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
|
||||
Baurzhan Ismagulov <ibr@radix50.net>
|
||||
Ben Dean Kawamura <ben.dean.kawamura@gmail.com>
|
||||
Ben Firshman <ben@firshman.co.uk>
|
||||
Ben Godfrey <http://aftnn.org>
|
||||
Benjamin Wohlwend <piquadrat@gmail.com>
|
||||
Ben Khoo <khoobks@westnet.com.au>
|
||||
Ben Slavin <benjamin.slavin@gmail.com>
|
||||
Ben Sturmfels <ben@sturm.com.au>
|
||||
Berker Peksag <berker.peksag@gmail.com>
|
||||
Bernd Schlapsi
|
||||
Bernhard Essl <me@bernhardessl.com>
|
||||
berto
|
||||
Bill Fenner <fenner@gmail.com>
|
||||
Bjørn Stabell <bjorn@exoweb.net>
|
||||
Bo Marchman <bo.marchman@gmail.com>
|
||||
Bogdan Mateescu
|
||||
Bojan Mihelac <bmihelac@mihelac.org>
|
||||
Bouke Haarsma <bouke@haarsma.eu>
|
||||
Božidar Benko <bbenko@gmail.com>
|
||||
Brad Melin <melinbrad@gmail.com>
|
||||
Brandon Chinn <https://brandonchinn178.github.io/>
|
||||
Brant Harris
|
||||
Brendan Hayward <brendanhayward85@gmail.com>
|
||||
Brendan Quinn <brendan@cluefulmedia.com>
|
||||
Brenton Simpson <http://theillustratedlife.com>
|
||||
Brett Cannon <brett@python.org>
|
||||
Brett Hoerner <bretthoerner@bretthoerner.com>
|
||||
Brian Beck <http://blog.brianbeck.com/>
|
||||
Brian Fabian Crain <http://www.bfc.do/>
|
||||
Brian Harring <ferringb@gmail.com>
|
||||
Brian Helba <brian.helba@kitware.com>
|
||||
Brian Ray <http://brianray.chipy.org/>
|
||||
Brian Rosner <brosner@gmail.com>
|
||||
Bruce Kroeze <https://coderseye.com/>
|
||||
Bruno Alla <alla.brunoo@gmail.com>
|
||||
Bruno Renié <buburno@gmail.com>
|
||||
brut.alll@gmail.com
|
||||
Bryan Chow <bryan at verdjn dot com>
|
||||
Bryan Veloso <bryan@revyver.com>
|
||||
bthomas
|
||||
btoll@bestweb.net
|
||||
C8E
|
||||
Caio Ariede <caio.ariede@gmail.com>
|
||||
Calvin Spealman <ironfroggy@gmail.com>
|
||||
Cameron Curry
|
||||
Cameron Knight (ckknight)
|
||||
Can Burak Çilingir <canburak@cs.bilgi.edu.tr>
|
||||
Can Sarıgöl <ertugrulsarigol@gmail.com>
|
||||
Carl Meyer <carl@oddbird.net>
|
||||
Carles Pina i Estany <carles@pina.cat>
|
||||
Carlos Eduardo de Paula <carlosedp@gmail.com>
|
||||
Carlos Matías de la Torre <cmdelatorre@gmail.com>
|
||||
Carlton Gibson <carlton.gibson@noumenal.es>
|
||||
cedric@terramater.net
|
||||
Chad Whitman <chad.whitman@icloud.com>
|
||||
ChaosKCW
|
||||
Charlie Leifer <coleifer@gmail.com>
|
||||
charly.wilhelm@gmail.com
|
||||
Chason Chaffin <chason@gmail.com>
|
||||
Cheng Zhang
|
||||
Chris Adams
|
||||
Chris Beaven <smileychris@gmail.com>
|
||||
Chris Bennett <chrisrbennett@yahoo.com>
|
||||
Chris Cahoon <chris.cahoon@gmail.com>
|
||||
Chris Chamberlin <dja@cdc.msbx.net>
|
||||
Chris Jerdonek
|
||||
Chris Jones <chris@brack3t.com>
|
||||
Chris Lamb <chris@chris-lamb.co.uk>
|
||||
Chris Streeter <chris@chrisstreeter.com>
|
||||
Christian Barcenas <christian@cbarcenas.com>
|
||||
Christian Metts
|
||||
Christian Oudard <christian.oudard@gmail.com>
|
||||
Christian Tanzer <tanzer@swing.co.at>
|
||||
Christoffer Sjöbergsson
|
||||
Christophe Pettus <xof@thebuild.com>
|
||||
Christopher Adams <http://christopheradams.info>
|
||||
Christopher Babiak <chrisbabiak@gmail.com>
|
||||
Christopher Lenz <https://www.cmlenz.net/>
|
||||
Christoph Mędrela <chris.medrela@gmail.com>
|
||||
Chris Wagner <cw264701@ohio.edu>
|
||||
Chris Wesseling <Chris.Wesseling@cwi.nl>
|
||||
Chris Wilson <chris+github@qwirx.com>
|
||||
Claude Paroz <claude@2xlibre.net>
|
||||
Clint Ecker
|
||||
colin@owlfish.com
|
||||
Colin Wood <cwood06@gmail.com>
|
||||
Collin Anderson <cmawebsite@gmail.com>
|
||||
Collin Grady <collin@collingrady.com>
|
||||
Colton Hicks <coltonbhicks@gmail.com>
|
||||
Craig Blaszczyk <masterjakul@gmail.com>
|
||||
crankycoder@gmail.com
|
||||
Curtis Maloney (FunkyBob) <curtis@tinbrain.net>
|
||||
dackze+django@gmail.com
|
||||
Dagur Páll Ammendrup <dagurp@gmail.com>
|
||||
Dane Springmeyer
|
||||
Dan Fairs <dan@fezconsulting.com>
|
||||
Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com>
|
||||
Daniel Duan <DaNmarner@gmail.com>
|
||||
Daniele Procida <daniele@vurt.org>
|
||||
Daniel Greenfeld
|
||||
dAniel hAhler
|
||||
Daniel Jilg <daniel@breakthesystem.org>
|
||||
Daniel Lindsley <daniel@toastdriven.com>
|
||||
Daniel Poelzleithner <https://poelzi.org/>
|
||||
Daniel Pyrathon <pirosb3@gmail.com>
|
||||
Daniel Roseman <http://roseman.org.uk/>
|
||||
Daniel Tao <https://philosopherdeveloper.com/>
|
||||
Daniel Wiesmann <daniel.wiesmann@gmail.com>
|
||||
Danilo Bargen
|
||||
Dan Johnson <danj.py@gmail.com>
|
||||
Dan Palmer <dan@danpalmer.me>
|
||||
Dan Poirier <poirier@pobox.com>
|
||||
Dan Stephenson <http://dan.io/>
|
||||
Dan Watson <http://danwatson.net/>
|
||||
dave@thebarproject.com
|
||||
David Ascher <https://ascher.ca/>
|
||||
David Avsajanishvili <avsd05@gmail.com>
|
||||
David Blewett <david@dawninglight.net>
|
||||
David Brenneman <http://davidbrenneman.com>
|
||||
David Cramer <dcramer@gmail.com>
|
||||
David Danier <david.danier@team23.de>
|
||||
David Eklund
|
||||
David Foster <david@dafoster.net>
|
||||
David Gouldin <dgouldin@gmail.com>
|
||||
david@kazserve.org
|
||||
David Krauth
|
||||
David Larlet <https://larlet.fr/david/>
|
||||
David Reynolds <david@reynoldsfamily.org.uk>
|
||||
David Sanders <dsanders11@ucsbalum.com>
|
||||
David Schein
|
||||
David Tulig <david.tulig@gmail.com>
|
||||
David Wobrock <david.wobrock@gmail.com>
|
||||
Davide Ceretti <dav.ceretti@gmail.com>
|
||||
Deep L. Sukhwani <deepsukhwani@gmail.com>
|
||||
Deepak Thukral <deep.thukral@gmail.com>
|
||||
Denis Kuzmichyov <kuzmichyov@gmail.com>
|
||||
Dennis Schwertel <dennisschwertel@gmail.com>
|
||||
Derek Willis <http://blog.thescoop.org/>
|
||||
Deric Crago <deric.crago@gmail.com>
|
||||
deric@monowerks.com
|
||||
Deryck Hodge <http://www.devurandom.org/>
|
||||
Dimitris Glezos <dimitris@glezos.com>
|
||||
Dirk Datzert <dummy@habmalnefrage.de>
|
||||
Dirk Eschler <dirk.eschler@gmx.net>
|
||||
Dmitri Fedortchenko <zeraien@gmail.com>
|
||||
Dmitry Jemerov <intelliyole@gmail.com>
|
||||
dne@mayonnaise.net
|
||||
Dolan Antenucci <antenucci.d@gmail.com>
|
||||
Donald Harvey <donald@donaldharvey.co.uk>
|
||||
Donald Stufft <donald@stufft.io>
|
||||
Don Spaulding <donspauldingii@gmail.com>
|
||||
Doug Beck <doug@douglasbeck.com>
|
||||
Doug Napoleone <doug@dougma.com>
|
||||
dready <wil@mojipage.com>
|
||||
dusk@woofle.net
|
||||
Dustyn Gibson <miigotu@gmail.com>
|
||||
Ed Morley <https://github.com/edmorley>
|
||||
eibaan@gmail.com
|
||||
elky <http://elky.me/>
|
||||
Emmanuelle Delescolle <https://github.com/nanuxbe>
|
||||
Emil Stenström <em@kth.se>
|
||||
enlight
|
||||
Enrico <rico.bl@gmail.com>
|
||||
Eric Boersma <eric.boersma@gmail.com>
|
||||
Eric Brandwein <brandweineric@gmail.com>
|
||||
Eric Floehr <eric@intellovations.com>
|
||||
Eric Florenzano <floguy@gmail.com>
|
||||
Eric Holscher <http://ericholscher.com>
|
||||
Eric Moritz <http://eric.themoritzfamily.com/>
|
||||
Eric Palakovich Carr <carreric@gmail.com>
|
||||
Erik Karulf <erik@karulf.com>
|
||||
Erik Romijn <django@solidlinks.nl>
|
||||
eriks@win.tue.nl
|
||||
Erwin Junge <erwin@junge.nl>
|
||||
Esdras Beleza <linux@esdrasbeleza.com>
|
||||
Espen Grindhaug <http://grindhaug.org/>
|
||||
Eugene Lazutkin <http://lazutkin.com/blog/>
|
||||
Evan Grim <https://github.com/egrim>
|
||||
Fabrice Aneche <akh@nobugware.com>
|
||||
Farhaan Bukhsh <farhaan.bukhsh@gmail.com>
|
||||
favo@exoweb.net
|
||||
fdr <drfarina@gmail.com>
|
||||
Federico Capoano <nemesis@ninux.org>
|
||||
Felipe Lee <felipe.lee.garcia@gmail.com>
|
||||
Filip Noetzel <http://filip.noetzel.co.uk/>
|
||||
Filip Wasilewski <filip.wasilewski@gmail.com>
|
||||
Finn Gruwier Larsen <finn@gruwier.dk>
|
||||
Flávio Juvenal da Silva Junior <flavio@vinta.com.br>
|
||||
flavio.curella@gmail.com
|
||||
Florian Apolloner <florian@apolloner.eu>
|
||||
Florian Moussous <florian.moussous@gmail.com>
|
||||
Fran Hrženjak <fran.hrzenjak@gmail.com>
|
||||
Francisco Albarran Cristobal <pahko.xd@gmail.com>
|
||||
Francisco Couzo <franciscouzo@gmail.com>
|
||||
François Freitag <mail@franek.fr>
|
||||
Frank Tegtmeyer <fte@fte.to>
|
||||
Frank Wierzbicki
|
||||
Frank Wiles <frank@revsys.com>
|
||||
František Malina <fmalina@gmail.com>
|
||||
Fraser Nevett <mail@nevett.org>
|
||||
Gabriel Grant <g@briel.ca>
|
||||
Gabriel Hurley <gabriel@strikeawe.com>
|
||||
gandalf@owca.info
|
||||
Garry Lawrence
|
||||
Garry Polley <garrympolley@gmail.com>
|
||||
Garth Kidd <http://www.deadlybloodyserious.com/>
|
||||
Gary Wilson <gary.wilson@gmail.com>
|
||||
Gasper Koren
|
||||
Gasper Zejn <zejn@kiberpipa.org>
|
||||
Gavin Wahl <gavinwahl@gmail.com>
|
||||
Ge Hanbin <xiaomiba0904@gmail.com>
|
||||
geber@datacollect.com
|
||||
Geert Vanderkelen
|
||||
George Karpenkov <george@metaworld.ru>
|
||||
George Song <george@damacy.net>
|
||||
George Vilches <gav@thataddress.com>
|
||||
Georg "Hugo" Bauer <gb@hugo.westfalen.de>
|
||||
Georgi Stanojevski <glisha@gmail.com>
|
||||
Gerardo Orozco <gerardo.orozco.mosqueda@gmail.com>
|
||||
Gil Gonçalves <lursty@gmail.com>
|
||||
Girish Kumar <girishkumarkh@gmail.com>
|
||||
Gisle Aas <gisle@aas.no>
|
||||
Glenn Maynard <glenn@zewt.org>
|
||||
glin@seznam.cz
|
||||
GomoX <gomo@datafull.com>
|
||||
Gonzalo Saavedra <gonzalosaavedra@gmail.com>
|
||||
Gopal Narayanan <gopastro@gmail.com>
|
||||
Graham Carlyle <graham.carlyle@maplecroft.net>
|
||||
Grant Jenks <contact@grantjenks.com>
|
||||
Greg Chapple <gregchapple1@gmail.com>
|
||||
Gregor Allensworth <greg.allensworth@gmail.com>
|
||||
Gregor Müllegger <gregor@muellegger.de>
|
||||
Grigory Fateyev <greg@dial.com.ru>
|
||||
Grzegorz Ślusarek <grzegorz.slusarek@gmail.com>
|
||||
Guilherme Mesquita Gondim <semente@taurinus.org>
|
||||
Guillaume Pannatier <guillaume.pannatier@gmail.com>
|
||||
Gustavo Picon
|
||||
hambaloney
|
||||
Hang Park <hangpark@kaist.ac.kr>
|
||||
Hannes Ljungberg <hannes.ljungberg@gmail.com>
|
||||
Hannes Struß <x@hannesstruss.de>
|
||||
Hasan Ramezani <hasan.r67@gmail.com>
|
||||
Hawkeye
|
||||
Helen Sherwood-Taylor <helen@rrdlabs.co.uk>
|
||||
Henrique Romano <onaiort@gmail.com>
|
||||
Henry Dang <henrydangprg@gmail.com>
|
||||
Hidde Bultsma
|
||||
Himanshu Chauhan <hchauhan1404@outlook.com>
|
||||
hipertracker@gmail.com
|
||||
Hiroki Kiyohara <hirokiky@gmail.com>
|
||||
Honza Král <honza.kral@gmail.com>
|
||||
Horst Gutmann <zerok@zerokspot.com>
|
||||
Hugo Osvaldo Barrera <hugo@barrera.io>
|
||||
HyukJin Jang <wkdgurwls00@naver.com>
|
||||
Hyun Mi Ae
|
||||
Iacopo Spalletti <i.spalletti@nephila.it>
|
||||
Ian A Wilson <http://ianawilson.com>
|
||||
Ian Clelland <clelland@gmail.com>
|
||||
Ian G. Kelly <ian.g.kelly@gmail.com>
|
||||
Ian Holsman <http://feh.holsman.net/>
|
||||
Ian Lee <IanLee1521@gmail.com>
|
||||
Ibon <ibonso@gmail.com>
|
||||
Idan Gazit <idan@gazit.me>
|
||||
Idan Melamed
|
||||
Ifedapo Olarewaju <ifedapoolarewaju@gmail.com>
|
||||
Igor Kolar <ike@email.si>
|
||||
Illia Volochii <illia.volochii@gmail.com>
|
||||
Ilya Semenov <semenov@inetss.com>
|
||||
Ingo Klöcker <djangoproject@ingo-kloecker.de>
|
||||
I.S. van Oostveen <v.oostveen@idca.nl>
|
||||
ivan.chelubeev@gmail.com
|
||||
Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/>
|
||||
Jaap Roes <jaap.roes@gmail.com>
|
||||
Jack Moffitt <https://metajack.im/>
|
||||
Jacob Burch <jacobburch@gmail.com>
|
||||
Jacob Green
|
||||
Jacob Kaplan-Moss <jacob@jacobian.org>
|
||||
Jakub Paczkowski <jakub@paczkowski.eu>
|
||||
Jakub Wilk <jwilk@jwilk.net>
|
||||
Jakub Wiśniowski <restless.being@gmail.com>
|
||||
james_027@yahoo.com
|
||||
James Aylett
|
||||
James Bennett <james@b-list.org>
|
||||
James Murty
|
||||
James Tauber <jtauber@jtauber.com>
|
||||
James Timmins <jameshtimmins@gmail.com>
|
||||
James Turk <dev@jamesturk.net>
|
||||
James Wheare <django@sparemint.com>
|
||||
Jannis Leidel <jannis@leidel.info>
|
||||
Janos Guljas
|
||||
Jan Pazdziora
|
||||
Jan Rademaker
|
||||
Jarek Głowacki <jarekwg@gmail.com>
|
||||
Jarek Zgoda <jarek.zgoda@gmail.com>
|
||||
Jason Davies (Esaj) <https://www.jasondavies.com/>
|
||||
Jason Huggins <http://www.jrandolph.com/blog/>
|
||||
Jason McBrayer <http://www.carcosa.net/jason/>
|
||||
jason.sidabras@gmail.com
|
||||
Jason Yan <tailofthesun@gmail.com>
|
||||
Javier Mansilla <javimansilla@gmail.com>
|
||||
Jay Parlar <parlar@gmail.com>
|
||||
Jay Welborn <jesse.welborn@gmail.com>
|
||||
Jay Wineinger <jay.wineinger@gmail.com>
|
||||
J. Clifford Dyer <jcd@sdf.lonestar.org>
|
||||
jcrasta@gmail.com
|
||||
jdetaeye
|
||||
Jeff Anderson <jefferya@programmerq.net>
|
||||
Jeff Balogh <jbalogh@mozilla.com>
|
||||
Jeff Hui <jeffkhui@gmail.com>
|
||||
Jeffrey Gelens <jeffrey@gelens.org>
|
||||
Jeff Triplett <jeff.triplett@gmail.com>
|
||||
Jeffrey Yancey <jeffrey.yancey@gmail.com>
|
||||
Jens Diemer <django@htfx.de>
|
||||
Jens Page
|
||||
Jensen Cochran <jensen.cochran@gmail.com>
|
||||
Jeong-Min Lee <falsetru@gmail.com>
|
||||
Jérémie Blaser <blaserje@gmail.com>
|
||||
Jeremy Bowman <https://github.com/jmbowman>
|
||||
Jeremy Carbaugh <jcarbaugh@gmail.com>
|
||||
Jeremy Dunck <jdunck@gmail.com>
|
||||
Jeremy Lainé <jeremy.laine@m4x.org>
|
||||
Jesse Young <adunar@gmail.com>
|
||||
Jezeniel Zapanta <jezeniel.zapanta@gmail.com>
|
||||
jhenry <jhenry@theonion.com>
|
||||
Jim Dalton <jim.dalton@gmail.com>
|
||||
Jimmy Song <jaejoon@gmail.com>
|
||||
Jiri Barton
|
||||
Joachim Jablon <ewjoachim@gmail.com>
|
||||
Joao Oliveira <joaoxsouls@gmail.com>
|
||||
Joao Pedro Silva <j.pedro004@gmail.com>
|
||||
Joe Heck <http://www.rhonabwy.com/wp/>
|
||||
Joel Bohman <mail@jbohman.com>
|
||||
Joel Heenan <joelh-django@planetjoel.com>
|
||||
Joel Watts <joel@joelwatts.com>
|
||||
Joe Topjian <http://joe.terrarum.net/geek/code/python/django/>
|
||||
Johan C. Stöver <johan@nilling.nl>
|
||||
Johann Queuniet <johann.queuniet@adh.naellia.eu>
|
||||
john@calixto.net
|
||||
John D'Agostino <john.dagostino@gmail.com>
|
||||
John D'Ambrosio <dambrosioj@gmail.com>
|
||||
John Huddleston <huddlej@wwu.edu>
|
||||
John Moses <moses.john.r@gmail.com>
|
||||
John Paulett <john@paulett.org>
|
||||
John Shaffer <jshaffer2112@gmail.com>
|
||||
Jökull Sólberg Auðunsson <jokullsolberg@gmail.com>
|
||||
Jon Dufresne <jon.dufresne@gmail.com>
|
||||
Jonas Haag <jonas@lophus.org>
|
||||
Jonatas C. D. <jonatas.cd@gmail.com>
|
||||
Jonathan Buchanan <jonathan.buchanan@gmail.com>
|
||||
Jonathan Daugherty (cygnus) <http://www.cprogrammer.org/>
|
||||
Jonathan Feignberg <jdf@pobox.com>
|
||||
Jonathan Slenders
|
||||
Jordan Dimov <s3x3y1@gmail.com>
|
||||
Jordi J. Tablada <jordi.joan@gmail.com>
|
||||
Jorge Bastida <me@jorgebastida.com>
|
||||
Jorge Gajon <gajon@gajon.org>
|
||||
José Tomás Tocino García <josetomas.tocino@gmail.com>
|
||||
Josef Rousek <josef.rousek@gmail.com>
|
||||
Joseph Kocherhans <joseph@jkocherhans.com>
|
||||
Josh Smeaton <josh.smeaton@gmail.com>
|
||||
Joshua Cannon <joshdcannon@gmail.com>
|
||||
Joshua Ginsberg <jag@flowtheory.net>
|
||||
Jozko Skrablin <jozko.skrablin@gmail.com>
|
||||
J. Pablo Fernandez <pupeno@pupeno.com>
|
||||
jpellerin@gmail.com
|
||||
Juan Catalano <catalanojuan@gmail.com>
|
||||
Juan Manuel Caicedo <juan.manuel.caicedo@gmail.com>
|
||||
Juan Pedro Fisanotti <fisadev@gmail.com>
|
||||
Julia Elman
|
||||
Julia Matsieva <julia.matsieva@gmail.com>
|
||||
Julian Bez
|
||||
Julien Phalip <jphalip@gmail.com>
|
||||
Junyoung Choi <cupjoo@gmail.com>
|
||||
junzhang.jn@gmail.com
|
||||
Jure Cuhalev <gandalf@owca.info>
|
||||
Justin Bronn <jbronn@gmail.com>
|
||||
Justine Tunney <jtunney@gmail.com>
|
||||
Justin Lilly <justinlilly@gmail.com>
|
||||
Justin Michalicek <jmichalicek@gmail.com>
|
||||
Justin Myles Holmes <justin@slashrootcafe.com>
|
||||
Jyrki Pulliainen <jyrki.pulliainen@gmail.com>
|
||||
Kadesarin Sanjek
|
||||
Karderio <karderio@gmail.com>
|
||||
Karen Tracey <kmtracey@gmail.com>
|
||||
Karol Sikora <elektrrrus@gmail.com>
|
||||
Katherine “Kati” Michel <kthrnmichel@gmail.com>
|
||||
Kathryn Killebrew <kathryn.killebrew@gmail.com>
|
||||
Katie Miller <katie@sub50.com>
|
||||
Keith Bussell <kbussell@gmail.com>
|
||||
Kenneth Love <kennethlove@gmail.com>
|
||||
Kent Hauser <kent@khauser.net>
|
||||
Kevin Grinberg <kevin@kevingrinberg.com>
|
||||
Kevin Kubasik <kevin@kubasik.net>
|
||||
Kevin McConnell <kevin.mcconnell@gmail.com>
|
||||
Kieran Holland <http://www.kieranholland.com>
|
||||
kilian <kilian.cavalotti@lip6.fr>
|
||||
Kim Joon Hwan 김준환 <xncbf12@gmail.com>
|
||||
Klaas van Schelven <klaas@vanschelven.com>
|
||||
knox <christobzr@gmail.com>
|
||||
konrad@gwu.edu
|
||||
Kowito Charoenratchatabhan <kowito@felspar.com>
|
||||
Krišjānis Vaiders <krisjanisvaiders@gmail.com>
|
||||
krzysiek.pawlik@silvermedia.pl
|
||||
Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com>
|
||||
Krzysztof Kulewski <kulewski@gmail.com>
|
||||
kurtiss@meetro.com
|
||||
Lakin Wecker <lakin@structuredabstraction.com>
|
||||
Lars Yencken <lars.yencken@gmail.com>
|
||||
Lau Bech Lauritzen
|
||||
Laurent Luce <https://www.laurentluce.com/>
|
||||
Laurent Rahuel <laurent.rahuel@gmail.com>
|
||||
lcordier@point45.com
|
||||
Leah Culver <leah.culver@gmail.com>
|
||||
Leandra Finger <leandra.finger@gmail.com>
|
||||
Lee Reilly <lee@leereilly.net>
|
||||
Lee Sanghyuck <shlee322@elab.kr>
|
||||
Leo "hylje" Honkanen <sealage@gmail.com>
|
||||
Leo Shklovskii
|
||||
Leo Soto <leo.soto@gmail.com>
|
||||
lerouxb@gmail.com
|
||||
Lex Berezhny <lex@damoti.com>
|
||||
Liang Feng <hutuworm@gmail.com>
|
||||
limodou
|
||||
Lincoln Smith <lincoln.smith@anu.edu.au>
|
||||
Liu Yijie <007gzs@gmail.com>
|
||||
Loek van Gent <loek@barakken.nl>
|
||||
Loïc Bistuer <loic.bistuer@sixmedia.com>
|
||||
Lowe Thiderman <lowe.thiderman@gmail.com>
|
||||
Luan Pablo <luanpab@gmail.com>
|
||||
Lucas Connors <https://www.revolutiontech.ca/>
|
||||
Luciano Ramalho
|
||||
Ludvig Ericson <ludvig.ericson@gmail.com>
|
||||
Luis C. Berrocal <luis.berrocal.1942@gmail.com>
|
||||
Łukasz Langa <lukasz@langa.pl>
|
||||
Łukasz Rekucki <lrekucki@gmail.com>
|
||||
Luke Granger-Brown <django@lukegb.com>
|
||||
Luke Plant <L.Plant.98@cantab.net>
|
||||
Maciej Fijalkowski
|
||||
Maciej Wiśniowski <pigletto@gmail.com>
|
||||
Mads Jensen <https://github.com/atombrella>
|
||||
Makoto Tsuyuki <mtsuyuki@gmail.com>
|
||||
Malcolm Tredinnick
|
||||
Manuel Saelices <msaelices@yaco.es>
|
||||
Manuzhai
|
||||
Marc Aymerich Gubern
|
||||
Marc Egli <frog32@me.com>
|
||||
Marcel Telka <marcel@telka.sk>
|
||||
Marc Fargas <telenieko@telenieko.com>
|
||||
Marc Garcia <marc.garcia@accopensys.com>
|
||||
Marcin Wróbel
|
||||
Marc Remolt <m.remolt@webmasters.de>
|
||||
Marc Tamlyn <marc.tamlyn@gmail.com>
|
||||
Marc-Aurèle Brothier <ma.brothier@gmail.com>
|
||||
Marian Andre <django@andre.sk>
|
||||
Marijn Vriens <marijn@metronomo.cl>
|
||||
Mario Gonzalez <gonzalemario@gmail.com>
|
||||
Mariusz Felisiak <felisiak.mariusz@gmail.com>
|
||||
Mark Biggers <biggers@utsl.com>
|
||||
Mark Gensler <mark.gensler@protonmail.com>
|
||||
mark@junklight.com
|
||||
Mark Lavin <markdlavin@gmail.com>
|
||||
Mark Sandstrom <mark@deliciouslynerdy.com>
|
||||
Markus Amalthea Magnuson <markus.magnuson@gmail.com>
|
||||
Markus Holtermann <https://markusholtermann.eu>
|
||||
Marten Kenbeek <marten.knbk+django@gmail.com>
|
||||
Marti Raudsepp <marti@juffo.org>
|
||||
martin.glueck@gmail.com
|
||||
Martin Green
|
||||
Martin Kosír <martin@martinkosir.net>
|
||||
Martin Mahner <https://www.mahner.org/>
|
||||
Martin Maney <http://www.chipy.org/Martin_Maney>
|
||||
Martin von Gagern <gagern@google.com>
|
||||
Mart Sõmermaa <http://mrts.pri.ee/>
|
||||
Marty Alchin <gulopine@gamemusic.org>
|
||||
Masashi Shibata <m.shibata1020@gmail.com>
|
||||
masonsimon+django@gmail.com
|
||||
Massimiliano Ravelli <massimiliano.ravelli@gmail.com>
|
||||
Massimo Scamarcia <massimo.scamarcia@gmail.com>
|
||||
Mathieu Agopian <mathieu.agopian@gmail.com>
|
||||
Matías Bordese
|
||||
Matt Boersma <matt@sprout.org>
|
||||
Matt Croydon <http://www.postneo.com/>
|
||||
Matt Deacalion Stevens <matt@dirtymonkey.co.uk>
|
||||
Matt Dennenbaum
|
||||
Matthew Flanagan <https://wadofstuff.blogspot.com/>
|
||||
Matthew Schinckel <matt@schinckel.net>
|
||||
Matthew Somerville <matthew-django@dracos.co.uk>
|
||||
Matthew Tretter <m@tthewwithanm.com>
|
||||
Matthew Wilkes <matt@matthewwilkes.name>
|
||||
Matthias Kestenholz <mk@406.ch>
|
||||
Matthias Pronk <django@masida.nl>
|
||||
Matt Hoskins <skaffenuk@googlemail.com>
|
||||
Matt McClanahan <https://mmcc.cx/>
|
||||
Matt Riggott
|
||||
Matt Robenolt <m@robenolt.com>
|
||||
Mattia Larentis <mattia@laretis.eu>
|
||||
Mattia Procopio <promat85@gmail.com>
|
||||
Mattias Loverot <mattias@stubin.se>
|
||||
mattycakes@gmail.com
|
||||
Max Burstein <http://maxburstein.com>
|
||||
Max Derkachev <mderk@yandex.ru>
|
||||
Max Smolens <msmolens@gmail.com>
|
||||
Maxime Lorant <maxime.lorant@gmail.com>
|
||||
Maxime Turcotte <maxocub@riseup.net>
|
||||
Maximilian Merz <django@mxmerz.de>
|
||||
Maximillian Dornseif <md@hudora.de>
|
||||
mccutchen@gmail.com
|
||||
Meir Kriheli <http://mksoft.co.il/>
|
||||
Michael S. Brown <michael@msbrown.net>
|
||||
Michael Hall <mhall1@ualberta.ca>
|
||||
Michael Josephson <http://www.sdjournal.com/>
|
||||
Michael Manfre <mmanfre@gmail.com>
|
||||
michael.mcewan@gmail.com
|
||||
Michael Placentra II <someone@michaelplacentra2.net>
|
||||
Michael Radziej <mir@noris.de>
|
||||
Michael Sanders <m.r.sanders@gmail.com>
|
||||
Michael Schwarz <michi.schwarz@gmail.com>
|
||||
Michael Sinov <sihaelov@gmail.com>
|
||||
Michael Thornhill <michael.thornhill@gmail.com>
|
||||
Michal Chruszcz <troll@pld-linux.org>
|
||||
michal@plovarna.cz
|
||||
Michał Modzelewski <michal.modzelewski@gmail.com>
|
||||
Mihai Damian <yang_damian@yahoo.com>
|
||||
Mihai Preda <mihai_preda@yahoo.com>
|
||||
Mikaël Barbero <mikael.barbero nospam at nospam free.fr>
|
||||
Mike Axiak <axiak@mit.edu>
|
||||
Mike Grouchy <https://mikegrouchy.com/>
|
||||
Mike Malone <mjmalone@gmail.com>
|
||||
Mike Richardson
|
||||
Mike Wiacek <mjwiacek@google.com>
|
||||
Mikhail Korobov <kmike84@googlemail.com>
|
||||
Mikko Hellsing <mikko@sorl.net>
|
||||
Mikołaj Siedlarek <mikolaj.siedlarek@gmail.com>
|
||||
milkomeda
|
||||
Milton Waddams
|
||||
mitakummaa@gmail.com
|
||||
mmarshall
|
||||
Moayad Mardini <moayad.m@gmail.com>
|
||||
Morgan Aubert <morgan.aubert@zoho.com>
|
||||
Moritz Sichert <moritz.sichert@googlemail.com>
|
||||
Morten Bagai <m@bagai.com>
|
||||
msaelices <msaelices@gmail.com>
|
||||
msundstr
|
||||
Mushtaq Ali <mushtaak@gmail.com>
|
||||
Mykola Zamkovoi <nickzam@gmail.com>
|
||||
Nadège Michel <michel.nadege@gmail.com>
|
||||
Nagy Károly <charlie@rendszergazda.com>
|
||||
Nasimul Haque <nasim.haque@gmail.com>
|
||||
Nasir Hussain <nasirhjafri@gmail.com>
|
||||
Natalia Bidart <nataliabidart@gmail.com>
|
||||
Nate Bragg <jonathan.bragg@alum.rpi.edu>
|
||||
Nathan Gaberel <nathan@gnab.fr>
|
||||
Neal Norwitz <nnorwitz@google.com>
|
||||
Nebojša Dorđević
|
||||
Ned Batchelder <https://nedbatchelder.com/>
|
||||
Nena Kojadin <nena@kiberpipa.org>
|
||||
Niall Dalton <niall.dalton12@gmail.com>
|
||||
Niall Kelly <duke.sam.vimes@gmail.com>
|
||||
Nick Efford <nick@efford.org>
|
||||
Nick Lane <nick.lane.au@gmail.com>
|
||||
Nick Pope <nick@nickpope.me.uk>
|
||||
Nick Presta <nick@nickpresta.ca>
|
||||
Nick Sandford <nick.sandford@gmail.com>
|
||||
Nick Sarbicki <nick.a.sarbicki@gmail.com>
|
||||
Niclas Olofsson <n@niclasolofsson.se>
|
||||
Nicola Larosa <nico@teknico.net>
|
||||
Nicolas Lara <nicolaslara@gmail.com>
|
||||
Nicolas Noé <nicolas@niconoe.eu>
|
||||
Niran Babalola <niran@niran.org>
|
||||
Nis Jørgensen <nis@superlativ.dk>
|
||||
Nowell Strite <https://nowell.strite.org/>
|
||||
Nuno Mariz <nmariz@gmail.com>
|
||||
oggie rob <oz.robharvey@gmail.com>
|
||||
oggy <ognjen.maric@gmail.com>
|
||||
Oliver Beattie <oliver@obeattie.com>
|
||||
Oliver Rutherfurd <http://rutherfurd.net/>
|
||||
Olivier Sels <olivier.sels@gmail.com>
|
||||
Olivier Tabone <olivier.tabone@ripplemotion.fr>
|
||||
Orestis Markou <orestis@orestis.gr>
|
||||
Orne Brocaar <http://brocaar.com/>
|
||||
Oscar Ramirez <tuxskar@gmail.com>
|
||||
Ossama M. Khayat <okhayat@yahoo.com>
|
||||
Owen Griffiths
|
||||
Pablo Martín <goinnn@gmail.com>
|
||||
Panos Laganakos <panos.laganakos@gmail.com>
|
||||
Paolo Melchiorre <paolo@melchiorre.org>
|
||||
Pascal Hartig <phartig@rdrei.net>
|
||||
Pascal Varet
|
||||
Patrik Sletmo <patrik.sletmo@gmail.com>
|
||||
Paul Bissex <http://e-scribe.com/>
|
||||
Paul Collier <paul@paul-collier.com>
|
||||
Paul Collins <paul.collins.iii@gmail.com>
|
||||
Paul Donohue <django@PaulSD.com>
|
||||
Paul Lanier <planier@google.com>
|
||||
Paul McLanahan <paul@mclanahan.net>
|
||||
Paul McMillan <Paul@McMillan.ws>
|
||||
Paulo Poiati <paulogpoiati@gmail.com>
|
||||
Paulo Scardine <paulo@scardine.com.br>
|
||||
Paul Smith <blinkylights23@gmail.com>
|
||||
Pavel Kulikov <kulikovpavel@gmail.com>
|
||||
pavithran s <pavithran.s@gmail.com>
|
||||
Pavlo Kapyshin <i@93z.org>
|
||||
permonik@mesias.brnonet.cz
|
||||
Petar Marić <http://www.petarmaric.com/>
|
||||
Pete Crosier <pete.crosier@gmail.com>
|
||||
peter@mymart.com
|
||||
Peter Sheats <sheats@gmail.com>
|
||||
Peter van Kampen
|
||||
Peter Zsoldos <http://zsoldosp.eu>
|
||||
Pete Shinners <pete@shinners.org>
|
||||
Petr Marhoun <petr.marhoun@gmail.com>
|
||||
pgross@thoughtworks.com
|
||||
phaedo <http://phaedo.cx/>
|
||||
phil.h.smith@gmail.com
|
||||
Philip Lindborg <philip.lindborg@gmail.com>
|
||||
Philippe Raoult <philippe.raoult@n2nsoft.com>
|
||||
phil@produxion.net
|
||||
Piotr Jakimiak <piotr.jakimiak@gmail.com>
|
||||
Piotr Lewandowski <piotr.lewandowski@gmail.com>
|
||||
plisk
|
||||
polpak@yahoo.com
|
||||
pradeep.gowda@gmail.com
|
||||
Preston Holmes <preston@ptone.com>
|
||||
Preston Timmons <prestontimmons@gmail.com>
|
||||
Priyansh Saxena <askpriyansh@gmail.com>
|
||||
Przemysław Buczkowski <przemub@przemub.pl>
|
||||
Przemysław Suliga <http://suligap.net>
|
||||
Qi Zhao <zhaoqi99@outlook.com>
|
||||
Rachel Tobin <rmtobin@me.com>
|
||||
Rachel Willmer <http://www.willmer.com/kb/>
|
||||
Radek Švarz <https://www.svarz.cz/translate/>
|
||||
Raffaele Salmaso <raffaele@salmaso.org>
|
||||
Rajesh Dhawan <rajesh.dhawan@gmail.com>
|
||||
Ramez Ashraf <ramezashraf@gmail.com>
|
||||
Ramin Farajpour Cami <ramin.blackhat@gmail.com>
|
||||
Ramiro Morales <ramiro@rmorales.net>
|
||||
Ramon Saraiva <ramonsaraiva@gmail.com>
|
||||
Ram Rachum <ram@rachum.com>
|
||||
Randy Barlow <randy@electronsweatshop.com>
|
||||
Raphaël Barrois <raphael.barrois@m4x.org>
|
||||
Raphael Michel <mail@raphaelmichel.de>
|
||||
Raúl Cumplido <raulcumplido@gmail.com>
|
||||
Rebecca Smith <rebkwok@gmail.com>
|
||||
Remco Wendt <remco.wendt@gmail.com>
|
||||
Renaud Parent <renaud.parent@gmail.com>
|
||||
Renbi Yu <averybigant@gmail.com>
|
||||
Reza Mohammadi <reza@zeerak.ir>
|
||||
rhettg@gmail.com
|
||||
Ricardo Javier Cárdenes Medina <ricardo.cardenes@gmail.com>
|
||||
ricardojbarrios@gmail.com
|
||||
Riccardo Di Virgilio
|
||||
Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
|
||||
Richard Davies <richard.davies@elastichosts.com>
|
||||
Richard House <Richard.House@i-logue.com>
|
||||
Rick Wagner <rwagner@physics.ucsd.edu>
|
||||
Rigel Di Scala <rigel.discala@propylon.com>
|
||||
Robert Coup
|
||||
Robert Myers <myer0052@gmail.com>
|
||||
Roberto Aguilar <roberto@baremetal.io>
|
||||
Robert Rock Howard <http://djangomojo.com/>
|
||||
Robert Wittams
|
||||
Rob Golding-Day <rob@golding-day.com>
|
||||
Rob Hudson <https://rob.cogit8.org/>
|
||||
Rob Nguyen <tienrobertnguyenn@gmail.com>
|
||||
Robin Munn <http://www.geekforgod.com/>
|
||||
Rodrigo Pinheiro Marques de Araújo <fenrrir@gmail.com>
|
||||
Romain Garrigues <romain.garrigues.cs@gmail.com>
|
||||
Ronny Haryanto <https://ronny.haryan.to/>
|
||||
Ross Poulton <ross@rossp.org>
|
||||
Rozza <ross.lawley@gmail.com>
|
||||
Rudolph Froger <rfroger@estrate.nl>
|
||||
Rudy Mutter
|
||||
Rune Rønde Laursen <runerl@skjoldhoej.dk>
|
||||
Russell Cloran <russell@rucus.net>
|
||||
Russell Keith-Magee <russell@keith-magee.com>
|
||||
Russ Webber
|
||||
Ryan Hall <ryanhall989@gmail.com>
|
||||
ryankanno
|
||||
Ryan Kelly <ryan@rfk.id.au>
|
||||
Ryan Niemeyer <https://profiles.google.com/ryan.niemeyer/about>
|
||||
Ryan Petrello <ryan@ryanpetrello.com>
|
||||
Ryan Rubin <ryanmrubin@gmail.com>
|
||||
Ryno Mathee <rmathee@gmail.com>
|
||||
Sachin Jat <sanch.jat@gmail.com>
|
||||
Sage M. Abdullah <https://github.com/laymonage>
|
||||
Sam Newman <http://www.magpiebrain.com/>
|
||||
Sander Dijkhuis <sander.dijkhuis@gmail.com>
|
||||
Sanket Saurav <sanketsaurav@gmail.com>
|
||||
Sanyam Khurana <sanyam.khurana01@gmail.com>
|
||||
Sarthak Mehrish <sarthakmeh03@gmail.com>
|
||||
schwank@gmail.com
|
||||
Scot Hacker <shacker@birdhouse.org>
|
||||
Scott Barr <scott@divisionbyzero.com.au>
|
||||
Scott Fitsimones <scott@airgara.ge>
|
||||
Scott Pashley <github@scottpashley.co.uk>
|
||||
scott@staplefish.com
|
||||
Sean Brant
|
||||
Sebastian Hillig <sebastian.hillig@gmail.com>
|
||||
Sebastian Spiegel <https://www.tivix.com/>
|
||||
Segyo Myung <myungsekyo@gmail.com>
|
||||
Selwin Ong <selwin@ui.co.id>
|
||||
Sengtha Chay <sengtha@e-khmer.com>
|
||||
Senko Rašić <senko.rasic@dobarkod.hr>
|
||||
serbaut@gmail.com
|
||||
Sergei Maertens <sergeimaertens@gmail.com>
|
||||
Sergey Fedoseev <fedoseev.sergey@gmail.com>
|
||||
Sergey Kolosov <m17.admin@gmail.com>
|
||||
Seth Hill <sethrh@gmail.com>
|
||||
Shai Berger <shai@platonix.com>
|
||||
Shannon -jj Behrens <https://www.jjinux.com/>
|
||||
Shawn Milochik <shawn@milochik.com>
|
||||
Silvan Spross <silvan.spross@gmail.com>
|
||||
Simeon Visser <http://simeonvisser.com>
|
||||
Simon Blanchard
|
||||
Simon Charette <charette.s@gmail.com>
|
||||
Simon Greenhill <dev@simon.net.nz>
|
||||
Simon Litchfield <simon@quo.com.au>
|
||||
Simon Meers <simon@simonmeers.com>
|
||||
Simon Williams
|
||||
Simon Willison <simon@simonwillison.net>
|
||||
Sjoerd Job Postmus
|
||||
Slawek Mikula <slawek dot mikula at gmail dot com>
|
||||
sloonz <simon.lipp@insa-lyon.fr>
|
||||
smurf@smurf.noris.de
|
||||
sopel
|
||||
Srinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
|
||||
Stanislas Guerra <stan@slashdev.me>
|
||||
Stanislaus Madueke
|
||||
Stanislav Karpov <work@stkrp.ru>
|
||||
starrynight <cmorgh@gmail.com>
|
||||
Stefan R. Filipek
|
||||
Stefane Fermgier <sf@fermigier.com>
|
||||
Stefano Rivera <stefano@rivera.za.net>
|
||||
Stéphane Raimbault <stephane.raimbault@gmail.com>
|
||||
Stephan Jaekel <steph@rdev.info>
|
||||
Stephen Burrows <stephen.r.burrows@gmail.com>
|
||||
Steven L. Smith (fvox13) <steven@stevenlsmith.com>
|
||||
Steven Noorbergen (Xaroth) <xaroth+django@xaroth.nl>
|
||||
Stuart Langridge <https://www.kryogenix.org/>
|
||||
Subhav Gautam <subhavgautam@yahoo.co.uk>
|
||||
Sujay S Kumar <sujay.skumar141295@gmail.com>
|
||||
Sune Kirkeby <https://ibofobi.dk/>
|
||||
Sung-Jin Hong <serialx.net@gmail.com>
|
||||
SuperJared
|
||||
Susan Tan <susan.tan.fleckerl@gmail.com>
|
||||
Sutrisno Efendi <kangfend@gmail.com>
|
||||
Swaroop C H <http://www.swaroopch.info>
|
||||
Szilveszter Farkas <szilveszter.farkas@gmail.com>
|
||||
Taavi Teska <taaviteska@gmail.com>
|
||||
Tai Lee <real.human@mrmachine.net>
|
||||
Takashi Matsuo <matsuo.takashi@gmail.com>
|
||||
Tareque Hossain <http://www.codexn.com>
|
||||
Taylor Mitchell <taylor.mitchell@gmail.com>
|
||||
Terry Huang <terryh.tp@gmail.com>
|
||||
thebjorn <bp@datakortet.no>
|
||||
Thejaswi Puthraya <thejaswi.puthraya@gmail.com>
|
||||
Thijs van Dien <thijs@vandien.net>
|
||||
Thom Wiggers
|
||||
Thomas Chaumeny <t.chaumeny@gmail.com>
|
||||
Thomas Güttler <hv@tbz-pariv.de>
|
||||
Thomas Kerpe <thomas@kerpe.net>
|
||||
Thomas Sorrel
|
||||
Thomas Steinacher <http://www.eggdrop.ch/>
|
||||
Thomas Stromberg <tstromberg@google.com>
|
||||
Thomas Tanner <tanner@gmx.net>
|
||||
tibimicu@gmx.net
|
||||
Tim Allen <tim@pyphilly.org>
|
||||
Tim Givois <tim.givois.mendez@gmail.com>
|
||||
Tim Graham <timograham@gmail.com>
|
||||
Tim Heap <tim@timheap.me>
|
||||
Tim Saylor <tim.saylor@gmail.com>
|
||||
Tobias Kunze <rixx@cutebit.de>
|
||||
Tobias McNulty <https://www.caktusgroup.com/blog/>
|
||||
tobias@neuyork.de
|
||||
Todd O'Bryan <toddobryan@mac.com>
|
||||
Tom Carrick <https://www.carrick.eu>
|
||||
Tom Christie <tom@tomchristie.com>
|
||||
Tom Forbes <tom@tomforb.es>
|
||||
Tom Insam
|
||||
Tom Tobin
|
||||
Tomáš Ehrlich <tomas.ehrlich@gmail.com>
|
||||
Tomáš Kopeček <permonik@m6.cz>
|
||||
Tome Cvitan <tome@cvitan.com>
|
||||
Tomek Paczkowski <tomek@hauru.eu>
|
||||
Tomer Chachamu
|
||||
Tommy Beadle <tbeadle@gmail.com>
|
||||
Tore Lundqvist <tore.lundqvist@gmail.com>
|
||||
torne-django@wolfpuppy.org.uk
|
||||
Travis Cline <travis.cline@gmail.com>
|
||||
Travis Pinney
|
||||
Travis Swicegood <travis@domain51.com>
|
||||
Travis Terry <tdterry7@gmail.com>
|
||||
Trevor Caira <trevor@caira.com>
|
||||
Trey Long <trey@ktrl.com>
|
||||
tstromberg@google.com
|
||||
tt@gurgle.no
|
||||
Tyler Tarabula <tyler.tarabula@gmail.com>
|
||||
Tyson Clugg <tyson@clugg.net>
|
||||
Tyson Tate <tyson@fallingbullets.com>
|
||||
Unai Zalakain <unai@gisa-elkartea.org>
|
||||
Valentina Mukhamedzhanova <umirra@gmail.com>
|
||||
valtron
|
||||
Vasiliy Stavenko <stavenko@gmail.com>
|
||||
Vasil Vangelovski
|
||||
Vibhu Agarwal <vibhu-agarwal.github.io>
|
||||
Victor Andrée
|
||||
viestards.lists@gmail.com
|
||||
Viktor Danyliuk <v.v.danyliuk@gmail.com>
|
||||
Ville Säävuori <https://www.unessa.net/>
|
||||
Vinay Karanam <https://github.com/vinayinvicible>
|
||||
Vinay Sajip <vinay_sajip@yahoo.co.uk>
|
||||
Vincent Foley <vfoleybourgon@yahoo.ca>
|
||||
Vinny Do <vdo.code@gmail.com>
|
||||
Vitaly Babiy <vbabiy86@gmail.com>
|
||||
Vladimir Kuzma <vladimirkuzma.ch@gmail.com>
|
||||
Vlado <vlado@labath.org>
|
||||
Vsevolod Solovyov
|
||||
Vytis Banaitis <vytis.banaitis@gmail.com>
|
||||
wam-djangobug@wamber.net
|
||||
Wang Chun <wangchun@exoweb.net>
|
||||
Warren Smith <warren@wandrsmith.net>
|
||||
Waylan Limberg <waylan@gmail.com>
|
||||
Wiktor Kołodziej <wiktor@pykonik.org>
|
||||
Wiley Kestner <wiley.kestner@gmail.com>
|
||||
Wiliam Alves de Souza <wiliamsouza83@gmail.com>
|
||||
Will Ayd <william.ayd@icloud.com>
|
||||
William Schwartz <wkschwartz@gmail.com>
|
||||
Will Hardy <django@willhardy.com.au>
|
||||
Wilson Miner <wminer@gmail.com>
|
||||
Wim Glenn <hey@wimglenn.com>
|
||||
wojtek
|
||||
Xavier Francisco <xavier.n.francisco@gmail.com>
|
||||
Xia Kai <https://blog.xiaket.org/>
|
||||
Yann Fouillat <gagaro42@gmail.com>
|
||||
Yann Malet
|
||||
Yasushi Masuda <whosaysni@gmail.com>
|
||||
ye7cakf02@sneakemail.com
|
||||
ymasuda@ethercube.com
|
||||
Yoong Kang Lim <yoongkang.lim@gmail.com>
|
||||
Yusuke Miyazaki <miyazaki.dev@gmail.com>
|
||||
Zac Hatfield-Dodds <zac.hatfield.dodds@gmail.com>
|
||||
Zachary Voase <zacharyvoase@gmail.com>
|
||||
Zach Liu <zachliu@gmail.com>
|
||||
Zach Thompson <zthompson47@gmail.com>
|
||||
Zain Memon
|
||||
Zak Johnson <zakj@nox.cx>
|
||||
Žan Anderle <zan.anderle@gmail.com>
|
||||
Zbigniew Siciarz <zbigniew@siciarz.net>
|
||||
zegor
|
||||
Zeynel Özdemir <ozdemir.zynl@gmail.com>
|
||||
Zlatko Mašek <zlatko.masek@gmail.com>
|
||||
zriv <https://github.com/zriv>
|
||||
<Please alphabetize new entries>
|
||||
|
||||
A big THANK YOU goes to:
|
||||
|
||||
Rob Curley and Ralph Gage for letting us open-source Django.
|
||||
|
||||
Frank Wiles for making excellent arguments for open-sourcing, and for
|
||||
his sage sysadmin advice.
|
||||
|
||||
Ian Bicking for convincing Adrian to ditch code generation.
|
||||
|
||||
Mark Pilgrim for "Dive Into Python" (https://www.diveinto.org/python3/).
|
||||
|
||||
Guido van Rossum for creating Python.
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,27 @@
|
||||
Copyright (c) Django Software Foundation and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Django nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@ -0,0 +1,265 @@
|
||||
Django is licensed under the three-clause BSD license; see the file
|
||||
LICENSE for details.
|
||||
|
||||
Django includes code from the Python standard library, which is licensed under
|
||||
the Python license, a permissive open source license. The copyright and license
|
||||
is included below for compliance with Python's terms.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2001-present Python Software Foundation; All Rights Reserved
|
||||
|
||||
A. HISTORY OF THE SOFTWARE
|
||||
==========================
|
||||
|
||||
Python was created in the early 1990s by Guido van Rossum at Stichting
|
||||
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
|
||||
as a successor of a language called ABC. Guido remains Python's
|
||||
principal author, although it includes many contributions from others.
|
||||
|
||||
In 1995, Guido continued his work on Python at the Corporation for
|
||||
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
|
||||
in Reston, Virginia where he released several versions of the
|
||||
software.
|
||||
|
||||
In May 2000, Guido and the Python core development team moved to
|
||||
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
||||
year, the PythonLabs team moved to Digital Creations, which became
|
||||
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
||||
https://www.python.org/psf/) was formed, a non-profit organization
|
||||
created specifically to own Python-related Intellectual Property.
|
||||
Zope Corporation was a sponsoring member of the PSF.
|
||||
|
||||
All Python releases are Open Source (see http://www.opensource.org for
|
||||
the Open Source Definition). Historically, most, but not all, Python
|
||||
releases have also been GPL-compatible; the table below summarizes
|
||||
the various releases.
|
||||
|
||||
Release Derived Year Owner GPL-
|
||||
from compatible? (1)
|
||||
|
||||
0.9.0 thru 1.2 1991-1995 CWI yes
|
||||
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
||||
1.6 1.5.2 2000 CNRI no
|
||||
2.0 1.6 2000 BeOpen.com no
|
||||
1.6.1 1.6 2001 CNRI yes (2)
|
||||
2.1 2.0+1.6.1 2001 PSF no
|
||||
2.0.1 2.0+1.6.1 2001 PSF yes
|
||||
2.1.1 2.1+2.0.1 2001 PSF yes
|
||||
2.1.2 2.1.1 2002 PSF yes
|
||||
2.1.3 2.1.2 2002 PSF yes
|
||||
2.2 and above 2.1.1 2001-now PSF yes
|
||||
|
||||
Footnotes:
|
||||
|
||||
(1) GPL-compatible doesn't mean that we're distributing Python under
|
||||
the GPL. All Python licenses, unlike the GPL, let you distribute
|
||||
a modified version without making your changes open source. The
|
||||
GPL-compatible licenses make it possible to combine Python with
|
||||
other software that is released under the GPL; the others don't.
|
||||
|
||||
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
||||
because its license has a choice of law clause. According to
|
||||
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
||||
is "not incompatible" with the GPL.
|
||||
|
||||
Thanks to the many outside volunteers who have worked under Guido's
|
||||
direction to make these releases possible.
|
||||
|
||||
|
||||
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
||||
===============================================================
|
||||
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use Python alone or in any derivative version,
|
||||
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
|
||||
All Rights Reserved" are retained in Python alone or in any derivative version
|
||||
prepared by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
||||
-------------------------------------------
|
||||
|
||||
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
||||
|
||||
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
||||
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
||||
Individual or Organization ("Licensee") accessing and otherwise using
|
||||
this software in source or binary form and its associated
|
||||
documentation ("the Software").
|
||||
|
||||
2. Subject to the terms and conditions of this BeOpen Python License
|
||||
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
||||
royalty-free, world-wide license to reproduce, analyze, test, perform
|
||||
and/or display publicly, prepare derivative works, distribute, and
|
||||
otherwise use the Software alone or in any derivative version,
|
||||
provided, however, that the BeOpen Python License is retained in the
|
||||
Software, alone or in any derivative version prepared by Licensee.
|
||||
|
||||
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
||||
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
||||
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
||||
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
||||
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
5. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
6. This License Agreement shall be governed by and interpreted in all
|
||||
respects by the law of the State of California, excluding conflict of
|
||||
law provisions. Nothing in this License Agreement shall be deemed to
|
||||
create any relationship of agency, partnership, or joint venture
|
||||
between BeOpen and Licensee. This License Agreement does not grant
|
||||
permission to use BeOpen trademarks or trade names in a trademark
|
||||
sense to endorse or promote products or services of Licensee, or any
|
||||
third party. As an exception, the "BeOpen Python" logos available at
|
||||
http://www.pythonlabs.com/logos.html may be used according to the
|
||||
permissions granted on that web page.
|
||||
|
||||
7. By copying, installing or otherwise using the software, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
||||
---------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Corporation for National
|
||||
Research Initiatives, having an office at 1895 Preston White Drive,
|
||||
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
||||
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
||||
source or binary form and its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, CNRI
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
||||
alone or in any derivative version, provided, however, that CNRI's
|
||||
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
||||
1995-2001 Corporation for National Research Initiatives; All Rights
|
||||
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
||||
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
||||
Agreement, Licensee may substitute the following text (omitting the
|
||||
quotes): "Python 1.6.1 is made available subject to the terms and
|
||||
conditions in CNRI's License Agreement. This Agreement together with
|
||||
Python 1.6.1 may be located on the Internet using the following
|
||||
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
||||
Agreement may also be obtained from a proxy server on the Internet
|
||||
using the following URL: http://hdl.handle.net/1895.22/1013".
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python 1.6.1.
|
||||
|
||||
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
||||
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. This License Agreement shall be governed by the federal
|
||||
intellectual property law of the United States, including without
|
||||
limitation the federal copyright law, and, to the extent such
|
||||
U.S. federal law does not apply, by the law of the Commonwealth of
|
||||
Virginia, excluding Virginia's conflict of law provisions.
|
||||
Notwithstanding the foregoing, with regard to derivative works based
|
||||
on Python 1.6.1 that incorporate non-separable material that was
|
||||
previously distributed under the GNU General Public License (GPL), the
|
||||
law of the Commonwealth of Virginia shall govern this License
|
||||
Agreement only as to issues arising under or with respect to
|
||||
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
||||
License Agreement shall be deemed to create any relationship of
|
||||
agency, partnership, or joint venture between CNRI and Licensee. This
|
||||
License Agreement does not grant permission to use CNRI trademarks or
|
||||
trade name in a trademark sense to endorse or promote products or
|
||||
services of Licensee, or any third party.
|
||||
|
||||
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
||||
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
||||
bound by the terms and conditions of this License Agreement.
|
||||
|
||||
ACCEPT
|
||||
|
||||
|
||||
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
||||
--------------------------------------------------
|
||||
|
||||
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
||||
The Netherlands. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Stichting Mathematisch
|
||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
||||
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
@ -0,0 +1,90 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Django
|
||||
Version: 3.1.4
|
||||
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
|
||||
Home-page: https://www.djangoproject.com/
|
||||
Author: Django Software Foundation
|
||||
Author-email: foundation@djangoproject.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Documentation, https://docs.djangoproject.com/
|
||||
Project-URL: Release notes, https://docs.djangoproject.com/en/stable/releases/
|
||||
Project-URL: Funding, https://www.djangoproject.com/fundraising/
|
||||
Project-URL: Source, https://github.com/django/django
|
||||
Project-URL: Tracker, https://code.djangoproject.com/
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Django
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Topic :: Internet :: WWW/HTTP
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Python: >=3.6
|
||||
Requires-Dist: asgiref (<4,>=3.2.10)
|
||||
Requires-Dist: pytz
|
||||
Requires-Dist: sqlparse (>=0.2.2)
|
||||
Provides-Extra: argon2
|
||||
Requires-Dist: argon2-cffi (>=16.1.0) ; extra == 'argon2'
|
||||
Provides-Extra: bcrypt
|
||||
Requires-Dist: bcrypt ; extra == 'bcrypt'
|
||||
|
||||
======
|
||||
Django
|
||||
======
|
||||
|
||||
Django is a high-level Python Web framework that encourages rapid development
|
||||
and clean, pragmatic design. Thanks for checking it out.
|
||||
|
||||
All documentation is in the "``docs``" directory and online at
|
||||
https://docs.djangoproject.com/en/stable/. If you're just getting started,
|
||||
here's how we recommend you read the docs:
|
||||
|
||||
* First, read ``docs/intro/install.txt`` for instructions on installing Django.
|
||||
|
||||
* Next, work through the tutorials in order (``docs/intro/tutorial01.txt``,
|
||||
``docs/intro/tutorial02.txt``, etc.).
|
||||
|
||||
* If you want to set up an actual deployment server, read
|
||||
``docs/howto/deployment/index.txt`` for instructions.
|
||||
|
||||
* You'll probably want to read through the topical guides (in ``docs/topics``)
|
||||
next; from there you can jump to the HOWTOs (in ``docs/howto``) for specific
|
||||
problems, and check out the reference (``docs/ref``) for gory details.
|
||||
|
||||
* See ``docs/README`` for instructions on building an HTML version of the docs.
|
||||
|
||||
Docs are updated rigorously. If you find any problems in the docs, or think
|
||||
they should be clarified in any way, please take 30 seconds to fill out a
|
||||
ticket here: https://code.djangoproject.com/newticket
|
||||
|
||||
To get more help:
|
||||
|
||||
* Join the ``#django`` channel on irc.freenode.net. Lots of helpful people hang
|
||||
out there. See https://freenode.net/kb/answer/chat if you're new to IRC.
|
||||
|
||||
* Join the django-users mailing list, or read the archives, at
|
||||
https://groups.google.com/group/django-users.
|
||||
|
||||
To contribute to Django:
|
||||
|
||||
* Check out https://docs.djangoproject.com/en/dev/internals/contributing/ for
|
||||
information about getting involved.
|
||||
|
||||
To run Django's test suite:
|
||||
|
||||
* Follow the instructions in the "Unit tests" section of
|
||||
``docs/internals/contributing/writing-code/unit-tests.txt``, published online at
|
||||
https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.33.1)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
[console_scripts]
|
||||
django-admin = django.core.management:execute_from_command_line
|
||||
|
||||
@ -0,0 +1 @@
|
||||
django
|
||||
@ -0,0 +1,29 @@
|
||||
PyJWT lead developer
|
||||
---------------------
|
||||
|
||||
- jpadilla <hello@jpadilla.com>
|
||||
|
||||
|
||||
Original author
|
||||
------------------
|
||||
|
||||
- progrium <progrium@gmail.com>
|
||||
|
||||
|
||||
Patches and Suggestions
|
||||
-----------------------
|
||||
|
||||
- Boris Feld <boris.feld@novapost.fr> <lothiraldan@gmail.com>
|
||||
|
||||
- Åsmund Ødegård <asmund@xal.no> <ao@mcash.no>
|
||||
Adding support for RSA-SHA256 privat/public signature.
|
||||
|
||||
- Mark Adams <mark@markadams.me>
|
||||
|
||||
- Wouter Bolsterlee <uws@xs4all.nl>
|
||||
|
||||
- Michael Davis <mike.philip.davis@gmail.com> <mike.davis@workiva.com>
|
||||
|
||||
- Vinod Gupta <codervinod@gmail.com>
|
||||
|
||||
- Derek Weitzel <djw8605@gmail.com>
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 José Padilla
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@ -0,0 +1,115 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: PyJWT
|
||||
Version: 1.7.1
|
||||
Summary: JSON Web Token implementation in Python
|
||||
Home-page: http://github.com/jpadilla/pyjwt
|
||||
Author: Jose Padilla
|
||||
Author-email: hello@jpadilla.com
|
||||
License: MIT
|
||||
Keywords: jwt json web token security signing
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Natural Language :: English
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Topic :: Utilities
|
||||
Provides-Extra: crypto
|
||||
Requires-Dist: cryptography (>=1.4) ; extra == 'crypto'
|
||||
Provides-Extra: flake8
|
||||
Requires-Dist: flake8 ; extra == 'flake8'
|
||||
Requires-Dist: flake8-import-order ; extra == 'flake8'
|
||||
Requires-Dist: pep8-naming ; extra == 'flake8'
|
||||
Provides-Extra: test
|
||||
Requires-Dist: pytest (<5.0.0,>=4.0.1) ; extra == 'test'
|
||||
Requires-Dist: pytest-cov (<3.0.0,>=2.6.0) ; extra == 'test'
|
||||
Requires-Dist: pytest-runner (<5.0.0,>=4.2) ; extra == 'test'
|
||||
|
||||
PyJWT
|
||||
=====
|
||||
|
||||
.. image:: https://travis-ci.com/jpadilla/pyjwt.svg?branch=master
|
||||
:target: http://travis-ci.com/jpadilla/pyjwt?branch=master
|
||||
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/h8nt70aqtwhht39t?svg=true
|
||||
:target: https://ci.appveyor.com/project/jpadilla/pyjwt
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/pyjwt.svg
|
||||
:target: https://pypi.python.org/pypi/pyjwt
|
||||
|
||||
.. image:: https://coveralls.io/repos/jpadilla/pyjwt/badge.svg?branch=master
|
||||
:target: https://coveralls.io/r/jpadilla/pyjwt?branch=master
|
||||
|
||||
.. image:: https://readthedocs.org/projects/pyjwt/badge/?version=latest
|
||||
:target: https://pyjwt.readthedocs.io
|
||||
|
||||
A Python implementation of `RFC 7519 <https://tools.ietf.org/html/rfc7519>`_. Original implementation was written by `@progrium <https://github.com/progrium>`_.
|
||||
|
||||
Sponsor
|
||||
-------
|
||||
|
||||
+--------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
| |auth0-logo| | If you want to quickly add secure token-based authentication to Python projects, feel free to check Auth0's Python SDK and free plan at `auth0.com/overview <https://auth0.com/overview?utm_source=GHsponsor&utm_medium=GHsponsor&utm_campaign=pyjwt&utm_content=auth>`_. |
|
||||
+--------------+-----------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
.. |auth0-logo| image:: https://user-images.githubusercontent.com/83319/31722733-de95bbde-b3ea-11e7-96bf-4f4e8f915588.png
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install with **pip**:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ pip install PyJWT
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
.. code:: python
|
||||
|
||||
>>> import jwt
|
||||
>>> encoded = jwt.encode({'some': 'payload'}, 'secret', algorithm='HS256')
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzb21lIjoicGF5bG9hZCJ9.4twFt5NiznN84AWoo1d7KO1T_yoc0Z6XOpOVswacPZg'
|
||||
|
||||
>>> jwt.decode(encoded, 'secret', algorithms=['HS256'])
|
||||
{'some': 'payload'}
|
||||
|
||||
|
||||
Command line
|
||||
------------
|
||||
|
||||
Usage::
|
||||
|
||||
pyjwt [options] INPUT
|
||||
|
||||
Decoding examples::
|
||||
|
||||
pyjwt --key=secret decode TOKEN
|
||||
pyjwt decode --no-verify TOKEN
|
||||
|
||||
See more options executing ``pyjwt --help``.
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
View the full docs online at https://pyjwt.readthedocs.io/en/latest/
|
||||
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
You can run tests from the project root after cloning with:
|
||||
|
||||
.. code-block:: sh
|
||||
|
||||
$ python setup.py test
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
../../../bin/pyjwt,sha256=PCkYIW_oZhNK7IpeWJBPuOZw-y0nPlX3W32oJdsh5z8,253
|
||||
PyJWT-1.7.1.dist-info/AUTHORS,sha256=rahh5ZJ3f4RSF4X1_K1DvxTRm4Hy45QiMP7dDG_-yrE,595
|
||||
PyJWT-1.7.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
PyJWT-1.7.1.dist-info/LICENSE,sha256=7IKvgVtfnahoWvswDMW-t5SeHCK3m2wcBUeWzv32ysY,1080
|
||||
PyJWT-1.7.1.dist-info/METADATA,sha256=wIohFuzbkeGUiMkkD5U98z520aUoY6UnmsfDl4vVHRI,3878
|
||||
PyJWT-1.7.1.dist-info/RECORD,,
|
||||
PyJWT-1.7.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
PyJWT-1.7.1.dist-info/WHEEL,sha256=_wJFdOYk7i3xxT8ElOkUJvOdOvfNGbR9g-bf6UQT6sU,110
|
||||
PyJWT-1.7.1.dist-info/entry_points.txt,sha256=Xl_tLkGbTgywYa7PwaEY2xSiCtVtM2PdHTL4CW_n9dM,45
|
||||
PyJWT-1.7.1.dist-info/top_level.txt,sha256=RP5DHNyJbMq2ka0FmfTgoSaQzh7e3r5XuCWCO8a00k8,4
|
||||
jwt/__init__.py,sha256=zzpUkNjnVRNWZKLBgn-t3fR3IWVdCWekrAKtsZWkCoQ,810
|
||||
jwt/__main__.py,sha256=_rMsGakpyw1N023P8QOjCgbCxhXSCNIg92YpmUhQGMk,4162
|
||||
jwt/__pycache__/__init__.cpython-37.pyc,,
|
||||
jwt/__pycache__/__main__.cpython-37.pyc,,
|
||||
jwt/__pycache__/algorithms.cpython-37.pyc,,
|
||||
jwt/__pycache__/api_jws.cpython-37.pyc,,
|
||||
jwt/__pycache__/api_jwt.cpython-37.pyc,,
|
||||
jwt/__pycache__/compat.cpython-37.pyc,,
|
||||
jwt/__pycache__/exceptions.cpython-37.pyc,,
|
||||
jwt/__pycache__/help.cpython-37.pyc,,
|
||||
jwt/__pycache__/utils.cpython-37.pyc,,
|
||||
jwt/algorithms.py,sha256=kL1ARjxNL8JeuxEpWS8On14qJWomMX_A_ncIrnZhBrA,13336
|
||||
jwt/api_jws.py,sha256=wQxbg_cYR4hAJl4-9Ijf29B46NrOKhruXS7ANPFqkZ8,8095
|
||||
jwt/api_jwt.py,sha256=NKRiCsTcMd0B5N-74zvqBYpQuxBxC4f6TCLM6P0jxVU,7905
|
||||
jwt/compat.py,sha256=VG2zhmZFQ5spP0AThSVumRogymUXORz6fxA1jTew-cA,1624
|
||||
jwt/contrib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
jwt/contrib/__pycache__/__init__.cpython-37.pyc,,
|
||||
jwt/contrib/algorithms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
jwt/contrib/algorithms/__pycache__/__init__.cpython-37.pyc,,
|
||||
jwt/contrib/algorithms/__pycache__/py_ecdsa.cpython-37.pyc,,
|
||||
jwt/contrib/algorithms/__pycache__/pycrypto.cpython-37.pyc,,
|
||||
jwt/contrib/algorithms/py_ecdsa.py,sha256=tSTUrwx-u14DJcqAChRzJG-wf7bEY2Gv2hI5xSZZNjk,1771
|
||||
jwt/contrib/algorithms/pycrypto.py,sha256=mU3vRfk9QKj06ky3XXKXNkxv8-R4mBHbFR3EvbOgJ6k,1249
|
||||
jwt/exceptions.py,sha256=kGq96NMkyPBmx7-RXvLXq9ddTo2_SJPKPTpPscvGUuA,986
|
||||
jwt/help.py,sha256=w9sYBatZK8-DIAxLPsdxQBVHXnqjOTETJ4dFY5hhEHs,1609
|
||||
jwt/utils.py,sha256=RraFiloy_xsB8NA1CrlHxS9lR73If8amInQ3P1mKXeM,2629
|
||||
@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.32.3)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
[console_scripts]
|
||||
pyjwt = jwt.__main__:main
|
||||
|
||||
@ -0,0 +1 @@
|
||||
jwt
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2010, 2013 PyMySQL contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
@ -0,0 +1,189 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: PyMySQL
|
||||
Version: 0.10.1
|
||||
Summary: Pure Python MySQL Driver
|
||||
Home-page: https://github.com/PyMySQL/PyMySQL/
|
||||
Author: yutaka.matsubara
|
||||
Author-email: yutaka.matsubara@gmail.com
|
||||
Maintainer: Inada Naoki
|
||||
Maintainer-email: songofacandy@gmail.com
|
||||
License: "MIT"
|
||||
Project-URL: Documentation, https://pymysql.readthedocs.io/
|
||||
Keywords: MySQL
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Topic :: Database
|
||||
Provides-Extra: ed25519
|
||||
Requires-Dist: PyNaCl (>=1.4.0) ; extra == 'ed25519'
|
||||
Provides-Extra: rsa
|
||||
Requires-Dist: cryptography ; extra == 'rsa'
|
||||
|
||||
.. image:: https://readthedocs.org/projects/pymysql/badge/?version=latest
|
||||
:target: https://pymysql.readthedocs.io/
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://badge.fury.io/py/PyMySQL.svg
|
||||
:target: https://badge.fury.io/py/PyMySQL
|
||||
|
||||
.. image:: https://travis-ci.org/PyMySQL/PyMySQL.svg?branch=master
|
||||
:target: https://travis-ci.org/PyMySQL/PyMySQL
|
||||
|
||||
.. image:: https://coveralls.io/repos/PyMySQL/PyMySQL/badge.svg?branch=master&service=github
|
||||
:target: https://coveralls.io/github/PyMySQL/PyMySQL?branch=master
|
||||
|
||||
.. image:: https://img.shields.io/badge/license-MIT-blue.svg
|
||||
:target: https://github.com/PyMySQL/PyMySQL/blob/master/LICENSE
|
||||
|
||||
|
||||
PyMySQL
|
||||
=======
|
||||
|
||||
.. contents:: Table of Contents
|
||||
:local:
|
||||
|
||||
This package contains a pure-Python MySQL client library, based on `PEP 249`_.
|
||||
|
||||
Most public APIs are compatible with mysqlclient and MySQLdb.
|
||||
|
||||
NOTE: PyMySQL doesn't support low level APIs `_mysql` provides like `data_seek`,
|
||||
`store_result`, and `use_result`. You should use high level APIs defined in `PEP 249`_.
|
||||
But some APIs like `autocommit` and `ping` are supported because `PEP 249`_ doesn't cover
|
||||
their usecase.
|
||||
|
||||
.. _`PEP 249`: https://www.python.org/dev/peps/pep-0249/
|
||||
|
||||
|
||||
Requirements
|
||||
-------------
|
||||
|
||||
* Python -- one of the following:
|
||||
|
||||
- CPython_ : 2.7 and >= 3.5
|
||||
- PyPy_ : Latest version
|
||||
|
||||
* MySQL Server -- one of the following:
|
||||
|
||||
- MySQL_ >= 5.5
|
||||
- MariaDB_ >= 5.5
|
||||
|
||||
.. _CPython: https://www.python.org/
|
||||
.. _PyPy: https://pypy.org/
|
||||
.. _MySQL: https://www.mysql.com/
|
||||
.. _MariaDB: https://mariadb.org/
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Package is uploaded on `PyPI <https://pypi.org/project/PyMySQL>`_.
|
||||
|
||||
You can install it with pip::
|
||||
|
||||
$ python3 -m pip install PyMySQL
|
||||
|
||||
To use "sha256_password" or "caching_sha2_password" for authenticate,
|
||||
you need to install additional dependency::
|
||||
|
||||
$ python3 -m pip install PyMySQL[rsa]
|
||||
|
||||
To use MariaDB's "ed25519" authentication method, you need to install
|
||||
additional dependency::
|
||||
|
||||
$ python3 -m pip install PyMySQL[ed25519]
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Documentation is available online: https://pymysql.readthedocs.io/
|
||||
|
||||
For support, please refer to the `StackOverflow
|
||||
<https://stackoverflow.com/questions/tagged/pymysql>`_.
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
The following examples make use of a simple table
|
||||
|
||||
.. code:: sql
|
||||
|
||||
CREATE TABLE `users` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`email` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
`password` varchar(255) COLLATE utf8_bin NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin
|
||||
AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
.. code:: python
|
||||
|
||||
import pymysql.cursors
|
||||
|
||||
# Connect to the database
|
||||
connection = pymysql.connect(host='localhost',
|
||||
user='user',
|
||||
password='passwd',
|
||||
db='db',
|
||||
charset='utf8mb4',
|
||||
cursorclass=pymysql.cursors.DictCursor)
|
||||
|
||||
try:
|
||||
with connection.cursor() as cursor:
|
||||
# Create a new record
|
||||
sql = "INSERT INTO `users` (`email`, `password`) VALUES (%s, %s)"
|
||||
cursor.execute(sql, ('webmaster@python.org', 'very-secret'))
|
||||
|
||||
# connection is not autocommit by default. So you must commit to save
|
||||
# your changes.
|
||||
connection.commit()
|
||||
|
||||
with connection.cursor() as cursor:
|
||||
# Read a single record
|
||||
sql = "SELECT `id`, `password` FROM `users` WHERE `email`=%s"
|
||||
cursor.execute(sql, ('webmaster@python.org',))
|
||||
result = cursor.fetchone()
|
||||
print(result)
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
This example will print:
|
||||
|
||||
.. code:: python
|
||||
|
||||
{'password': 'very-secret', 'id': 1}
|
||||
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
* DB-API 2.0: https://www.python.org/dev/peps/pep-0249/
|
||||
|
||||
* MySQL Reference Manuals: https://dev.mysql.com/doc/
|
||||
|
||||
* MySQL client/server protocol:
|
||||
https://dev.mysql.com/doc/internals/en/client-server-protocol.html
|
||||
|
||||
* "Connector" channel in MySQL Community Slack:
|
||||
https://lefred.be/mysql-community-on-slack/
|
||||
|
||||
* PyMySQL mailing list: https://groups.google.com/forum/#!forum/pymysql-users
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
PyMySQL is released under the MIT License. See LICENSE for more information.
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
PyMySQL-0.10.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
PyMySQL-0.10.1.dist-info/LICENSE,sha256=MUEg3GXwgA9ziksxQAx27hTezR--d86cNUCkIbhup7Y,1070
|
||||
PyMySQL-0.10.1.dist-info/METADATA,sha256=SP0KPSfmgNJ2ujhGRrRRiWOodzv62BfYnbY1OXX3DTI,5481
|
||||
PyMySQL-0.10.1.dist-info/RECORD,,
|
||||
PyMySQL-0.10.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
PyMySQL-0.10.1.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
|
||||
PyMySQL-0.10.1.dist-info/pbr.json,sha256=Lqvh8-9N7qS6SLUlEJ5GDLWioQcvR9n1WWjMEfJ5mv8,47
|
||||
PyMySQL-0.10.1.dist-info/top_level.txt,sha256=IKlV-f4o90sOdnMd6HBvo0l2nqfJOGUzkwZeaEEGuRg,8
|
||||
pymysql/__init__.py,sha256=KDHcmnEoEDMmRPNO5JFcxb7lsypDmwGn5Td-f-X6xDY,4733
|
||||
pymysql/__pycache__/__init__.cpython-37.pyc,,
|
||||
pymysql/__pycache__/_auth.cpython-37.pyc,,
|
||||
pymysql/__pycache__/_compat.cpython-37.pyc,,
|
||||
pymysql/__pycache__/_socketio.cpython-37.pyc,,
|
||||
pymysql/__pycache__/charset.cpython-37.pyc,,
|
||||
pymysql/__pycache__/connections.cpython-37.pyc,,
|
||||
pymysql/__pycache__/converters.cpython-37.pyc,,
|
||||
pymysql/__pycache__/cursors.cpython-37.pyc,,
|
||||
pymysql/__pycache__/err.cpython-37.pyc,,
|
||||
pymysql/__pycache__/optionfile.cpython-37.pyc,,
|
||||
pymysql/__pycache__/protocol.cpython-37.pyc,,
|
||||
pymysql/__pycache__/times.cpython-37.pyc,,
|
||||
pymysql/__pycache__/util.cpython-37.pyc,,
|
||||
pymysql/_auth.py,sha256=pEeHBpQ15h2wfj6k7np6LVHVz34whEXSs5KrqeYtDGw,9564
|
||||
pymysql/_compat.py,sha256=DSxMV2ib-rhIuQIKiXX44yds_0bN2M_RddfYQiSdB6U,481
|
||||
pymysql/_socketio.py,sha256=smsw4wudNM4CKl85uis8QHfjDhz2iXQRvl8QV4TmB1w,4049
|
||||
pymysql/charset.py,sha256=zaaRbEQrFiE0iCd3AB52WJY9VqVxQcp8sYcoPDlPdWI,10308
|
||||
pymysql/connections.py,sha256=xR0gWxvQ6IxBcFhY9JPmYRCcvs6xSnRKUq-DZ6MpfNY,49010
|
||||
pymysql/constants/CLIENT.py,sha256=cPMxnQQbBG6xqaEDwqzggTfWIuJQ1Oy7HrIgw_vgpo4,853
|
||||
pymysql/constants/COMMAND.py,sha256=ypGdEUmi8m9cdBZ3rDU6mb7bsIyu9ldCDvc4pNF7V70,680
|
||||
pymysql/constants/CR.py,sha256=5ojVkbisyw7Qo_cTNpnHYvV6xHRZXK39Qqv8tjGbIbg,2228
|
||||
pymysql/constants/ER.py,sha256=cH5wgU-e70wd0uSygNR5IFCnnXcrR9WLwJPMH22bhUw,12296
|
||||
pymysql/constants/FIELD_TYPE.py,sha256=yHZLSyQewMxTDx4PLrI1H_iwH2FnsrgBZFa56UG2HiQ,372
|
||||
pymysql/constants/FLAG.py,sha256=Fy-PrCLnUI7fx_o5WypYnUAzWAM0E9d5yL8fFRVKffY,214
|
||||
pymysql/constants/SERVER_STATUS.py,sha256=KogVCOrV-S5aAFwyVKeKgua13nwdt1WFyHagjCZbcpM,334
|
||||
pymysql/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
pymysql/constants/__pycache__/CLIENT.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/COMMAND.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/CR.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/ER.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/FIELD_TYPE.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/FLAG.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/SERVER_STATUS.cpython-37.pyc,,
|
||||
pymysql/constants/__pycache__/__init__.cpython-37.pyc,,
|
||||
pymysql/converters.py,sha256=kUT2KQdkqNTuSxzURVnQKS1ZcatoFTUfYe5b5QSJuRI,11055
|
||||
pymysql/cursors.py,sha256=eiP_oTDi1MM5EYLHoecwbv5BXWJ1qEjfK8Uy3SjGEcs,16250
|
||||
pymysql/err.py,sha256=Vdrt2rVaSePVlB_uy0JNoeN6zYBt0_mM1UFDighLgNM,3734
|
||||
pymysql/optionfile.py,sha256=4yW8A7aAR2Aild7ibLOCzIlTCcYd90PtR8LRGJSZs8o,658
|
||||
pymysql/protocol.py,sha256=9hAfVK-g4i53gHMoGj9QrPApywMYVM8oxGAuKb_-PXo,12071
|
||||
pymysql/times.py,sha256=_qXgDaYwsHntvpIKSKXp1rrYIgtq6Z9pLyLnO2XNoL0,360
|
||||
pymysql/util.py,sha256=jKPts8cOMIXDndjsV3783VW-iq9uMxETWqfHP6Bd-Zo,180
|
||||
@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.34.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1 @@
|
||||
{"is_release": false, "git_version": "08bac52"}
|
||||
@ -0,0 +1 @@
|
||||
pymysql
|
||||
@ -0,0 +1,123 @@
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import importlib
|
||||
import warnings
|
||||
|
||||
|
||||
is_pypy = '__pypy__' in sys.builtin_module_names
|
||||
|
||||
|
||||
def warn_distutils_present():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
if is_pypy and sys.version_info < (3, 7):
|
||||
# PyPy for 3.6 unconditionally imports distutils, so bypass the warning
|
||||
# https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
|
||||
return
|
||||
warnings.warn(
|
||||
"Distutils was imported before Setuptools, but importing Setuptools "
|
||||
"also replaces the `distutils` module in `sys.modules`. This may lead "
|
||||
"to undesirable behaviors or errors. To avoid these issues, avoid "
|
||||
"using distutils directly, ensure that setuptools is installed in the "
|
||||
"traditional way (e.g. not an editable install), and/or make sure "
|
||||
"that setuptools is always imported before distutils.")
|
||||
|
||||
|
||||
def clear_distutils():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
warnings.warn("Setuptools is replacing distutils.")
|
||||
mods = [name for name in sys.modules if re.match(r'distutils\b', name)]
|
||||
for name in mods:
|
||||
del sys.modules[name]
|
||||
|
||||
|
||||
def enabled():
|
||||
"""
|
||||
Allow selection of distutils by environment variable.
|
||||
"""
|
||||
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'stdlib')
|
||||
return which == 'local'
|
||||
|
||||
|
||||
def ensure_local_distutils():
|
||||
clear_distutils()
|
||||
distutils = importlib.import_module('setuptools._distutils')
|
||||
distutils.__name__ = 'distutils'
|
||||
sys.modules['distutils'] = distutils
|
||||
|
||||
# sanity check that submodules load as expected
|
||||
core = importlib.import_module('distutils.core')
|
||||
assert '_distutils' in core.__file__, core.__file__
|
||||
|
||||
|
||||
def do_override():
|
||||
"""
|
||||
Ensure that the local copy of distutils is preferred over stdlib.
|
||||
|
||||
See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
|
||||
for more motivation.
|
||||
"""
|
||||
if enabled():
|
||||
warn_distutils_present()
|
||||
ensure_local_distutils()
|
||||
|
||||
|
||||
class DistutilsMetaFinder:
|
||||
def find_spec(self, fullname, path, target=None):
|
||||
if path is not None:
|
||||
return
|
||||
|
||||
method_name = 'spec_for_{fullname}'.format(**locals())
|
||||
method = getattr(self, method_name, lambda: None)
|
||||
return method()
|
||||
|
||||
def spec_for_distutils(self):
|
||||
import importlib.abc
|
||||
import importlib.util
|
||||
|
||||
class DistutilsLoader(importlib.abc.Loader):
|
||||
|
||||
def create_module(self, spec):
|
||||
return importlib.import_module('setuptools._distutils')
|
||||
|
||||
def exec_module(self, module):
|
||||
pass
|
||||
|
||||
return importlib.util.spec_from_loader('distutils', DistutilsLoader())
|
||||
|
||||
def spec_for_pip(self):
|
||||
"""
|
||||
Ensure stdlib distutils when running under pip.
|
||||
See pypa/pip#8761 for rationale.
|
||||
"""
|
||||
if self.pip_imported_during_build():
|
||||
return
|
||||
clear_distutils()
|
||||
self.spec_for_distutils = lambda: None
|
||||
|
||||
@staticmethod
|
||||
def pip_imported_during_build():
|
||||
"""
|
||||
Detect if pip is being imported in a build script. Ref #2355.
|
||||
"""
|
||||
import traceback
|
||||
return any(
|
||||
frame.f_globals['__file__'].endswith('setup.py')
|
||||
for frame, line in traceback.walk_stack(None)
|
||||
)
|
||||
|
||||
|
||||
DISTUTILS_FINDER = DistutilsMetaFinder()
|
||||
|
||||
|
||||
def add_shim():
|
||||
sys.meta_path.insert(0, DISTUTILS_FINDER)
|
||||
|
||||
|
||||
def remove_shim():
|
||||
try:
|
||||
sys.meta_path.remove(DISTUTILS_FINDER)
|
||||
except ValueError:
|
||||
pass
|
||||
@ -0,0 +1 @@
|
||||
__import__('_distutils_hack').do_override()
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,27 @@
|
||||
Copyright (c) Django Software Foundation and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Django nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@ -0,0 +1,234 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: asgiref
|
||||
Version: 3.3.1
|
||||
Summary: ASGI specs, helper code, and adapters
|
||||
Home-page: https://github.com/django/asgiref/
|
||||
Author: Django Software Foundation
|
||||
Author-email: foundation@djangoproject.com
|
||||
License: BSD
|
||||
Project-URL: Documentation, https://asgi.readthedocs.io/
|
||||
Project-URL: Further Documentation, https://docs.djangoproject.com/en/stable/topics/async/#async-adapter-functions
|
||||
Project-URL: Changelog, https://github.com/django/asgiref/blob/master/CHANGELOG.txt
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
Classifier: Topic :: Internet :: WWW/HTTP
|
||||
Requires-Python: >=3.5
|
||||
Provides-Extra: tests
|
||||
Requires-Dist: pytest ; extra == 'tests'
|
||||
Requires-Dist: pytest-asyncio ; extra == 'tests'
|
||||
|
||||
asgiref
|
||||
=======
|
||||
|
||||
.. image:: https://api.travis-ci.org/django/asgiref.svg
|
||||
:target: https://travis-ci.org/django/asgiref
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/asgiref.svg
|
||||
:target: https://pypi.python.org/pypi/asgiref
|
||||
|
||||
ASGI is a standard for Python asynchronous web apps and servers to communicate
|
||||
with each other, and positioned as an asynchronous successor to WSGI. You can
|
||||
read more at https://asgi.readthedocs.io/en/latest/
|
||||
|
||||
This package includes ASGI base libraries, such as:
|
||||
|
||||
* Sync-to-async and async-to-sync function wrappers, ``asgiref.sync``
|
||||
* Server base classes, ``asgiref.server``
|
||||
* A WSGI-to-ASGI adapter, in ``asgiref.wsgi``
|
||||
|
||||
|
||||
Function wrappers
|
||||
-----------------
|
||||
|
||||
These allow you to wrap or decorate async or sync functions to call them from
|
||||
the other style (so you can call async functions from a synchronous thread,
|
||||
or vice-versa).
|
||||
|
||||
In particular:
|
||||
|
||||
* AsyncToSync lets a synchronous subthread stop and wait while the async
|
||||
function is called on the main thread's event loop, and then control is
|
||||
returned to the thread when the async function is finished.
|
||||
|
||||
* SyncToAsync lets async code call a synchronous function, which is run in
|
||||
a threadpool and control returned to the async coroutine when the synchronous
|
||||
function completes.
|
||||
|
||||
The idea is to make it easier to call synchronous APIs from async code and
|
||||
asynchronous APIs from synchronous code so it's easier to transition code from
|
||||
one style to the other. In the case of Channels, we wrap the (synchronous)
|
||||
Django view system with SyncToAsync to allow it to run inside the (asynchronous)
|
||||
ASGI server.
|
||||
|
||||
Note that exactly what threads things run in is very specific, and aimed to
|
||||
keep maximum compatibility with old synchronous code. See
|
||||
"Synchronous code & Threads" below for a full explanation. By default,
|
||||
``sync_to_async`` will run all synchronous code in the program in the same
|
||||
thread for safety reasons; you can disable this for more performance with
|
||||
``@sync_to_async(thread_sensitive=False)``, but make sure that your code does
|
||||
not rely on anything bound to threads (like database connections) when you do.
|
||||
|
||||
|
||||
Threadlocal replacement
|
||||
-----------------------
|
||||
|
||||
This is a drop-in replacement for ``threading.local`` that works with both
|
||||
threads and asyncio Tasks. Even better, it will proxy values through from a
|
||||
task-local context to a thread-local context when you use ``sync_to_async``
|
||||
to run things in a threadpool, and vice-versa for ``async_to_sync``.
|
||||
|
||||
If you instead want true thread- and task-safety, you can set
|
||||
``thread_critical`` on the Local object to ensure this instead.
|
||||
|
||||
|
||||
Server base classes
|
||||
-------------------
|
||||
|
||||
Includes a ``StatelessServer`` class which provides all the hard work of
|
||||
writing a stateless server (as in, does not handle direct incoming sockets
|
||||
but instead consumes external streams or sockets to work out what is happening).
|
||||
|
||||
An example of such a server would be a chatbot server that connects out to
|
||||
a central chat server and provides a "connection scope" per user chatting to
|
||||
it. There's only one actual connection, but the server has to separate things
|
||||
into several scopes for easier writing of the code.
|
||||
|
||||
You can see an example of this being used in `frequensgi <https://github.com/andrewgodwin/frequensgi>`_.
|
||||
|
||||
|
||||
WSGI-to-ASGI adapter
|
||||
--------------------
|
||||
|
||||
Allows you to wrap a WSGI application so it appears as a valid ASGI application.
|
||||
|
||||
Simply wrap it around your WSGI application like so::
|
||||
|
||||
asgi_application = WsgiToAsgi(wsgi_application)
|
||||
|
||||
The WSGI application will be run in a synchronous threadpool, and the wrapped
|
||||
ASGI application will be one that accepts ``http`` class messages.
|
||||
|
||||
Please note that not all extended features of WSGI may be supported (such as
|
||||
file handles for incoming POST bodies).
|
||||
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
``asgiref`` requires Python 3.5 or higher.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Please refer to the
|
||||
`main Channels contributing docs <https://github.com/django/channels/blob/master/CONTRIBUTING.rst>`_.
|
||||
|
||||
|
||||
Testing
|
||||
'''''''
|
||||
|
||||
To run tests, make sure you have installed the ``tests`` extra with the package::
|
||||
|
||||
cd asgiref/
|
||||
pip install -e .[tests]
|
||||
pytest
|
||||
|
||||
|
||||
Building the documentation
|
||||
''''''''''''''''''''''''''
|
||||
|
||||
The documentation uses `Sphinx <http://www.sphinx-doc.org>`_::
|
||||
|
||||
cd asgiref/docs/
|
||||
pip install sphinx
|
||||
|
||||
To build the docs, you can use the default tools::
|
||||
|
||||
sphinx-build -b html . _build/html # or `make html`, if you've got make set up
|
||||
cd _build/html
|
||||
python -m http.server
|
||||
|
||||
...or you can use ``sphinx-autobuild`` to run a server and rebuild/reload
|
||||
your documentation changes automatically::
|
||||
|
||||
pip install sphinx-autobuild
|
||||
sphinx-autobuild . _build/html
|
||||
|
||||
|
||||
Implementation Details
|
||||
----------------------
|
||||
|
||||
Synchronous code & threads
|
||||
''''''''''''''''''''''''''
|
||||
|
||||
The ``asgiref.sync`` module provides two wrappers that let you go between
|
||||
asynchronous and synchronous code at will, while taking care of the rough edges
|
||||
for you.
|
||||
|
||||
Unfortunately, the rough edges are numerous, and the code has to work especially
|
||||
hard to keep things in the same thread as much as possible. Notably, the
|
||||
restrictions we are working with are:
|
||||
|
||||
* All synchronous code called through ``SyncToAsync`` and marked with
|
||||
``thread_sensitive`` should run in the same thread as each other (and if the
|
||||
outer layer of the program is synchronous, the main thread)
|
||||
|
||||
* If a thread already has a running async loop, ``AsyncToSync`` can't run things
|
||||
on that loop if it's blocked on synchronous code that is above you in the
|
||||
call stack.
|
||||
|
||||
The first compromise you get to might be that ``thread_sensitive`` code should
|
||||
just run in the same thread and not spawn in a sub-thread, fulfilling the first
|
||||
restriction, but that immediately runs you into the second restriction.
|
||||
|
||||
The only real solution is to essentially have a variant of ThreadPoolExecutor
|
||||
that executes any ``thread_sensitive`` code on the outermost synchronous
|
||||
thread - either the main thread, or a single spawned subthread.
|
||||
|
||||
This means you now have two basic states:
|
||||
|
||||
* If the outermost layer of your program is synchronous, then all async code
|
||||
run through ``AsyncToSync`` will run in a per-call event loop in arbitrary
|
||||
sub-threads, while all ``thread_sensitive`` code will run in the main thread.
|
||||
|
||||
* If the outermost layer of your program is asynchronous, then all async code
|
||||
runs on the main thread's event loop, and all ``thread_sensitive`` synchronous
|
||||
code will run in a single shared sub-thread.
|
||||
|
||||
Cruicially, this means that in both cases there is a thread which is a shared
|
||||
resource that all ``thread_sensitive`` code must run on, and there is a chance
|
||||
that this thread is currently blocked on its own ``AsyncToSync`` call. Thus,
|
||||
``AsyncToSync`` needs to act as an executor for thread code while it's blocking.
|
||||
|
||||
The ``CurrentThreadExecutor`` class provides this functionality; rather than
|
||||
simply waiting on a Future, you can call its ``run_until_future`` method and
|
||||
it will run submitted code until that Future is done. This means that code
|
||||
inside the call can then run code on your thread.
|
||||
|
||||
|
||||
Maintenance and Security
|
||||
------------------------
|
||||
|
||||
To report security issues, please contact security@djangoproject.com. For GPG
|
||||
signatures and more security process information, see
|
||||
https://docs.djangoproject.com/en/dev/internals/security/.
|
||||
|
||||
To report bugs or request new features, please open a new GitHub issue.
|
||||
|
||||
This repository is part of the Channels project. For the shepherd and maintenance team, please see the
|
||||
`main Channels readme <https://github.com/django/channels/blob/master/README.rst>`_.
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
asgiref-3.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
asgiref-3.3.1.dist-info/LICENSE,sha256=uEZBXRtRTpwd_xSiLeuQbXlLxUbKYSn5UKGM0JHipmk,1552
|
||||
asgiref-3.3.1.dist-info/METADATA,sha256=U_oV2OlELCovSyEWthXIbtxCz8EJ8cNAmYhPyzJeurE,8851
|
||||
asgiref-3.3.1.dist-info/RECORD,,
|
||||
asgiref-3.3.1.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
|
||||
asgiref-3.3.1.dist-info/top_level.txt,sha256=bokQjCzwwERhdBiPdvYEZa4cHxT4NCeAffQNUqJ8ssg,8
|
||||
asgiref/__init__.py,sha256=XErusAMGUPwBUpdA6BLyq8CjU-6n6gLlBRymgSC8Y-0,22
|
||||
asgiref/__pycache__/__init__.cpython-37.pyc,,
|
||||
asgiref/__pycache__/compatibility.cpython-37.pyc,,
|
||||
asgiref/__pycache__/current_thread_executor.cpython-37.pyc,,
|
||||
asgiref/__pycache__/local.cpython-37.pyc,,
|
||||
asgiref/__pycache__/server.cpython-37.pyc,,
|
||||
asgiref/__pycache__/sync.cpython-37.pyc,,
|
||||
asgiref/__pycache__/testing.cpython-37.pyc,,
|
||||
asgiref/__pycache__/timeout.cpython-37.pyc,,
|
||||
asgiref/__pycache__/wsgi.cpython-37.pyc,,
|
||||
asgiref/compatibility.py,sha256=MVH2bEdiCMMVTLbE-1V6KiU7q4LwqzP7PIufeXa-njM,1598
|
||||
asgiref/current_thread_executor.py,sha256=3dRFt3jAl_x1wr9prZZMut071pmdHdIwbTnUAYVejj4,2974
|
||||
asgiref/local.py,sha256=7g_PSo5vqd-KRkO7SOgoktSWr85Etsi4rqJyF1VUXhw,4849
|
||||
asgiref/server.py,sha256=dsOajgUgyly2E0Q0U82DG_iW3eK0cOX6pZqfvaF3WJI,6012
|
||||
asgiref/sync.py,sha256=SLo17i8mtyjvoVCDIb2D8BtP6l0NtRayjcivnh-i0CY,14101
|
||||
asgiref/testing.py,sha256=3byNRV7Oto_Fg8Z-fErQJ3yGf7OQlcUexbN_cDQugzQ,3119
|
||||
asgiref/timeout.py,sha256=Emw-Oop1pRfSc5YSMEYHgEz1802mP6JdA6bxH37bby8,3914
|
||||
asgiref/wsgi.py,sha256=-L0eo_uK_dq7EPjv1meW1BRGytURaO9NPESxnJc9CtA,6575
|
||||
@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.34.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1 @@
|
||||
asgiref
|
||||
@ -0,0 +1 @@
|
||||
__version__ = "3.3.1"
|
||||
@ -0,0 +1,47 @@
|
||||
import asyncio
|
||||
import inspect
|
||||
|
||||
|
||||
def is_double_callable(application):
|
||||
"""
|
||||
Tests to see if an application is a legacy-style (double-callable) application.
|
||||
"""
|
||||
# Look for a hint on the object first
|
||||
if getattr(application, "_asgi_single_callable", False):
|
||||
return False
|
||||
if getattr(application, "_asgi_double_callable", False):
|
||||
return True
|
||||
# Uninstanted classes are double-callable
|
||||
if inspect.isclass(application):
|
||||
return True
|
||||
# Instanted classes depend on their __call__
|
||||
if hasattr(application, "__call__"):
|
||||
# We only check to see if its __call__ is a coroutine function -
|
||||
# if it's not, it still might be a coroutine function itself.
|
||||
if asyncio.iscoroutinefunction(application.__call__):
|
||||
return False
|
||||
# Non-classes we just check directly
|
||||
return not asyncio.iscoroutinefunction(application)
|
||||
|
||||
|
||||
def double_to_single_callable(application):
|
||||
"""
|
||||
Transforms a double-callable ASGI application into a single-callable one.
|
||||
"""
|
||||
|
||||
async def new_application(scope, receive, send):
|
||||
instance = application(scope)
|
||||
return await instance(receive, send)
|
||||
|
||||
return new_application
|
||||
|
||||
|
||||
def guarantee_single_callable(application):
|
||||
"""
|
||||
Takes either a single- or double-callable application and always returns it
|
||||
in single-callable style. Use this to add backwards compatibility for ASGI
|
||||
2.0 applications to your server/test harness/etc.
|
||||
"""
|
||||
if is_double_callable(application):
|
||||
application = double_to_single_callable(application)
|
||||
return application
|
||||
@ -0,0 +1,86 @@
|
||||
import queue
|
||||
import threading
|
||||
import time
|
||||
from concurrent.futures import Executor, Future
|
||||
|
||||
|
||||
class _WorkItem(object):
|
||||
"""
|
||||
Represents an item needing to be run in the executor.
|
||||
Copied from ThreadPoolExecutor (but it's private, so we're not going to rely on importing it)
|
||||
"""
|
||||
|
||||
def __init__(self, future, fn, args, kwargs):
|
||||
self.future = future
|
||||
self.fn = fn
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def run(self):
|
||||
if not self.future.set_running_or_notify_cancel():
|
||||
return
|
||||
try:
|
||||
result = self.fn(*self.args, **self.kwargs)
|
||||
except BaseException as exc:
|
||||
self.future.set_exception(exc)
|
||||
# Break a reference cycle with the exception 'exc'
|
||||
self = None
|
||||
else:
|
||||
self.future.set_result(result)
|
||||
|
||||
|
||||
class CurrentThreadExecutor(Executor):
|
||||
"""
|
||||
An Executor that actually runs code in the thread it is instantiated in.
|
||||
Passed to other threads running async code, so they can run sync code in
|
||||
the thread they came from.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._work_thread = threading.current_thread()
|
||||
self._work_queue = queue.Queue()
|
||||
self._broken = False
|
||||
|
||||
def run_until_future(self, future):
|
||||
"""
|
||||
Runs the code in the work queue until a result is available from the future.
|
||||
Should be run from the thread the executor is initialised in.
|
||||
"""
|
||||
# Check we're in the right thread
|
||||
if threading.current_thread() != self._work_thread:
|
||||
raise RuntimeError(
|
||||
"You cannot run CurrentThreadExecutor from a different thread"
|
||||
)
|
||||
# Keep getting work items and checking the future
|
||||
try:
|
||||
while True:
|
||||
# Get a work item and run it
|
||||
try:
|
||||
work_item = self._work_queue.get(block=False)
|
||||
except queue.Empty:
|
||||
# See if the future is done (we only exit if the work queue is empty)
|
||||
if future.done():
|
||||
return
|
||||
# Prevent hot-looping on nothing
|
||||
time.sleep(0.001)
|
||||
else:
|
||||
work_item.run()
|
||||
del work_item
|
||||
finally:
|
||||
self._broken = True
|
||||
|
||||
def submit(self, fn, *args, **kwargs):
|
||||
# Check they're not submitting from the same thread
|
||||
if threading.current_thread() == self._work_thread:
|
||||
raise RuntimeError(
|
||||
"You cannot submit onto CurrentThreadExecutor from its own thread"
|
||||
)
|
||||
# Check they're not too late or the executor errored
|
||||
if self._broken:
|
||||
raise RuntimeError("CurrentThreadExecutor already quit or is broken")
|
||||
# Add to work queue
|
||||
f = Future()
|
||||
work_item = _WorkItem(f, fn, args, kwargs)
|
||||
self._work_queue.put(work_item)
|
||||
# Return the future
|
||||
return f
|
||||
122
django后端代码/venv/lib/python3.7/site-packages/asgiref/local.py
Normal file
122
django后端代码/venv/lib/python3.7/site-packages/asgiref/local.py
Normal file
@ -0,0 +1,122 @@
|
||||
import random
|
||||
import string
|
||||
import sys
|
||||
import threading
|
||||
import weakref
|
||||
|
||||
|
||||
class Local:
|
||||
"""
|
||||
A drop-in replacement for threading.locals that also works with asyncio
|
||||
Tasks (via the current_task asyncio method), and passes locals through
|
||||
sync_to_async and async_to_sync.
|
||||
|
||||
Specifically:
|
||||
- Locals work per-coroutine on any thread not spawned using asgiref
|
||||
- Locals work per-thread on any thread not spawned using asgiref
|
||||
- Locals are shared with the parent coroutine when using sync_to_async
|
||||
- Locals are shared with the parent thread when using async_to_sync
|
||||
(and if that thread was launched using sync_to_async, with its parent
|
||||
coroutine as well, with this working for indefinite levels of nesting)
|
||||
|
||||
Set thread_critical to True to not allow locals to pass from an async Task
|
||||
to a thread it spawns. This is needed for code that truly needs
|
||||
thread-safety, as opposed to things used for helpful context (e.g. sqlite
|
||||
does not like being called from a different thread to the one it is from).
|
||||
Thread-critical code will still be differentiated per-Task within a thread
|
||||
as it is expected it does not like concurrent access.
|
||||
|
||||
This doesn't use contextvars as it needs to support 3.6. Once it can support
|
||||
3.7 only, we can then reimplement the storage more nicely.
|
||||
"""
|
||||
|
||||
CLEANUP_INTERVAL = 60 # seconds
|
||||
|
||||
def __init__(self, thread_critical=False):
|
||||
self._thread_critical = thread_critical
|
||||
self._thread_lock = threading.RLock()
|
||||
self._context_refs = weakref.WeakSet()
|
||||
# Random suffixes stop accidental reuse between different Locals,
|
||||
# though we try to force deletion as well.
|
||||
self._attr_name = "_asgiref_local_impl_%s_%s" % (
|
||||
id(self),
|
||||
"".join(random.choice(string.ascii_letters) for i in range(8)),
|
||||
)
|
||||
|
||||
def _get_context_id(self):
|
||||
"""
|
||||
Get the ID we should use for looking up variables
|
||||
"""
|
||||
# Prevent a circular reference
|
||||
from .sync import AsyncToSync, SyncToAsync
|
||||
|
||||
# First, pull the current task if we can
|
||||
context_id = SyncToAsync.get_current_task()
|
||||
context_is_async = True
|
||||
# OK, let's try for a thread ID
|
||||
if context_id is None:
|
||||
context_id = threading.current_thread()
|
||||
context_is_async = False
|
||||
# If we're thread-critical, we stop here, as we can't share contexts.
|
||||
if self._thread_critical:
|
||||
return context_id
|
||||
# Now, take those and see if we can resolve them through the launch maps
|
||||
for i in range(sys.getrecursionlimit()):
|
||||
try:
|
||||
if context_is_async:
|
||||
# Tasks have a source thread in AsyncToSync
|
||||
context_id = AsyncToSync.launch_map[context_id]
|
||||
context_is_async = False
|
||||
else:
|
||||
# Threads have a source task in SyncToAsync
|
||||
context_id = SyncToAsync.launch_map[context_id]
|
||||
context_is_async = True
|
||||
except KeyError:
|
||||
break
|
||||
else:
|
||||
# Catch infinite loops (they happen if you are screwing around
|
||||
# with AsyncToSync implementations)
|
||||
raise RuntimeError("Infinite launch_map loops")
|
||||
return context_id
|
||||
|
||||
def _get_storage(self):
|
||||
context_obj = self._get_context_id()
|
||||
if not hasattr(context_obj, self._attr_name):
|
||||
setattr(context_obj, self._attr_name, {})
|
||||
self._context_refs.add(context_obj)
|
||||
return getattr(context_obj, self._attr_name)
|
||||
|
||||
def __del__(self):
|
||||
try:
|
||||
for context_obj in self._context_refs:
|
||||
try:
|
||||
delattr(context_obj, self._attr_name)
|
||||
except AttributeError:
|
||||
pass
|
||||
except TypeError:
|
||||
# WeakSet.__iter__ can crash when interpreter is shutting down due
|
||||
# to _IterationGuard being None.
|
||||
pass
|
||||
|
||||
def __getattr__(self, key):
|
||||
with self._thread_lock:
|
||||
storage = self._get_storage()
|
||||
if key in storage:
|
||||
return storage[key]
|
||||
else:
|
||||
raise AttributeError("%r object has no attribute %r" % (self, key))
|
||||
|
||||
def __setattr__(self, key, value):
|
||||
if key in ("_context_refs", "_thread_critical", "_thread_lock", "_attr_name"):
|
||||
return super().__setattr__(key, value)
|
||||
with self._thread_lock:
|
||||
storage = self._get_storage()
|
||||
storage[key] = value
|
||||
|
||||
def __delattr__(self, key):
|
||||
with self._thread_lock:
|
||||
storage = self._get_storage()
|
||||
if key in storage:
|
||||
del storage[key]
|
||||
else:
|
||||
raise AttributeError("%r object has no attribute %r" % (self, key))
|
||||
157
django后端代码/venv/lib/python3.7/site-packages/asgiref/server.py
Normal file
157
django后端代码/venv/lib/python3.7/site-packages/asgiref/server.py
Normal file
@ -0,0 +1,157 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from .compatibility import guarantee_single_callable
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class StatelessServer:
|
||||
"""
|
||||
Base server class that handles basic concepts like application instance
|
||||
creation/pooling, exception handling, and similar, for stateless protocols
|
||||
(i.e. ones without actual incoming connections to the process)
|
||||
|
||||
Your code should override the handle() method, doing whatever it needs to,
|
||||
and calling get_or_create_application_instance with a unique `scope_id`
|
||||
and `scope` for the scope it wants to get.
|
||||
|
||||
If an application instance is found with the same `scope_id`, you are
|
||||
given its input queue, otherwise one is made for you with the scope provided
|
||||
and you are given that fresh new input queue. Either way, you should do
|
||||
something like:
|
||||
|
||||
input_queue = self.get_or_create_application_instance(
|
||||
"user-123456",
|
||||
{"type": "testprotocol", "user_id": "123456", "username": "andrew"},
|
||||
)
|
||||
input_queue.put_nowait(message)
|
||||
|
||||
If you try and create an application instance and there are already
|
||||
`max_application` instances, the oldest/least recently used one will be
|
||||
reclaimed and shut down to make space.
|
||||
|
||||
Application coroutines that error will be found periodically (every 100ms
|
||||
by default) and have their exceptions printed to the console. Override
|
||||
application_exception() if you want to do more when this happens.
|
||||
|
||||
If you override run(), make sure you handle things like launching the
|
||||
application checker.
|
||||
"""
|
||||
|
||||
application_checker_interval = 0.1
|
||||
|
||||
def __init__(self, application, max_applications=1000):
|
||||
# Parameters
|
||||
self.application = application
|
||||
self.max_applications = max_applications
|
||||
# Initialisation
|
||||
self.application_instances = {}
|
||||
|
||||
### Mainloop and handling
|
||||
|
||||
def run(self):
|
||||
"""
|
||||
Runs the asyncio event loop with our handler loop.
|
||||
"""
|
||||
event_loop = asyncio.get_event_loop()
|
||||
asyncio.ensure_future(self.application_checker())
|
||||
try:
|
||||
event_loop.run_until_complete(self.handle())
|
||||
except KeyboardInterrupt:
|
||||
logger.info("Exiting due to Ctrl-C/interrupt")
|
||||
|
||||
async def handle(self):
|
||||
raise NotImplementedError("You must implement handle()")
|
||||
|
||||
async def application_send(self, scope, message):
|
||||
"""
|
||||
Receives outbound sends from applications and handles them.
|
||||
"""
|
||||
raise NotImplementedError("You must implement application_send()")
|
||||
|
||||
### Application instance management
|
||||
|
||||
def get_or_create_application_instance(self, scope_id, scope):
|
||||
"""
|
||||
Creates an application instance and returns its queue.
|
||||
"""
|
||||
if scope_id in self.application_instances:
|
||||
self.application_instances[scope_id]["last_used"] = time.time()
|
||||
return self.application_instances[scope_id]["input_queue"]
|
||||
# See if we need to delete an old one
|
||||
while len(self.application_instances) > self.max_applications:
|
||||
self.delete_oldest_application_instance()
|
||||
# Make an instance of the application
|
||||
input_queue = asyncio.Queue()
|
||||
application_instance = guarantee_single_callable(self.application)
|
||||
# Run it, and stash the future for later checking
|
||||
future = asyncio.ensure_future(
|
||||
application_instance(
|
||||
scope=scope,
|
||||
receive=input_queue.get,
|
||||
send=lambda message: self.application_send(scope, message),
|
||||
)
|
||||
)
|
||||
self.application_instances[scope_id] = {
|
||||
"input_queue": input_queue,
|
||||
"future": future,
|
||||
"scope": scope,
|
||||
"last_used": time.time(),
|
||||
}
|
||||
return input_queue
|
||||
|
||||
def delete_oldest_application_instance(self):
|
||||
"""
|
||||
Finds and deletes the oldest application instance
|
||||
"""
|
||||
oldest_time = min(
|
||||
details["last_used"] for details in self.application_instances.values()
|
||||
)
|
||||
for scope_id, details in self.application_instances.items():
|
||||
if details["last_used"] == oldest_time:
|
||||
self.delete_application_instance(scope_id)
|
||||
# Return to make sure we only delete one in case two have
|
||||
# the same oldest time
|
||||
return
|
||||
|
||||
def delete_application_instance(self, scope_id):
|
||||
"""
|
||||
Removes an application instance (makes sure its task is stopped,
|
||||
then removes it from the current set)
|
||||
"""
|
||||
details = self.application_instances[scope_id]
|
||||
del self.application_instances[scope_id]
|
||||
if not details["future"].done():
|
||||
details["future"].cancel()
|
||||
|
||||
async def application_checker(self):
|
||||
"""
|
||||
Goes through the set of current application instance Futures and cleans up
|
||||
any that are done/prints exceptions for any that errored.
|
||||
"""
|
||||
while True:
|
||||
await asyncio.sleep(self.application_checker_interval)
|
||||
for scope_id, details in list(self.application_instances.items()):
|
||||
if details["future"].done():
|
||||
exception = details["future"].exception()
|
||||
if exception:
|
||||
await self.application_exception(exception, details)
|
||||
try:
|
||||
del self.application_instances[scope_id]
|
||||
except KeyError:
|
||||
# Exception handling might have already got here before us. That's fine.
|
||||
pass
|
||||
|
||||
async def application_exception(self, exception, application_details):
|
||||
"""
|
||||
Called whenever an application coroutine has an exception.
|
||||
"""
|
||||
logging.error(
|
||||
"Exception inside application: %s\n%s%s",
|
||||
exception,
|
||||
"".join(traceback.format_tb(exception.__traceback__)),
|
||||
" {}".format(exception),
|
||||
)
|
||||
375
django后端代码/venv/lib/python3.7/site-packages/asgiref/sync.py
Normal file
375
django后端代码/venv/lib/python3.7/site-packages/asgiref/sync.py
Normal file
@ -0,0 +1,375 @@
|
||||
import asyncio
|
||||
import asyncio.coroutines
|
||||
import functools
|
||||
import os
|
||||
import sys
|
||||
import threading
|
||||
from concurrent.futures import Future, ThreadPoolExecutor
|
||||
|
||||
from .current_thread_executor import CurrentThreadExecutor
|
||||
from .local import Local
|
||||
|
||||
try:
|
||||
import contextvars # Python 3.7+ only.
|
||||
except ImportError:
|
||||
contextvars = None
|
||||
|
||||
|
||||
def _restore_context(context):
|
||||
# Check for changes in contextvars, and set them to the current
|
||||
# context for downstream consumers
|
||||
for cvar in context:
|
||||
try:
|
||||
if cvar.get() != context.get(cvar):
|
||||
cvar.set(context.get(cvar))
|
||||
except LookupError:
|
||||
cvar.set(context.get(cvar))
|
||||
|
||||
|
||||
class AsyncToSync:
|
||||
"""
|
||||
Utility class which turns an awaitable that only works on the thread with
|
||||
the event loop into a synchronous callable that works in a subthread.
|
||||
|
||||
If the call stack contains an async loop, the code runs there.
|
||||
Otherwise, the code runs in a new loop in a new thread.
|
||||
|
||||
Either way, this thread then pauses and waits to run any thread_sensitive
|
||||
code called from further down the call stack using SyncToAsync, before
|
||||
finally exiting once the async task returns.
|
||||
"""
|
||||
|
||||
# Maps launched Tasks to the threads that launched them (for locals impl)
|
||||
launch_map = {}
|
||||
|
||||
# Keeps track of which CurrentThreadExecutor to use. This uses an asgiref
|
||||
# Local, not a threadlocal, so that tasks can work out what their parent used.
|
||||
executors = Local()
|
||||
|
||||
def __init__(self, awaitable, force_new_loop=False):
|
||||
self.awaitable = awaitable
|
||||
try:
|
||||
self.__self__ = self.awaitable.__self__
|
||||
except AttributeError:
|
||||
pass
|
||||
if force_new_loop:
|
||||
# They have asked that we always run in a new sub-loop.
|
||||
self.main_event_loop = None
|
||||
else:
|
||||
try:
|
||||
self.main_event_loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
# There's no event loop in this thread. Look for the threadlocal if
|
||||
# we're inside SyncToAsync
|
||||
main_event_loop_pid = getattr(
|
||||
SyncToAsync.threadlocal, "main_event_loop_pid", None
|
||||
)
|
||||
# We make sure the parent loop is from the same process - if
|
||||
# they've forked, this is not going to be valid any more (#194)
|
||||
if main_event_loop_pid and main_event_loop_pid == os.getpid():
|
||||
self.main_event_loop = getattr(
|
||||
SyncToAsync.threadlocal, "main_event_loop", None
|
||||
)
|
||||
else:
|
||||
self.main_event_loop = None
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
# You can't call AsyncToSync from a thread with a running event loop
|
||||
try:
|
||||
event_loop = asyncio.get_event_loop()
|
||||
except RuntimeError:
|
||||
pass
|
||||
else:
|
||||
if event_loop.is_running():
|
||||
raise RuntimeError(
|
||||
"You cannot use AsyncToSync in the same thread as an async event loop - "
|
||||
"just await the async function directly."
|
||||
)
|
||||
|
||||
if contextvars is not None:
|
||||
# Wrapping context in list so it can be reassigned from within
|
||||
# `main_wrap`.
|
||||
context = [contextvars.copy_context()]
|
||||
else:
|
||||
context = None
|
||||
|
||||
# Make a future for the return information
|
||||
call_result = Future()
|
||||
# Get the source thread
|
||||
source_thread = threading.current_thread()
|
||||
# Make a CurrentThreadExecutor we'll use to idle in this thread - we
|
||||
# need one for every sync frame, even if there's one above us in the
|
||||
# same thread.
|
||||
if hasattr(self.executors, "current"):
|
||||
old_current_executor = self.executors.current
|
||||
else:
|
||||
old_current_executor = None
|
||||
current_executor = CurrentThreadExecutor()
|
||||
self.executors.current = current_executor
|
||||
# Use call_soon_threadsafe to schedule a synchronous callback on the
|
||||
# main event loop's thread if it's there, otherwise make a new loop
|
||||
# in this thread.
|
||||
try:
|
||||
awaitable = self.main_wrap(
|
||||
args, kwargs, call_result, source_thread, sys.exc_info(), context
|
||||
)
|
||||
|
||||
if not (self.main_event_loop and self.main_event_loop.is_running()):
|
||||
# Make our own event loop - in a new thread - and run inside that.
|
||||
loop = asyncio.new_event_loop()
|
||||
loop_executor = ThreadPoolExecutor(max_workers=1)
|
||||
loop_future = loop_executor.submit(
|
||||
self._run_event_loop, loop, awaitable
|
||||
)
|
||||
if current_executor:
|
||||
# Run the CurrentThreadExecutor until the future is done
|
||||
current_executor.run_until_future(loop_future)
|
||||
# Wait for future and/or allow for exception propagation
|
||||
loop_future.result()
|
||||
else:
|
||||
# Call it inside the existing loop
|
||||
self.main_event_loop.call_soon_threadsafe(
|
||||
self.main_event_loop.create_task, awaitable
|
||||
)
|
||||
if current_executor:
|
||||
# Run the CurrentThreadExecutor until the future is done
|
||||
current_executor.run_until_future(call_result)
|
||||
finally:
|
||||
# Clean up any executor we were running
|
||||
if hasattr(self.executors, "current"):
|
||||
del self.executors.current
|
||||
if old_current_executor:
|
||||
self.executors.current = old_current_executor
|
||||
if contextvars is not None:
|
||||
_restore_context(context[0])
|
||||
|
||||
# Wait for results from the future.
|
||||
return call_result.result()
|
||||
|
||||
def _run_event_loop(self, loop, coro):
|
||||
"""
|
||||
Runs the given event loop (designed to be called in a thread).
|
||||
"""
|
||||
asyncio.set_event_loop(loop)
|
||||
try:
|
||||
loop.run_until_complete(coro)
|
||||
finally:
|
||||
try:
|
||||
# mimic asyncio.run() behavior
|
||||
# cancel unexhausted async generators
|
||||
if sys.version_info >= (3, 7, 0):
|
||||
tasks = asyncio.all_tasks(loop)
|
||||
else:
|
||||
tasks = asyncio.Task.all_tasks(loop)
|
||||
for task in tasks:
|
||||
task.cancel()
|
||||
loop.run_until_complete(asyncio.gather(*tasks, return_exceptions=True))
|
||||
for task in tasks:
|
||||
if task.cancelled():
|
||||
continue
|
||||
if task.exception() is not None:
|
||||
loop.call_exception_handler(
|
||||
{
|
||||
"message": "unhandled exception during loop shutdown",
|
||||
"exception": task.exception(),
|
||||
"task": task,
|
||||
}
|
||||
)
|
||||
if hasattr(loop, "shutdown_asyncgens"):
|
||||
loop.run_until_complete(loop.shutdown_asyncgens())
|
||||
finally:
|
||||
loop.close()
|
||||
asyncio.set_event_loop(self.main_event_loop)
|
||||
|
||||
def __get__(self, parent, objtype):
|
||||
"""
|
||||
Include self for methods
|
||||
"""
|
||||
func = functools.partial(self.__call__, parent)
|
||||
return functools.update_wrapper(func, self.awaitable)
|
||||
|
||||
async def main_wrap(
|
||||
self, args, kwargs, call_result, source_thread, exc_info, context
|
||||
):
|
||||
"""
|
||||
Wraps the awaitable with something that puts the result into the
|
||||
result/exception future.
|
||||
"""
|
||||
if context is not None:
|
||||
_restore_context(context[0])
|
||||
|
||||
current_task = SyncToAsync.get_current_task()
|
||||
self.launch_map[current_task] = source_thread
|
||||
try:
|
||||
# If we have an exception, run the function inside the except block
|
||||
# after raising it so exc_info is correctly populated.
|
||||
if exc_info[1]:
|
||||
try:
|
||||
raise exc_info[1]
|
||||
except Exception:
|
||||
result = await self.awaitable(*args, **kwargs)
|
||||
else:
|
||||
result = await self.awaitable(*args, **kwargs)
|
||||
except Exception as e:
|
||||
call_result.set_exception(e)
|
||||
else:
|
||||
call_result.set_result(result)
|
||||
finally:
|
||||
del self.launch_map[current_task]
|
||||
|
||||
if context is not None:
|
||||
context[0] = contextvars.copy_context()
|
||||
|
||||
|
||||
class SyncToAsync:
|
||||
"""
|
||||
Utility class which turns a synchronous callable into an awaitable that
|
||||
runs in a threadpool. It also sets a threadlocal inside the thread so
|
||||
calls to AsyncToSync can escape it.
|
||||
|
||||
If thread_sensitive is passed, the code will run in the same thread as any
|
||||
outer code. This is needed for underlying Python code that is not
|
||||
threadsafe (for example, code which handles SQLite database connections).
|
||||
|
||||
If the outermost program is async (i.e. SyncToAsync is outermost), then
|
||||
this will be a dedicated single sub-thread that all sync code runs in,
|
||||
one after the other. If the outermost program is sync (i.e. AsyncToSync is
|
||||
outermost), this will just be the main thread. This is achieved by idling
|
||||
with a CurrentThreadExecutor while AsyncToSync is blocking its sync parent,
|
||||
rather than just blocking.
|
||||
"""
|
||||
|
||||
# If they've set ASGI_THREADS, update the default asyncio executor for now
|
||||
if "ASGI_THREADS" in os.environ:
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.set_default_executor(
|
||||
ThreadPoolExecutor(max_workers=int(os.environ["ASGI_THREADS"]))
|
||||
)
|
||||
|
||||
# Maps launched threads to the coroutines that spawned them
|
||||
launch_map = {}
|
||||
|
||||
# Storage for main event loop references
|
||||
threadlocal = threading.local()
|
||||
|
||||
# Single-thread executor for thread-sensitive code
|
||||
single_thread_executor = ThreadPoolExecutor(max_workers=1)
|
||||
|
||||
def __init__(self, func, thread_sensitive=True):
|
||||
self.func = func
|
||||
functools.update_wrapper(self, func)
|
||||
self._thread_sensitive = thread_sensitive
|
||||
self._is_coroutine = asyncio.coroutines._is_coroutine
|
||||
try:
|
||||
self.__self__ = func.__self__
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
async def __call__(self, *args, **kwargs):
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
# Work out what thread to run the code in
|
||||
if self._thread_sensitive:
|
||||
if hasattr(AsyncToSync.executors, "current"):
|
||||
# If we have a parent sync thread above somewhere, use that
|
||||
executor = AsyncToSync.executors.current
|
||||
else:
|
||||
# Otherwise, we run it in a fixed single thread
|
||||
executor = self.single_thread_executor
|
||||
else:
|
||||
executor = None # Use default
|
||||
|
||||
if contextvars is not None:
|
||||
context = contextvars.copy_context()
|
||||
child = functools.partial(self.func, *args, **kwargs)
|
||||
func = context.run
|
||||
args = (child,)
|
||||
kwargs = {}
|
||||
else:
|
||||
func = self.func
|
||||
|
||||
# Run the code in the right thread
|
||||
future = loop.run_in_executor(
|
||||
executor,
|
||||
functools.partial(
|
||||
self.thread_handler,
|
||||
loop,
|
||||
self.get_current_task(),
|
||||
sys.exc_info(),
|
||||
func,
|
||||
*args,
|
||||
**kwargs
|
||||
),
|
||||
)
|
||||
ret = await asyncio.wait_for(future, timeout=None)
|
||||
|
||||
if contextvars is not None:
|
||||
_restore_context(context)
|
||||
|
||||
return ret
|
||||
|
||||
def __get__(self, parent, objtype):
|
||||
"""
|
||||
Include self for methods
|
||||
"""
|
||||
return functools.partial(self.__call__, parent)
|
||||
|
||||
def thread_handler(self, loop, source_task, exc_info, func, *args, **kwargs):
|
||||
"""
|
||||
Wraps the sync application with exception handling.
|
||||
"""
|
||||
# Set the threadlocal for AsyncToSync
|
||||
self.threadlocal.main_event_loop = loop
|
||||
self.threadlocal.main_event_loop_pid = os.getpid()
|
||||
# Set the task mapping (used for the locals module)
|
||||
current_thread = threading.current_thread()
|
||||
if AsyncToSync.launch_map.get(source_task) == current_thread:
|
||||
# Our parent task was launched from this same thread, so don't make
|
||||
# a launch map entry - let it shortcut over us! (and stop infinite loops)
|
||||
parent_set = False
|
||||
else:
|
||||
self.launch_map[current_thread] = source_task
|
||||
parent_set = True
|
||||
# Run the function
|
||||
try:
|
||||
# If we have an exception, run the function inside the except block
|
||||
# after raising it so exc_info is correctly populated.
|
||||
if exc_info[1]:
|
||||
try:
|
||||
raise exc_info[1]
|
||||
except Exception:
|
||||
return func(*args, **kwargs)
|
||||
else:
|
||||
return func(*args, **kwargs)
|
||||
finally:
|
||||
# Only delete the launch_map parent if we set it, otherwise it is
|
||||
# from someone else.
|
||||
if parent_set:
|
||||
del self.launch_map[current_thread]
|
||||
|
||||
@staticmethod
|
||||
def get_current_task():
|
||||
"""
|
||||
Cross-version implementation of asyncio.current_task()
|
||||
|
||||
Returns None if there is no task.
|
||||
"""
|
||||
try:
|
||||
if hasattr(asyncio, "current_task"):
|
||||
# Python 3.7 and up
|
||||
return asyncio.current_task()
|
||||
else:
|
||||
# Python 3.6
|
||||
return asyncio.Task.current_task()
|
||||
except RuntimeError:
|
||||
return None
|
||||
|
||||
|
||||
# Lowercase aliases (and decorator friendliness)
|
||||
async_to_sync = AsyncToSync
|
||||
|
||||
|
||||
def sync_to_async(func=None, thread_sensitive=True):
|
||||
if func is None:
|
||||
return lambda f: SyncToAsync(f, thread_sensitive=thread_sensitive)
|
||||
return SyncToAsync(func, thread_sensitive=thread_sensitive)
|
||||
@ -0,0 +1,97 @@
|
||||
import asyncio
|
||||
import time
|
||||
|
||||
from .compatibility import guarantee_single_callable
|
||||
from .timeout import timeout as async_timeout
|
||||
|
||||
|
||||
class ApplicationCommunicator:
|
||||
"""
|
||||
Runs an ASGI application in a test mode, allowing sending of
|
||||
messages to it and retrieval of messages it sends.
|
||||
"""
|
||||
|
||||
def __init__(self, application, scope):
|
||||
self.application = guarantee_single_callable(application)
|
||||
self.scope = scope
|
||||
self.input_queue = asyncio.Queue()
|
||||
self.output_queue = asyncio.Queue()
|
||||
self.future = asyncio.ensure_future(
|
||||
self.application(scope, self.input_queue.get, self.output_queue.put)
|
||||
)
|
||||
|
||||
async def wait(self, timeout=1):
|
||||
"""
|
||||
Waits for the application to stop itself and returns any exceptions.
|
||||
"""
|
||||
try:
|
||||
async with async_timeout(timeout):
|
||||
try:
|
||||
await self.future
|
||||
self.future.result()
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
finally:
|
||||
if not self.future.done():
|
||||
self.future.cancel()
|
||||
try:
|
||||
await self.future
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
|
||||
def stop(self, exceptions=True):
|
||||
if not self.future.done():
|
||||
self.future.cancel()
|
||||
elif exceptions:
|
||||
# Give a chance to raise any exceptions
|
||||
self.future.result()
|
||||
|
||||
def __del__(self):
|
||||
# Clean up on deletion
|
||||
try:
|
||||
self.stop(exceptions=False)
|
||||
except RuntimeError:
|
||||
# Event loop already stopped
|
||||
pass
|
||||
|
||||
async def send_input(self, message):
|
||||
"""
|
||||
Sends a single message to the application
|
||||
"""
|
||||
# Give it the message
|
||||
await self.input_queue.put(message)
|
||||
|
||||
async def receive_output(self, timeout=1):
|
||||
"""
|
||||
Receives a single message from the application, with optional timeout.
|
||||
"""
|
||||
# Make sure there's not an exception to raise from the task
|
||||
if self.future.done():
|
||||
self.future.result()
|
||||
# Wait and receive the message
|
||||
try:
|
||||
async with async_timeout(timeout):
|
||||
return await self.output_queue.get()
|
||||
except asyncio.TimeoutError as e:
|
||||
# See if we have another error to raise inside
|
||||
if self.future.done():
|
||||
self.future.result()
|
||||
else:
|
||||
self.future.cancel()
|
||||
try:
|
||||
await self.future
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
raise e
|
||||
|
||||
async def receive_nothing(self, timeout=0.1, interval=0.01):
|
||||
"""
|
||||
Checks that there is no message to receive in the given time.
|
||||
"""
|
||||
# `interval` has precedence over `timeout`
|
||||
start = time.monotonic()
|
||||
while time.monotonic() - start < timeout:
|
||||
if not self.output_queue.empty():
|
||||
return False
|
||||
await asyncio.sleep(interval)
|
||||
return self.output_queue.empty()
|
||||
128
django后端代码/venv/lib/python3.7/site-packages/asgiref/timeout.py
Normal file
128
django后端代码/venv/lib/python3.7/site-packages/asgiref/timeout.py
Normal file
@ -0,0 +1,128 @@
|
||||
# This code is originally sourced from the aio-libs project "async_timeout",
|
||||
# under the Apache 2.0 license. You may see the original project at
|
||||
# https://github.com/aio-libs/async-timeout
|
||||
|
||||
# It is vendored here to reduce chain-dependencies on this library, and
|
||||
# modified slightly to remove some features we don't use.
|
||||
|
||||
|
||||
import asyncio
|
||||
import sys
|
||||
from types import TracebackType
|
||||
from typing import Any, Optional, Type # noqa
|
||||
|
||||
PY_37 = sys.version_info >= (3, 7)
|
||||
|
||||
|
||||
class timeout:
|
||||
"""timeout context manager.
|
||||
|
||||
Useful in cases when you want to apply timeout logic around block
|
||||
of code or in cases when asyncio.wait_for is not suitable. For example:
|
||||
|
||||
>>> with timeout(0.001):
|
||||
... async with aiohttp.get('https://github.com') as r:
|
||||
... await r.text()
|
||||
|
||||
|
||||
timeout - value in seconds or None to disable timeout logic
|
||||
loop - asyncio compatible event loop
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
timeout: Optional[float],
|
||||
*,
|
||||
loop: Optional[asyncio.AbstractEventLoop] = None
|
||||
) -> None:
|
||||
self._timeout = timeout
|
||||
if loop is None:
|
||||
loop = asyncio.get_event_loop()
|
||||
self._loop = loop
|
||||
self._task = None # type: Optional[asyncio.Task[Any]]
|
||||
self._cancelled = False
|
||||
self._cancel_handler = None # type: Optional[asyncio.Handle]
|
||||
self._cancel_at = None # type: Optional[float]
|
||||
|
||||
def __enter__(self) -> "timeout":
|
||||
return self._do_enter()
|
||||
|
||||
def __exit__(
|
||||
self,
|
||||
exc_type: Type[BaseException],
|
||||
exc_val: BaseException,
|
||||
exc_tb: TracebackType,
|
||||
) -> Optional[bool]:
|
||||
self._do_exit(exc_type)
|
||||
return None
|
||||
|
||||
async def __aenter__(self) -> "timeout":
|
||||
return self._do_enter()
|
||||
|
||||
async def __aexit__(
|
||||
self,
|
||||
exc_type: Type[BaseException],
|
||||
exc_val: BaseException,
|
||||
exc_tb: TracebackType,
|
||||
) -> None:
|
||||
self._do_exit(exc_type)
|
||||
|
||||
@property
|
||||
def expired(self) -> bool:
|
||||
return self._cancelled
|
||||
|
||||
@property
|
||||
def remaining(self) -> Optional[float]:
|
||||
if self._cancel_at is not None:
|
||||
return max(self._cancel_at - self._loop.time(), 0.0)
|
||||
else:
|
||||
return None
|
||||
|
||||
def _do_enter(self) -> "timeout":
|
||||
# Support Tornado 5- without timeout
|
||||
# Details: https://github.com/python/asyncio/issues/392
|
||||
if self._timeout is None:
|
||||
return self
|
||||
|
||||
self._task = current_task(self._loop)
|
||||
if self._task is None:
|
||||
raise RuntimeError(
|
||||
"Timeout context manager should be used " "inside a task"
|
||||
)
|
||||
|
||||
if self._timeout <= 0:
|
||||
self._loop.call_soon(self._cancel_task)
|
||||
return self
|
||||
|
||||
self._cancel_at = self._loop.time() + self._timeout
|
||||
self._cancel_handler = self._loop.call_at(self._cancel_at, self._cancel_task)
|
||||
return self
|
||||
|
||||
def _do_exit(self, exc_type: Type[BaseException]) -> None:
|
||||
if exc_type is asyncio.CancelledError and self._cancelled:
|
||||
self._cancel_handler = None
|
||||
self._task = None
|
||||
raise asyncio.TimeoutError
|
||||
if self._timeout is not None and self._cancel_handler is not None:
|
||||
self._cancel_handler.cancel()
|
||||
self._cancel_handler = None
|
||||
self._task = None
|
||||
return None
|
||||
|
||||
def _cancel_task(self) -> None:
|
||||
if self._task is not None:
|
||||
self._task.cancel()
|
||||
self._cancelled = True
|
||||
|
||||
|
||||
def current_task(loop: asyncio.AbstractEventLoop) -> "asyncio.Task[Any]":
|
||||
if PY_37:
|
||||
task = asyncio.current_task(loop=loop) # type: ignore
|
||||
else:
|
||||
task = asyncio.Task.current_task(loop=loop)
|
||||
if task is None:
|
||||
# this should be removed, tokio must use register_task and family API
|
||||
if hasattr(loop, "current_task"):
|
||||
task = loop.current_task() # type: ignore
|
||||
|
||||
return task
|
||||
162
django后端代码/venv/lib/python3.7/site-packages/asgiref/wsgi.py
Normal file
162
django后端代码/venv/lib/python3.7/site-packages/asgiref/wsgi.py
Normal file
@ -0,0 +1,162 @@
|
||||
from io import BytesIO
|
||||
from tempfile import SpooledTemporaryFile
|
||||
|
||||
from asgiref.sync import AsyncToSync, sync_to_async
|
||||
|
||||
|
||||
class WsgiToAsgi:
|
||||
"""
|
||||
Wraps a WSGI application to make it into an ASGI application.
|
||||
"""
|
||||
|
||||
def __init__(self, wsgi_application):
|
||||
self.wsgi_application = wsgi_application
|
||||
|
||||
async def __call__(self, scope, receive, send):
|
||||
"""
|
||||
ASGI application instantiation point.
|
||||
We return a new WsgiToAsgiInstance here with the WSGI app
|
||||
and the scope, ready to respond when it is __call__ed.
|
||||
"""
|
||||
await WsgiToAsgiInstance(self.wsgi_application)(scope, receive, send)
|
||||
|
||||
|
||||
class WsgiToAsgiInstance:
|
||||
"""
|
||||
Per-socket instance of a wrapped WSGI application
|
||||
"""
|
||||
|
||||
def __init__(self, wsgi_application):
|
||||
self.wsgi_application = wsgi_application
|
||||
self.response_started = False
|
||||
self.response_content_length = None
|
||||
|
||||
async def __call__(self, scope, receive, send):
|
||||
if scope["type"] != "http":
|
||||
raise ValueError("WSGI wrapper received a non-HTTP scope")
|
||||
self.scope = scope
|
||||
with SpooledTemporaryFile(max_size=65536) as body:
|
||||
# Alright, wait for the http.request messages
|
||||
while True:
|
||||
message = await receive()
|
||||
if message["type"] != "http.request":
|
||||
raise ValueError("WSGI wrapper received a non-HTTP-request message")
|
||||
body.write(message.get("body", b""))
|
||||
if not message.get("more_body"):
|
||||
break
|
||||
body.seek(0)
|
||||
# Wrap send so it can be called from the subthread
|
||||
self.sync_send = AsyncToSync(send)
|
||||
# Call the WSGI app
|
||||
await self.run_wsgi_app(body)
|
||||
|
||||
def build_environ(self, scope, body):
|
||||
"""
|
||||
Builds a scope and request body into a WSGI environ object.
|
||||
"""
|
||||
environ = {
|
||||
"REQUEST_METHOD": scope["method"],
|
||||
"SCRIPT_NAME": scope.get("root_path", "").encode("utf8").decode("latin1"),
|
||||
"PATH_INFO": scope["path"].encode("utf8").decode("latin1"),
|
||||
"QUERY_STRING": scope["query_string"].decode("ascii"),
|
||||
"SERVER_PROTOCOL": "HTTP/%s" % scope["http_version"],
|
||||
"wsgi.version": (1, 0),
|
||||
"wsgi.url_scheme": scope.get("scheme", "http"),
|
||||
"wsgi.input": body,
|
||||
"wsgi.errors": BytesIO(),
|
||||
"wsgi.multithread": True,
|
||||
"wsgi.multiprocess": True,
|
||||
"wsgi.run_once": False,
|
||||
}
|
||||
# Get server name and port - required in WSGI, not in ASGI
|
||||
if "server" in scope:
|
||||
environ["SERVER_NAME"] = scope["server"][0]
|
||||
environ["SERVER_PORT"] = str(scope["server"][1])
|
||||
else:
|
||||
environ["SERVER_NAME"] = "localhost"
|
||||
environ["SERVER_PORT"] = "80"
|
||||
|
||||
if "client" in scope:
|
||||
environ["REMOTE_ADDR"] = scope["client"][0]
|
||||
|
||||
# Go through headers and make them into environ entries
|
||||
for name, value in self.scope.get("headers", []):
|
||||
name = name.decode("latin1")
|
||||
if name == "content-length":
|
||||
corrected_name = "CONTENT_LENGTH"
|
||||
elif name == "content-type":
|
||||
corrected_name = "CONTENT_TYPE"
|
||||
else:
|
||||
corrected_name = "HTTP_%s" % name.upper().replace("-", "_")
|
||||
# HTTPbis say only ASCII chars are allowed in headers, but we latin1 just in case
|
||||
value = value.decode("latin1")
|
||||
if corrected_name in environ:
|
||||
value = environ[corrected_name] + "," + value
|
||||
environ[corrected_name] = value
|
||||
return environ
|
||||
|
||||
def start_response(self, status, response_headers, exc_info=None):
|
||||
"""
|
||||
WSGI start_response callable.
|
||||
"""
|
||||
# Don't allow re-calling once response has begun
|
||||
if self.response_started:
|
||||
raise exc_info[1].with_traceback(exc_info[2])
|
||||
# Don't allow re-calling without exc_info
|
||||
if hasattr(self, "response_start") and exc_info is None:
|
||||
raise ValueError(
|
||||
"You cannot call start_response a second time without exc_info"
|
||||
)
|
||||
# Extract status code
|
||||
status_code, _ = status.split(" ", 1)
|
||||
status_code = int(status_code)
|
||||
# Extract headers
|
||||
headers = [
|
||||
(name.lower().encode("ascii"), value.encode("ascii"))
|
||||
for name, value in response_headers
|
||||
]
|
||||
# Extract content-length
|
||||
self.response_content_length = None
|
||||
for name, value in response_headers:
|
||||
if name.lower() == "content-length":
|
||||
self.response_content_length = int(value)
|
||||
# Build and send response start message.
|
||||
self.response_start = {
|
||||
"type": "http.response.start",
|
||||
"status": status_code,
|
||||
"headers": headers,
|
||||
}
|
||||
|
||||
@sync_to_async
|
||||
def run_wsgi_app(self, body):
|
||||
"""
|
||||
Called in a subthread to run the WSGI app. We encapsulate like
|
||||
this so that the start_response callable is called in the same thread.
|
||||
"""
|
||||
# Translate the scope and incoming request body into a WSGI environ
|
||||
environ = self.build_environ(self.scope, body)
|
||||
# Run the WSGI app
|
||||
bytes_sent = 0
|
||||
for output in self.wsgi_application(environ, self.start_response):
|
||||
# If this is the first response, include the response headers
|
||||
if not self.response_started:
|
||||
self.response_started = True
|
||||
self.sync_send(self.response_start)
|
||||
# If the application supplies a Content-Length header
|
||||
if self.response_content_length is not None:
|
||||
# The server should not transmit more bytes to the client than the header allows
|
||||
bytes_allowed = self.response_content_length - bytes_sent
|
||||
if len(output) > bytes_allowed:
|
||||
output = output[:bytes_allowed]
|
||||
self.sync_send(
|
||||
{"type": "http.response.body", "body": output, "more_body": True}
|
||||
)
|
||||
bytes_sent += len(output)
|
||||
# The server should stop iterating over the response when enough data has been sent
|
||||
if bytes_sent == self.response_content_length:
|
||||
break
|
||||
# Close connection
|
||||
if not self.response_started:
|
||||
self.response_started = True
|
||||
self.sync_send(self.response_start)
|
||||
self.sync_send({"type": "http.response.body"})
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,21 @@
|
||||
This packge contains a modified version of ca-bundle.crt:
|
||||
|
||||
ca-bundle.crt -- Bundle of CA Root Certificates
|
||||
|
||||
Certificate data from Mozilla as of: Thu Nov 3 19:04:19 2011#
|
||||
This is a bundle of X.509 certificates of public Certificate Authorities
|
||||
(CA). These were automatically extracted from Mozilla's root certificates
|
||||
file (certdata.txt). This file can be found in the mozilla source tree:
|
||||
http://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1#
|
||||
It contains the certificates in PEM format and therefore
|
||||
can be directly used with curl / libcurl / php_curl, or with
|
||||
an Apache+mod_ssl webserver for SSL client authentication.
|
||||
Just configure this file as the SSLCACertificateFile.#
|
||||
|
||||
***** BEGIN LICENSE BLOCK *****
|
||||
This Source Code Form is subject to the terms of the Mozilla Public License,
|
||||
v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain
|
||||
one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
***** END LICENSE BLOCK *****
|
||||
@(#) $RCSfile: certdata.txt,v $ $Revision: 1.80 $ $Date: 2011/11/03 15:11:58 $
|
||||
@ -0,0 +1,83 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: certifi
|
||||
Version: 2020.12.5
|
||||
Summary: Python package for providing Mozilla's CA Bundle.
|
||||
Home-page: https://certifiio.readthedocs.io/en/latest/
|
||||
Author: Kenneth Reitz
|
||||
Author-email: me@kennethreitz.com
|
||||
License: MPL-2.0
|
||||
Project-URL: Documentation, https://certifiio.readthedocs.io/en/latest/
|
||||
Project-URL: Source, https://github.com/certifi/python-certifi
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
||||
Classifier: Natural Language :: English
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: 3.9
|
||||
|
||||
Certifi: Python SSL Certificates
|
||||
================================
|
||||
|
||||
`Certifi`_ provides Mozilla's carefully curated collection of Root Certificates for
|
||||
validating the trustworthiness of SSL certificates while verifying the identity
|
||||
of TLS hosts. It has been extracted from the `Requests`_ project.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
``certifi`` is available on PyPI. Simply install it with ``pip``::
|
||||
|
||||
$ pip install certifi
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
To reference the installed certificate authority (CA) bundle, you can use the
|
||||
built-in function::
|
||||
|
||||
>>> import certifi
|
||||
|
||||
>>> certifi.where()
|
||||
'/usr/local/lib/python3.7/site-packages/certifi/cacert.pem'
|
||||
|
||||
Or from the command line::
|
||||
|
||||
$ python -m certifi
|
||||
/usr/local/lib/python3.7/site-packages/certifi/cacert.pem
|
||||
|
||||
Enjoy!
|
||||
|
||||
1024-bit Root Certificates
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Browsers and certificate authorities have concluded that 1024-bit keys are
|
||||
unacceptably weak for certificates, particularly root certificates. For this
|
||||
reason, Mozilla has removed any weak (i.e. 1024-bit key) certificate from its
|
||||
bundle, replacing it with an equivalent strong (i.e. 2048-bit or greater key)
|
||||
certificate from the same CA. Because Mozilla removed these certificates from
|
||||
its bundle, ``certifi`` removed them as well.
|
||||
|
||||
In previous versions, ``certifi`` provided the ``certifi.old_where()`` function
|
||||
to intentionally re-add the 1024-bit roots back into your bundle. This was not
|
||||
recommended in production and therefore was removed at the end of 2018.
|
||||
|
||||
.. _`Certifi`: https://certifiio.readthedocs.io/en/latest/
|
||||
.. _`Requests`: https://requests.readthedocs.io/en/master/
|
||||
|
||||
Addition/Removal of Certificates
|
||||
--------------------------------
|
||||
|
||||
Certifi does not support any addition/removal or other modification of the
|
||||
CA trust store content. This project is intended to provide a reliable and
|
||||
highly portable root of trust to python deployments. Look to upstream projects
|
||||
for methods to use alternate trust.
|
||||
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
certifi-2020.12.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
certifi-2020.12.5.dist-info/LICENSE,sha256=anCkv2sBABbVmmS4rkrY3H9e8W8ftFPMLs13HFo0ETE,1048
|
||||
certifi-2020.12.5.dist-info/METADATA,sha256=SEw5GGHIeBwGwDJsIUaVfEQAc5Jqs_XofOfTX-_kCE0,2994
|
||||
certifi-2020.12.5.dist-info/RECORD,,
|
||||
certifi-2020.12.5.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110
|
||||
certifi-2020.12.5.dist-info/top_level.txt,sha256=KMu4vUCfsjLrkPbSNdgdekS-pVJzBAJFO__nI8NF6-U,8
|
||||
certifi/__init__.py,sha256=SsmdmFHjHCY4VLtqwpp9P_jsOcAuHj-5c5WqoEz-oFg,62
|
||||
certifi/__main__.py,sha256=xBBoj905TUWBLRGANOcf7oi6e-3dMP4cEoG9OyMs11g,243
|
||||
certifi/__pycache__/__init__.cpython-37.pyc,,
|
||||
certifi/__pycache__/__main__.cpython-37.pyc,,
|
||||
certifi/__pycache__/core.cpython-37.pyc,,
|
||||
certifi/cacert.pem,sha256=u3fxPT--yemLvyislQRrRBlsfY9Vq3cgBh6ZmRqCkZc,263774
|
||||
certifi/core.py,sha256=V0uyxKOYdz6ulDSusclrLmjbPgOXsD0BnEf0SQ7OnoE,2303
|
||||
@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.35.1)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1 @@
|
||||
certifi
|
||||
@ -0,0 +1,3 @@
|
||||
from .core import contents, where
|
||||
|
||||
__version__ = "2020.12.05"
|
||||
@ -0,0 +1,12 @@
|
||||
import argparse
|
||||
|
||||
from certifi import contents, where
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-c", "--contents", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.contents:
|
||||
print(contents())
|
||||
else:
|
||||
print(where())
|
||||
4325
django后端代码/venv/lib/python3.7/site-packages/certifi/cacert.pem
Normal file
4325
django后端代码/venv/lib/python3.7/site-packages/certifi/cacert.pem
Normal file
File diff suppressed because it is too large
Load Diff
60
django后端代码/venv/lib/python3.7/site-packages/certifi/core.py
Normal file
60
django后端代码/venv/lib/python3.7/site-packages/certifi/core.py
Normal file
@ -0,0 +1,60 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
certifi.py
|
||||
~~~~~~~~~~
|
||||
|
||||
This module returns the installation location of cacert.pem or its contents.
|
||||
"""
|
||||
import os
|
||||
|
||||
try:
|
||||
from importlib.resources import path as get_path, read_text
|
||||
|
||||
_CACERT_CTX = None
|
||||
_CACERT_PATH = None
|
||||
|
||||
def where():
|
||||
# This is slightly terrible, but we want to delay extracting the file
|
||||
# in cases where we're inside of a zipimport situation until someone
|
||||
# actually calls where(), but we don't want to re-extract the file
|
||||
# on every call of where(), so we'll do it once then store it in a
|
||||
# global variable.
|
||||
global _CACERT_CTX
|
||||
global _CACERT_PATH
|
||||
if _CACERT_PATH is None:
|
||||
# This is slightly janky, the importlib.resources API wants you to
|
||||
# manage the cleanup of this file, so it doesn't actually return a
|
||||
# path, it returns a context manager that will give you the path
|
||||
# when you enter it and will do any cleanup when you leave it. In
|
||||
# the common case of not needing a temporary file, it will just
|
||||
# return the file system location and the __exit__() is a no-op.
|
||||
#
|
||||
# We also have to hold onto the actual context manager, because
|
||||
# it will do the cleanup whenever it gets garbage collected, so
|
||||
# we will also store that at the global level as well.
|
||||
_CACERT_CTX = get_path("certifi", "cacert.pem")
|
||||
_CACERT_PATH = str(_CACERT_CTX.__enter__())
|
||||
|
||||
return _CACERT_PATH
|
||||
|
||||
|
||||
except ImportError:
|
||||
# This fallback will work for Python versions prior to 3.7 that lack the
|
||||
# importlib.resources module but relies on the existing `where` function
|
||||
# so won't address issues with environments like PyOxidizer that don't set
|
||||
# __file__ on modules.
|
||||
def read_text(_module, _path, encoding="ascii"):
|
||||
with open(where(), "r", encoding=encoding) as data:
|
||||
return data.read()
|
||||
|
||||
# If we don't have importlib.resources, then we will just do the old logic
|
||||
# of assuming we're on the filesystem and munge the path directly.
|
||||
def where():
|
||||
f = os.path.dirname(__file__)
|
||||
|
||||
return os.path.join(f, "cacert.pem")
|
||||
|
||||
|
||||
def contents():
|
||||
return read_text("certifi", "cacert.pem", encoding="ascii")
|
||||
@ -0,0 +1,70 @@
|
||||
Chardet: The Universal Character Encoding Detector
|
||||
--------------------------------------------------
|
||||
|
||||
.. image:: https://img.shields.io/travis/chardet/chardet/stable.svg
|
||||
:alt: Build status
|
||||
:target: https://travis-ci.org/chardet/chardet
|
||||
|
||||
.. image:: https://img.shields.io/coveralls/chardet/chardet/stable.svg
|
||||
:target: https://coveralls.io/r/chardet/chardet
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/chardet.svg
|
||||
:target: https://warehouse.python.org/project/chardet/
|
||||
:alt: Latest version on PyPI
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/chardet.svg
|
||||
:alt: License
|
||||
|
||||
|
||||
Detects
|
||||
- ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants)
|
||||
- Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese)
|
||||
- EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP (Japanese)
|
||||
- EUC-KR, ISO-2022-KR (Korean)
|
||||
- KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic)
|
||||
- ISO-8859-5, windows-1251 (Bulgarian)
|
||||
- ISO-8859-1, windows-1252 (Western European languages)
|
||||
- ISO-8859-7, windows-1253 (Greek)
|
||||
- ISO-8859-8, windows-1255 (Visual and Logical Hebrew)
|
||||
- TIS-620 (Thai)
|
||||
|
||||
.. note::
|
||||
Our ISO-8859-2 and windows-1250 (Hungarian) probers have been temporarily
|
||||
disabled until we can retrain the models.
|
||||
|
||||
Requires Python 2.6, 2.7, or 3.3+.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install from `PyPI <https://pypi.python.org/pypi/chardet>`_::
|
||||
|
||||
pip install chardet
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
For users, docs are now available at https://chardet.readthedocs.io/.
|
||||
|
||||
Command-line Tool
|
||||
-----------------
|
||||
|
||||
chardet comes with a command-line script which reports on the encodings of one
|
||||
or more files::
|
||||
|
||||
% chardetect somefile someotherfile
|
||||
somefile: windows-1252 with confidence 0.5
|
||||
someotherfile: ascii with confidence 1.0
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
This is a continuation of Mark Pilgrim's excellent chardet. Previously, two
|
||||
versions needed to be maintained: one that supported python 2.x and one that
|
||||
supported python 3.x. We've recently merged with `Ian Cordasco <https://github.com/sigmavirus24>`_'s
|
||||
`charade <https://github.com/sigmavirus24/charade>`_ fork, so now we have one
|
||||
coherent version that works for Python 2.6+.
|
||||
|
||||
:maintainer: Dan Blanchard
|
||||
|
||||
|
||||
@ -0,0 +1 @@
|
||||
pip
|
||||
@ -0,0 +1,96 @@
|
||||
Metadata-Version: 2.0
|
||||
Name: chardet
|
||||
Version: 3.0.4
|
||||
Summary: Universal encoding detector for Python 2 and 3
|
||||
Home-page: https://github.com/chardet/chardet
|
||||
Author: Daniel Blanchard
|
||||
Author-email: dan.blanchard@gmail.com
|
||||
License: LGPL
|
||||
Keywords: encoding,i18n,xml
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.6
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Classifier: Topic :: Text Processing :: Linguistic
|
||||
|
||||
Chardet: The Universal Character Encoding Detector
|
||||
--------------------------------------------------
|
||||
|
||||
.. image:: https://img.shields.io/travis/chardet/chardet/stable.svg
|
||||
:alt: Build status
|
||||
:target: https://travis-ci.org/chardet/chardet
|
||||
|
||||
.. image:: https://img.shields.io/coveralls/chardet/chardet/stable.svg
|
||||
:target: https://coveralls.io/r/chardet/chardet
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/chardet.svg
|
||||
:target: https://warehouse.python.org/project/chardet/
|
||||
:alt: Latest version on PyPI
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/chardet.svg
|
||||
:alt: License
|
||||
|
||||
|
||||
Detects
|
||||
- ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants)
|
||||
- Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese)
|
||||
- EUC-JP, SHIFT_JIS, CP932, ISO-2022-JP (Japanese)
|
||||
- EUC-KR, ISO-2022-KR (Korean)
|
||||
- KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic)
|
||||
- ISO-8859-5, windows-1251 (Bulgarian)
|
||||
- ISO-8859-1, windows-1252 (Western European languages)
|
||||
- ISO-8859-7, windows-1253 (Greek)
|
||||
- ISO-8859-8, windows-1255 (Visual and Logical Hebrew)
|
||||
- TIS-620 (Thai)
|
||||
|
||||
.. note::
|
||||
Our ISO-8859-2 and windows-1250 (Hungarian) probers have been temporarily
|
||||
disabled until we can retrain the models.
|
||||
|
||||
Requires Python 2.6, 2.7, or 3.3+.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install from `PyPI <https://pypi.python.org/pypi/chardet>`_::
|
||||
|
||||
pip install chardet
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
For users, docs are now available at https://chardet.readthedocs.io/.
|
||||
|
||||
Command-line Tool
|
||||
-----------------
|
||||
|
||||
chardet comes with a command-line script which reports on the encodings of one
|
||||
or more files::
|
||||
|
||||
% chardetect somefile someotherfile
|
||||
somefile: windows-1252 with confidence 0.5
|
||||
someotherfile: ascii with confidence 1.0
|
||||
|
||||
About
|
||||
-----
|
||||
|
||||
This is a continuation of Mark Pilgrim's excellent chardet. Previously, two
|
||||
versions needed to be maintained: one that supported python 2.x and one that
|
||||
supported python 3.x. We've recently merged with `Ian Cordasco <https://github.com/sigmavirus24>`_'s
|
||||
`charade <https://github.com/sigmavirus24/charade>`_ fork, so now we have one
|
||||
coherent version that works for Python 2.6+.
|
||||
|
||||
:maintainer: Dan Blanchard
|
||||
|
||||
|
||||
@ -0,0 +1,91 @@
|
||||
../../../bin/chardetect,sha256=xhH48cxYh9W8SaOC9ZSjXWSPZzxKBxsR4mGJWnuhiv0,263
|
||||
chardet-3.0.4.dist-info/DESCRIPTION.rst,sha256=PQ4sBsMyKFZkjC6QpmbpLn0UtCNyeb-ZqvCGEgyZMGk,2174
|
||||
chardet-3.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
chardet-3.0.4.dist-info/METADATA,sha256=RV_2I4B1Z586DL8oVO5Kp7X5bUdQ5EuKAvNoAEF8wSw,3239
|
||||
chardet-3.0.4.dist-info/RECORD,,
|
||||
chardet-3.0.4.dist-info/WHEEL,sha256=o2k-Qa-RMNIJmUdIc7KU6VWR_ErNRbWNlxDIpl7lm34,110
|
||||
chardet-3.0.4.dist-info/entry_points.txt,sha256=fAMmhu5eJ-zAJ-smfqQwRClQ3-nozOCmvJ6-E8lgGJo,60
|
||||
chardet-3.0.4.dist-info/metadata.json,sha256=0htbRM18ujyGZDdfowgAqj6Hq2eQtwzwyhaEveKntgo,1375
|
||||
chardet-3.0.4.dist-info/top_level.txt,sha256=AowzBbZy4x8EirABDdJSLJZMkJ_53iIag8xfKR6D7kI,8
|
||||
chardet/__init__.py,sha256=YsP5wQlsHJ2auF1RZJfypiSrCA7_bQiRm3ES_NI76-Y,1559
|
||||
chardet/__pycache__/__init__.cpython-37.pyc,,
|
||||
chardet/__pycache__/big5freq.cpython-37.pyc,,
|
||||
chardet/__pycache__/big5prober.cpython-37.pyc,,
|
||||
chardet/__pycache__/chardistribution.cpython-37.pyc,,
|
||||
chardet/__pycache__/charsetgroupprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/charsetprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/codingstatemachine.cpython-37.pyc,,
|
||||
chardet/__pycache__/compat.cpython-37.pyc,,
|
||||
chardet/__pycache__/cp949prober.cpython-37.pyc,,
|
||||
chardet/__pycache__/enums.cpython-37.pyc,,
|
||||
chardet/__pycache__/escprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/escsm.cpython-37.pyc,,
|
||||
chardet/__pycache__/eucjpprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/euckrfreq.cpython-37.pyc,,
|
||||
chardet/__pycache__/euckrprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/euctwfreq.cpython-37.pyc,,
|
||||
chardet/__pycache__/euctwprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/gb2312freq.cpython-37.pyc,,
|
||||
chardet/__pycache__/gb2312prober.cpython-37.pyc,,
|
||||
chardet/__pycache__/hebrewprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/jisfreq.cpython-37.pyc,,
|
||||
chardet/__pycache__/jpcntx.cpython-37.pyc,,
|
||||
chardet/__pycache__/langbulgarianmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langcyrillicmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langgreekmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langhebrewmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langhungarianmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langthaimodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/langturkishmodel.cpython-37.pyc,,
|
||||
chardet/__pycache__/latin1prober.cpython-37.pyc,,
|
||||
chardet/__pycache__/mbcharsetprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/mbcsgroupprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/mbcssm.cpython-37.pyc,,
|
||||
chardet/__pycache__/sbcharsetprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/sbcsgroupprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/sjisprober.cpython-37.pyc,,
|
||||
chardet/__pycache__/universaldetector.cpython-37.pyc,,
|
||||
chardet/__pycache__/utf8prober.cpython-37.pyc,,
|
||||
chardet/__pycache__/version.cpython-37.pyc,,
|
||||
chardet/big5freq.py,sha256=D_zK5GyzoVsRes0HkLJziltFQX0bKCLOrFe9_xDvO_8,31254
|
||||
chardet/big5prober.py,sha256=kBxHbdetBpPe7xrlb-e990iot64g_eGSLd32lB7_h3M,1757
|
||||
chardet/chardistribution.py,sha256=3woWS62KrGooKyqz4zQSnjFbJpa6V7g02daAibTwcl8,9411
|
||||
chardet/charsetgroupprober.py,sha256=6bDu8YIiRuScX4ca9Igb0U69TA2PGXXDej6Cc4_9kO4,3787
|
||||
chardet/charsetprober.py,sha256=KSmwJErjypyj0bRZmC5F5eM7c8YQgLYIjZXintZNstg,5110
|
||||
chardet/cli/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
||||
chardet/cli/__pycache__/__init__.cpython-37.pyc,,
|
||||
chardet/cli/__pycache__/chardetect.cpython-37.pyc,,
|
||||
chardet/cli/chardetect.py,sha256=YBO8L4mXo0WR6_-Fjh_8QxPBoEBNqB9oNxNrdc54AQs,2738
|
||||
chardet/codingstatemachine.py,sha256=VYp_6cyyki5sHgXDSZnXW4q1oelHc3cu9AyQTX7uug8,3590
|
||||
chardet/compat.py,sha256=PKTzHkSbtbHDqS9PyujMbX74q1a8mMpeQTDVsQhZMRw,1134
|
||||
chardet/cp949prober.py,sha256=TZ434QX8zzBsnUvL_8wm4AQVTZ2ZkqEEQL_lNw9f9ow,1855
|
||||
chardet/enums.py,sha256=Aimwdb9as1dJKZaFNUH2OhWIVBVd6ZkJJ_WK5sNY8cU,1661
|
||||
chardet/escprober.py,sha256=kkyqVg1Yw3DIOAMJ2bdlyQgUFQhuHAW8dUGskToNWSc,3950
|
||||
chardet/escsm.py,sha256=RuXlgNvTIDarndvllNCk5WZBIpdCxQ0kcd9EAuxUh84,10510
|
||||
chardet/eucjpprober.py,sha256=iD8Jdp0ISRjgjiVN7f0e8xGeQJ5GM2oeZ1dA8nbSeUw,3749
|
||||
chardet/euckrfreq.py,sha256=-7GdmvgWez4-eO4SuXpa7tBiDi5vRXQ8WvdFAzVaSfo,13546
|
||||
chardet/euckrprober.py,sha256=MqFMTQXxW4HbzIpZ9lKDHB3GN8SP4yiHenTmf8g_PxY,1748
|
||||
chardet/euctwfreq.py,sha256=No1WyduFOgB5VITUA7PLyC5oJRNzRyMbBxaKI1l16MA,31621
|
||||
chardet/euctwprober.py,sha256=13p6EP4yRaxqnP4iHtxHOJ6R2zxHq1_m8hTRjzVZ95c,1747
|
||||
chardet/gb2312freq.py,sha256=JX8lsweKLmnCwmk8UHEQsLgkr_rP_kEbvivC4qPOrlc,20715
|
||||
chardet/gb2312prober.py,sha256=gGvIWi9WhDjE-xQXHvNIyrnLvEbMAYgyUSZ65HUfylw,1754
|
||||
chardet/hebrewprober.py,sha256=c3SZ-K7hvyzGY6JRAZxJgwJ_sUS9k0WYkvMY00YBYFo,13838
|
||||
chardet/jisfreq.py,sha256=vpmJv2Bu0J8gnMVRPHMFefTRvo_ha1mryLig8CBwgOg,25777
|
||||
chardet/jpcntx.py,sha256=PYlNqRUQT8LM3cT5FmHGP0iiscFlTWED92MALvBungo,19643
|
||||
chardet/langbulgarianmodel.py,sha256=1HqQS9Pbtnj1xQgxitJMvw8X6kKr5OockNCZWfEQrPE,12839
|
||||
chardet/langcyrillicmodel.py,sha256=LODajvsetH87yYDDQKA2CULXUH87tI223dhfjh9Zx9c,17948
|
||||
chardet/langgreekmodel.py,sha256=8YAW7bU8YwSJap0kIJSbPMw1BEqzGjWzqcqf0WgUKAA,12688
|
||||
chardet/langhebrewmodel.py,sha256=JSnqmE5E62tDLTPTvLpQsg5gOMO4PbdWRvV7Avkc0HA,11345
|
||||
chardet/langhungarianmodel.py,sha256=RhapYSG5l0ZaO-VV4Fan5sW0WRGQqhwBM61yx3yxyOA,12592
|
||||
chardet/langthaimodel.py,sha256=8l0173Gu_W6G8mxmQOTEF4ls2YdE7FxWf3QkSxEGXJQ,11290
|
||||
chardet/langturkishmodel.py,sha256=W22eRNJsqI6uWAfwXSKVWWnCerYqrI8dZQTm_M0lRFk,11102
|
||||
chardet/latin1prober.py,sha256=S2IoORhFk39FEFOlSFWtgVybRiP6h7BlLldHVclNkU8,5370
|
||||
chardet/mbcharsetprober.py,sha256=AR95eFH9vuqSfvLQZN-L5ijea25NOBCoXqw8s5O9xLQ,3413
|
||||
chardet/mbcsgroupprober.py,sha256=h6TRnnYq2OxG1WdD5JOyxcdVpn7dG0q-vB8nWr5mbh4,2012
|
||||
chardet/mbcssm.py,sha256=SY32wVIF3HzcjY3BaEspy9metbNSKxIIB0RKPn7tjpI,25481
|
||||
chardet/sbcharsetprober.py,sha256=LDSpCldDCFlYwUkGkwD2oFxLlPWIWXT09akH_2PiY74,5657
|
||||
chardet/sbcsgroupprober.py,sha256=1IprcCB_k1qfmnxGC6MBbxELlKqD3scW6S8YIwdeyXA,3546
|
||||
chardet/sjisprober.py,sha256=IIt-lZj0WJqK4rmUZzKZP4GJlE8KUEtFYVuY96ek5MQ,3774
|
||||
chardet/universaldetector.py,sha256=qL0174lSZE442eB21nnktT9_VcAye07laFWUeUrjttY,12485
|
||||
chardet/utf8prober.py,sha256=IdD8v3zWOsB8OLiyPi-y_fqwipRFxV9Nc1eKBLSuIEw,2766
|
||||
chardet/version.py,sha256=sp3B08mrDXB-pf3K9fqJ_zeDHOCLC8RrngQyDFap_7g,242
|
||||
@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.29.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
[console_scripts]
|
||||
chardetect = chardet.cli.chardetect:main
|
||||
|
||||
@ -0,0 +1 @@
|
||||
{"classifiers": ["Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Linguistic"], "extensions": {"python.commands": {"wrap_console": {"chardetect": "chardet.cli.chardetect:main"}}, "python.details": {"contacts": [{"email": "dan.blanchard@gmail.com", "name": "Daniel Blanchard", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/chardet/chardet"}}, "python.exports": {"console_scripts": {"chardetect": "chardet.cli.chardetect:main"}}}, "generator": "bdist_wheel (0.29.0)", "keywords": ["encoding", "i18n", "xml"], "license": "LGPL", "metadata_version": "2.0", "name": "chardet", "summary": "Universal encoding detector for Python 2 and 3", "test_requires": [{"requires": ["hypothesis", "pytest"]}], "version": "3.0.4"}
|
||||
@ -0,0 +1 @@
|
||||
chardet
|
||||
@ -0,0 +1,39 @@
|
||||
######################## BEGIN LICENSE BLOCK ########################
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
######################### END LICENSE BLOCK #########################
|
||||
|
||||
|
||||
from .compat import PY2, PY3
|
||||
from .universaldetector import UniversalDetector
|
||||
from .version import __version__, VERSION
|
||||
|
||||
|
||||
def detect(byte_str):
|
||||
"""
|
||||
Detect the encoding of the given byte string.
|
||||
|
||||
:param byte_str: The byte sequence to examine.
|
||||
:type byte_str: ``bytes`` or ``bytearray``
|
||||
"""
|
||||
if not isinstance(byte_str, bytearray):
|
||||
if not isinstance(byte_str, bytes):
|
||||
raise TypeError('Expected object of type bytes or bytearray, got: '
|
||||
'{0}'.format(type(byte_str)))
|
||||
else:
|
||||
byte_str = bytearray(byte_str)
|
||||
detector = UniversalDetector()
|
||||
detector.feed(byte_str)
|
||||
return detector.close()
|
||||
386
django后端代码/venv/lib/python3.7/site-packages/chardet/big5freq.py
Normal file
386
django后端代码/venv/lib/python3.7/site-packages/chardet/big5freq.py
Normal file
@ -0,0 +1,386 @@
|
||||
######################## BEGIN LICENSE BLOCK ########################
|
||||
# The Original Code is Mozilla Communicator client code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Pilgrim - port to Python
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
######################### END LICENSE BLOCK #########################
|
||||
|
||||
# Big5 frequency table
|
||||
# by Taiwan's Mandarin Promotion Council
|
||||
# <http://www.edu.tw:81/mandr/>
|
||||
#
|
||||
# 128 --> 0.42261
|
||||
# 256 --> 0.57851
|
||||
# 512 --> 0.74851
|
||||
# 1024 --> 0.89384
|
||||
# 2048 --> 0.97583
|
||||
#
|
||||
# Ideal Distribution Ratio = 0.74851/(1-0.74851) =2.98
|
||||
# Random Distribution Ration = 512/(5401-512)=0.105
|
||||
#
|
||||
# Typical Distribution Ratio about 25% of Ideal one, still much higher than RDR
|
||||
|
||||
BIG5_TYPICAL_DISTRIBUTION_RATIO = 0.75
|
||||
|
||||
#Char to FreqOrder table
|
||||
BIG5_TABLE_SIZE = 5376
|
||||
|
||||
BIG5_CHAR_TO_FREQ_ORDER = (
|
||||
1,1801,1506, 255,1431, 198, 9, 82, 6,5008, 177, 202,3681,1256,2821, 110, # 16
|
||||
3814, 33,3274, 261, 76, 44,2114, 16,2946,2187,1176, 659,3971, 26,3451,2653, # 32
|
||||
1198,3972,3350,4202, 410,2215, 302, 590, 361,1964, 8, 204, 58,4510,5009,1932, # 48
|
||||
63,5010,5011, 317,1614, 75, 222, 159,4203,2417,1480,5012,3555,3091, 224,2822, # 64
|
||||
3682, 3, 10,3973,1471, 29,2787,1135,2866,1940, 873, 130,3275,1123, 312,5013, # 80
|
||||
4511,2052, 507, 252, 682,5014, 142,1915, 124, 206,2947, 34,3556,3204, 64, 604, # 96
|
||||
5015,2501,1977,1978, 155,1991, 645, 641,1606,5016,3452, 337, 72, 406,5017, 80, # 112
|
||||
630, 238,3205,1509, 263, 939,1092,2654, 756,1440,1094,3453, 449, 69,2987, 591, # 128
|
||||
179,2096, 471, 115,2035,1844, 60, 50,2988, 134, 806,1869, 734,2036,3454, 180, # 144
|
||||
995,1607, 156, 537,2907, 688,5018, 319,1305, 779,2145, 514,2379, 298,4512, 359, # 160
|
||||
2502, 90,2716,1338, 663, 11, 906,1099,2553, 20,2441, 182, 532,1716,5019, 732, # 176
|
||||
1376,4204,1311,1420,3206, 25,2317,1056, 113, 399, 382,1950, 242,3455,2474, 529, # 192
|
||||
3276, 475,1447,3683,5020, 117, 21, 656, 810,1297,2300,2334,3557,5021, 126,4205, # 208
|
||||
706, 456, 150, 613,4513, 71,1118,2037,4206, 145,3092, 85, 835, 486,2115,1246, # 224
|
||||
1426, 428, 727,1285,1015, 800, 106, 623, 303,1281,5022,2128,2359, 347,3815, 221, # 240
|
||||
3558,3135,5023,1956,1153,4207, 83, 296,1199,3093, 192, 624, 93,5024, 822,1898, # 256
|
||||
2823,3136, 795,2065, 991,1554,1542,1592, 27, 43,2867, 859, 139,1456, 860,4514, # 272
|
||||
437, 712,3974, 164,2397,3137, 695, 211,3037,2097, 195,3975,1608,3559,3560,3684, # 288
|
||||
3976, 234, 811,2989,2098,3977,2233,1441,3561,1615,2380, 668,2077,1638, 305, 228, # 304
|
||||
1664,4515, 467, 415,5025, 262,2099,1593, 239, 108, 300, 200,1033, 512,1247,2078, # 320
|
||||
5026,5027,2176,3207,3685,2682, 593, 845,1062,3277, 88,1723,2038,3978,1951, 212, # 336
|
||||
266, 152, 149, 468,1899,4208,4516, 77, 187,5028,3038, 37, 5,2990,5029,3979, # 352
|
||||
5030,5031, 39,2524,4517,2908,3208,2079, 55, 148, 74,4518, 545, 483,1474,1029, # 368
|
||||
1665, 217,1870,1531,3138,1104,2655,4209, 24, 172,3562, 900,3980,3563,3564,4519, # 384
|
||||
32,1408,2824,1312, 329, 487,2360,2251,2717, 784,2683, 4,3039,3351,1427,1789, # 400
|
||||
188, 109, 499,5032,3686,1717,1790, 888,1217,3040,4520,5033,3565,5034,3352,1520, # 416
|
||||
3687,3981, 196,1034, 775,5035,5036, 929,1816, 249, 439, 38,5037,1063,5038, 794, # 432
|
||||
3982,1435,2301, 46, 178,3278,2066,5039,2381,5040, 214,1709,4521, 804, 35, 707, # 448
|
||||
324,3688,1601,2554, 140, 459,4210,5041,5042,1365, 839, 272, 978,2262,2580,3456, # 464
|
||||
2129,1363,3689,1423, 697, 100,3094, 48, 70,1231, 495,3139,2196,5043,1294,5044, # 480
|
||||
2080, 462, 586,1042,3279, 853, 256, 988, 185,2382,3457,1698, 434,1084,5045,3458, # 496
|
||||
314,2625,2788,4522,2335,2336, 569,2285, 637,1817,2525, 757,1162,1879,1616,3459, # 512
|
||||
287,1577,2116, 768,4523,1671,2868,3566,2526,1321,3816, 909,2418,5046,4211, 933, # 528
|
||||
3817,4212,2053,2361,1222,4524, 765,2419,1322, 786,4525,5047,1920,1462,1677,2909, # 544
|
||||
1699,5048,4526,1424,2442,3140,3690,2600,3353,1775,1941,3460,3983,4213, 309,1369, # 560
|
||||
1130,2825, 364,2234,1653,1299,3984,3567,3985,3986,2656, 525,1085,3041, 902,2001, # 576
|
||||
1475, 964,4527, 421,1845,1415,1057,2286, 940,1364,3141, 376,4528,4529,1381, 7, # 592
|
||||
2527, 983,2383, 336,1710,2684,1846, 321,3461, 559,1131,3042,2752,1809,1132,1313, # 608
|
||||
265,1481,1858,5049, 352,1203,2826,3280, 167,1089, 420,2827, 776, 792,1724,3568, # 624
|
||||
4214,2443,3281,5050,4215,5051, 446, 229, 333,2753, 901,3818,1200,1557,4530,2657, # 640
|
||||
1921, 395,2754,2685,3819,4216,1836, 125, 916,3209,2626,4531,5052,5053,3820,5054, # 656
|
||||
5055,5056,4532,3142,3691,1133,2555,1757,3462,1510,2318,1409,3569,5057,2146, 438, # 672
|
||||
2601,2910,2384,3354,1068, 958,3043, 461, 311,2869,2686,4217,1916,3210,4218,1979, # 688
|
||||
383, 750,2755,2627,4219, 274, 539, 385,1278,1442,5058,1154,1965, 384, 561, 210, # 704
|
||||
98,1295,2556,3570,5059,1711,2420,1482,3463,3987,2911,1257, 129,5060,3821, 642, # 720
|
||||
523,2789,2790,2658,5061, 141,2235,1333, 68, 176, 441, 876, 907,4220, 603,2602, # 736
|
||||
710, 171,3464, 404, 549, 18,3143,2398,1410,3692,1666,5062,3571,4533,2912,4534, # 752
|
||||
5063,2991, 368,5064, 146, 366, 99, 871,3693,1543, 748, 807,1586,1185, 22,2263, # 768
|
||||
379,3822,3211,5065,3212, 505,1942,2628,1992,1382,2319,5066, 380,2362, 218, 702, # 784
|
||||
1818,1248,3465,3044,3572,3355,3282,5067,2992,3694, 930,3283,3823,5068, 59,5069, # 800
|
||||
585, 601,4221, 497,3466,1112,1314,4535,1802,5070,1223,1472,2177,5071, 749,1837, # 816
|
||||
690,1900,3824,1773,3988,1476, 429,1043,1791,2236,2117, 917,4222, 447,1086,1629, # 832
|
||||
5072, 556,5073,5074,2021,1654, 844,1090, 105, 550, 966,1758,2828,1008,1783, 686, # 848
|
||||
1095,5075,2287, 793,1602,5076,3573,2603,4536,4223,2948,2302,4537,3825, 980,2503, # 864
|
||||
544, 353, 527,4538, 908,2687,2913,5077, 381,2629,1943,1348,5078,1341,1252, 560, # 880
|
||||
3095,5079,3467,2870,5080,2054, 973, 886,2081, 143,4539,5081,5082, 157,3989, 496, # 896
|
||||
4224, 57, 840, 540,2039,4540,4541,3468,2118,1445, 970,2264,1748,1966,2082,4225, # 912
|
||||
3144,1234,1776,3284,2829,3695, 773,1206,2130,1066,2040,1326,3990,1738,1725,4226, # 928
|
||||
279,3145, 51,1544,2604, 423,1578,2131,2067, 173,4542,1880,5083,5084,1583, 264, # 944
|
||||
610,3696,4543,2444, 280, 154,5085,5086,5087,1739, 338,1282,3096, 693,2871,1411, # 960
|
||||
1074,3826,2445,5088,4544,5089,5090,1240, 952,2399,5091,2914,1538,2688, 685,1483, # 976
|
||||
4227,2475,1436, 953,4228,2055,4545, 671,2400, 79,4229,2446,3285, 608, 567,2689, # 992
|
||||
3469,4230,4231,1691, 393,1261,1792,2401,5092,4546,5093,5094,5095,5096,1383,1672, # 1008
|
||||
3827,3213,1464, 522,1119, 661,1150, 216, 675,4547,3991,1432,3574, 609,4548,2690, # 1024
|
||||
2402,5097,5098,5099,4232,3045, 0,5100,2476, 315, 231,2447, 301,3356,4549,2385, # 1040
|
||||
5101, 233,4233,3697,1819,4550,4551,5102, 96,1777,1315,2083,5103, 257,5104,1810, # 1056
|
||||
3698,2718,1139,1820,4234,2022,1124,2164,2791,1778,2659,5105,3097, 363,1655,3214, # 1072
|
||||
5106,2993,5107,5108,5109,3992,1567,3993, 718, 103,3215, 849,1443, 341,3357,2949, # 1088
|
||||
1484,5110,1712, 127, 67, 339,4235,2403, 679,1412, 821,5111,5112, 834, 738, 351, # 1104
|
||||
2994,2147, 846, 235,1497,1881, 418,1993,3828,2719, 186,1100,2148,2756,3575,1545, # 1120
|
||||
1355,2950,2872,1377, 583,3994,4236,2581,2995,5113,1298,3699,1078,2557,3700,2363, # 1136
|
||||
78,3829,3830, 267,1289,2100,2002,1594,4237, 348, 369,1274,2197,2178,1838,4552, # 1152
|
||||
1821,2830,3701,2757,2288,2003,4553,2951,2758, 144,3358, 882,4554,3995,2759,3470, # 1168
|
||||
4555,2915,5114,4238,1726, 320,5115,3996,3046, 788,2996,5116,2831,1774,1327,2873, # 1184
|
||||
3997,2832,5117,1306,4556,2004,1700,3831,3576,2364,2660, 787,2023, 506, 824,3702, # 1200
|
||||
534, 323,4557,1044,3359,2024,1901, 946,3471,5118,1779,1500,1678,5119,1882,4558, # 1216
|
||||
165, 243,4559,3703,2528, 123, 683,4239, 764,4560, 36,3998,1793, 589,2916, 816, # 1232
|
||||
626,1667,3047,2237,1639,1555,1622,3832,3999,5120,4000,2874,1370,1228,1933, 891, # 1248
|
||||
2084,2917, 304,4240,5121, 292,2997,2720,3577, 691,2101,4241,1115,4561, 118, 662, # 1264
|
||||
5122, 611,1156, 854,2386,1316,2875, 2, 386, 515,2918,5123,5124,3286, 868,2238, # 1280
|
||||
1486, 855,2661, 785,2216,3048,5125,1040,3216,3578,5126,3146, 448,5127,1525,5128, # 1296
|
||||
2165,4562,5129,3833,5130,4242,2833,3579,3147, 503, 818,4001,3148,1568, 814, 676, # 1312
|
||||
1444, 306,1749,5131,3834,1416,1030, 197,1428, 805,2834,1501,4563,5132,5133,5134, # 1328
|
||||
1994,5135,4564,5136,5137,2198, 13,2792,3704,2998,3149,1229,1917,5138,3835,2132, # 1344
|
||||
5139,4243,4565,2404,3580,5140,2217,1511,1727,1120,5141,5142, 646,3836,2448, 307, # 1360
|
||||
5143,5144,1595,3217,5145,5146,5147,3705,1113,1356,4002,1465,2529,2530,5148, 519, # 1376
|
||||
5149, 128,2133, 92,2289,1980,5150,4003,1512, 342,3150,2199,5151,2793,2218,1981, # 1392
|
||||
3360,4244, 290,1656,1317, 789, 827,2365,5152,3837,4566, 562, 581,4004,5153, 401, # 1408
|
||||
4567,2252, 94,4568,5154,1399,2794,5155,1463,2025,4569,3218,1944,5156, 828,1105, # 1424
|
||||
4245,1262,1394,5157,4246, 605,4570,5158,1784,2876,5159,2835, 819,2102, 578,2200, # 1440
|
||||
2952,5160,1502, 436,3287,4247,3288,2836,4005,2919,3472,3473,5161,2721,2320,5162, # 1456
|
||||
5163,2337,2068, 23,4571, 193, 826,3838,2103, 699,1630,4248,3098, 390,1794,1064, # 1472
|
||||
3581,5164,1579,3099,3100,1400,5165,4249,1839,1640,2877,5166,4572,4573, 137,4250, # 1488
|
||||
598,3101,1967, 780, 104, 974,2953,5167, 278, 899, 253, 402, 572, 504, 493,1339, # 1504
|
||||
5168,4006,1275,4574,2582,2558,5169,3706,3049,3102,2253, 565,1334,2722, 863, 41, # 1520
|
||||
5170,5171,4575,5172,1657,2338, 19, 463,2760,4251, 606,5173,2999,3289,1087,2085, # 1536
|
||||
1323,2662,3000,5174,1631,1623,1750,4252,2691,5175,2878, 791,2723,2663,2339, 232, # 1552
|
||||
2421,5176,3001,1498,5177,2664,2630, 755,1366,3707,3290,3151,2026,1609, 119,1918, # 1568
|
||||
3474, 862,1026,4253,5178,4007,3839,4576,4008,4577,2265,1952,2477,5179,1125, 817, # 1584
|
||||
4254,4255,4009,1513,1766,2041,1487,4256,3050,3291,2837,3840,3152,5180,5181,1507, # 1600
|
||||
5182,2692, 733, 40,1632,1106,2879, 345,4257, 841,2531, 230,4578,3002,1847,3292, # 1616
|
||||
3475,5183,1263, 986,3476,5184, 735, 879, 254,1137, 857, 622,1300,1180,1388,1562, # 1632
|
||||
4010,4011,2954, 967,2761,2665,1349, 592,2134,1692,3361,3003,1995,4258,1679,4012, # 1648
|
||||
1902,2188,5185, 739,3708,2724,1296,1290,5186,4259,2201,2202,1922,1563,2605,2559, # 1664
|
||||
1871,2762,3004,5187, 435,5188, 343,1108, 596, 17,1751,4579,2239,3477,3709,5189, # 1680
|
||||
4580, 294,3582,2955,1693, 477, 979, 281,2042,3583, 643,2043,3710,2631,2795,2266, # 1696
|
||||
1031,2340,2135,2303,3584,4581, 367,1249,2560,5190,3585,5191,4582,1283,3362,2005, # 1712
|
||||
240,1762,3363,4583,4584, 836,1069,3153, 474,5192,2149,2532, 268,3586,5193,3219, # 1728
|
||||
1521,1284,5194,1658,1546,4260,5195,3587,3588,5196,4261,3364,2693,1685,4262, 961, # 1744
|
||||
1673,2632, 190,2006,2203,3841,4585,4586,5197, 570,2504,3711,1490,5198,4587,2633, # 1760
|
||||
3293,1957,4588, 584,1514, 396,1045,1945,5199,4589,1968,2449,5200,5201,4590,4013, # 1776
|
||||
619,5202,3154,3294, 215,2007,2796,2561,3220,4591,3221,4592, 763,4263,3842,4593, # 1792
|
||||
5203,5204,1958,1767,2956,3365,3712,1174, 452,1477,4594,3366,3155,5205,2838,1253, # 1808
|
||||
2387,2189,1091,2290,4264, 492,5206, 638,1169,1825,2136,1752,4014, 648, 926,1021, # 1824
|
||||
1324,4595, 520,4596, 997, 847,1007, 892,4597,3843,2267,1872,3713,2405,1785,4598, # 1840
|
||||
1953,2957,3103,3222,1728,4265,2044,3714,4599,2008,1701,3156,1551, 30,2268,4266, # 1856
|
||||
5207,2027,4600,3589,5208, 501,5209,4267, 594,3478,2166,1822,3590,3479,3591,3223, # 1872
|
||||
829,2839,4268,5210,1680,3157,1225,4269,5211,3295,4601,4270,3158,2341,5212,4602, # 1888
|
||||
4271,5213,4015,4016,5214,1848,2388,2606,3367,5215,4603, 374,4017, 652,4272,4273, # 1904
|
||||
375,1140, 798,5216,5217,5218,2366,4604,2269, 546,1659, 138,3051,2450,4605,5219, # 1920
|
||||
2254, 612,1849, 910, 796,3844,1740,1371, 825,3845,3846,5220,2920,2562,5221, 692, # 1936
|
||||
444,3052,2634, 801,4606,4274,5222,1491, 244,1053,3053,4275,4276, 340,5223,4018, # 1952
|
||||
1041,3005, 293,1168, 87,1357,5224,1539, 959,5225,2240, 721, 694,4277,3847, 219, # 1968
|
||||
1478, 644,1417,3368,2666,1413,1401,1335,1389,4019,5226,5227,3006,2367,3159,1826, # 1984
|
||||
730,1515, 184,2840, 66,4607,5228,1660,2958, 246,3369, 378,1457, 226,3480, 975, # 2000
|
||||
4020,2959,1264,3592, 674, 696,5229, 163,5230,1141,2422,2167, 713,3593,3370,4608, # 2016
|
||||
4021,5231,5232,1186, 15,5233,1079,1070,5234,1522,3224,3594, 276,1050,2725, 758, # 2032
|
||||
1126, 653,2960,3296,5235,2342, 889,3595,4022,3104,3007, 903,1250,4609,4023,3481, # 2048
|
||||
3596,1342,1681,1718, 766,3297, 286, 89,2961,3715,5236,1713,5237,2607,3371,3008, # 2064
|
||||
5238,2962,2219,3225,2880,5239,4610,2505,2533, 181, 387,1075,4024, 731,2190,3372, # 2080
|
||||
5240,3298, 310, 313,3482,2304, 770,4278, 54,3054, 189,4611,3105,3848,4025,5241, # 2096
|
||||
1230,1617,1850, 355,3597,4279,4612,3373, 111,4280,3716,1350,3160,3483,3055,4281, # 2112
|
||||
2150,3299,3598,5242,2797,4026,4027,3009, 722,2009,5243,1071, 247,1207,2343,2478, # 2128
|
||||
1378,4613,2010, 864,1437,1214,4614, 373,3849,1142,2220, 667,4615, 442,2763,2563, # 2144
|
||||
3850,4028,1969,4282,3300,1840, 837, 170,1107, 934,1336,1883,5244,5245,2119,4283, # 2160
|
||||
2841, 743,1569,5246,4616,4284, 582,2389,1418,3484,5247,1803,5248, 357,1395,1729, # 2176
|
||||
3717,3301,2423,1564,2241,5249,3106,3851,1633,4617,1114,2086,4285,1532,5250, 482, # 2192
|
||||
2451,4618,5251,5252,1492, 833,1466,5253,2726,3599,1641,2842,5254,1526,1272,3718, # 2208
|
||||
4286,1686,1795, 416,2564,1903,1954,1804,5255,3852,2798,3853,1159,2321,5256,2881, # 2224
|
||||
4619,1610,1584,3056,2424,2764, 443,3302,1163,3161,5257,5258,4029,5259,4287,2506, # 2240
|
||||
3057,4620,4030,3162,2104,1647,3600,2011,1873,4288,5260,4289, 431,3485,5261, 250, # 2256
|
||||
97, 81,4290,5262,1648,1851,1558, 160, 848,5263, 866, 740,1694,5264,2204,2843, # 2272
|
||||
3226,4291,4621,3719,1687, 950,2479, 426, 469,3227,3720,3721,4031,5265,5266,1188, # 2288
|
||||
424,1996, 861,3601,4292,3854,2205,2694, 168,1235,3602,4293,5267,2087,1674,4622, # 2304
|
||||
3374,3303, 220,2565,1009,5268,3855, 670,3010, 332,1208, 717,5269,5270,3603,2452, # 2320
|
||||
4032,3375,5271, 513,5272,1209,2882,3376,3163,4623,1080,5273,5274,5275,5276,2534, # 2336
|
||||
3722,3604, 815,1587,4033,4034,5277,3605,3486,3856,1254,4624,1328,3058,1390,4035, # 2352
|
||||
1741,4036,3857,4037,5278, 236,3858,2453,3304,5279,5280,3723,3859,1273,3860,4625, # 2368
|
||||
5281, 308,5282,4626, 245,4627,1852,2480,1307,2583, 430, 715,2137,2454,5283, 270, # 2384
|
||||
199,2883,4038,5284,3606,2727,1753, 761,1754, 725,1661,1841,4628,3487,3724,5285, # 2400
|
||||
5286, 587, 14,3305, 227,2608, 326, 480,2270, 943,2765,3607, 291, 650,1884,5287, # 2416
|
||||
1702,1226, 102,1547, 62,3488, 904,4629,3489,1164,4294,5288,5289,1224,1548,2766, # 2432
|
||||
391, 498,1493,5290,1386,1419,5291,2056,1177,4630, 813, 880,1081,2368, 566,1145, # 2448
|
||||
4631,2291,1001,1035,2566,2609,2242, 394,1286,5292,5293,2069,5294, 86,1494,1730, # 2464
|
||||
4039, 491,1588, 745, 897,2963, 843,3377,4040,2767,2884,3306,1768, 998,2221,2070, # 2480
|
||||
397,1827,1195,1970,3725,3011,3378, 284,5295,3861,2507,2138,2120,1904,5296,4041, # 2496
|
||||
2151,4042,4295,1036,3490,1905, 114,2567,4296, 209,1527,5297,5298,2964,2844,2635, # 2512
|
||||
2390,2728,3164, 812,2568,5299,3307,5300,1559, 737,1885,3726,1210, 885, 28,2695, # 2528
|
||||
3608,3862,5301,4297,1004,1780,4632,5302, 346,1982,2222,2696,4633,3863,1742, 797, # 2544
|
||||
1642,4043,1934,1072,1384,2152, 896,4044,3308,3727,3228,2885,3609,5303,2569,1959, # 2560
|
||||
4634,2455,1786,5304,5305,5306,4045,4298,1005,1308,3728,4299,2729,4635,4636,1528, # 2576
|
||||
2610, 161,1178,4300,1983, 987,4637,1101,4301, 631,4046,1157,3229,2425,1343,1241, # 2592
|
||||
1016,2243,2570, 372, 877,2344,2508,1160, 555,1935, 911,4047,5307, 466,1170, 169, # 2608
|
||||
1051,2921,2697,3729,2481,3012,1182,2012,2571,1251,2636,5308, 992,2345,3491,1540, # 2624
|
||||
2730,1201,2071,2406,1997,2482,5309,4638, 528,1923,2191,1503,1874,1570,2369,3379, # 2640
|
||||
3309,5310, 557,1073,5311,1828,3492,2088,2271,3165,3059,3107, 767,3108,2799,4639, # 2656
|
||||
1006,4302,4640,2346,1267,2179,3730,3230, 778,4048,3231,2731,1597,2667,5312,4641, # 2672
|
||||
5313,3493,5314,5315,5316,3310,2698,1433,3311, 131, 95,1504,4049, 723,4303,3166, # 2688
|
||||
1842,3610,2768,2192,4050,2028,2105,3731,5317,3013,4051,1218,5318,3380,3232,4052, # 2704
|
||||
4304,2584, 248,1634,3864, 912,5319,2845,3732,3060,3865, 654, 53,5320,3014,5321, # 2720
|
||||
1688,4642, 777,3494,1032,4053,1425,5322, 191, 820,2121,2846, 971,4643, 931,3233, # 2736
|
||||
135, 664, 783,3866,1998, 772,2922,1936,4054,3867,4644,2923,3234, 282,2732, 640, # 2752
|
||||
1372,3495,1127, 922, 325,3381,5323,5324, 711,2045,5325,5326,4055,2223,2800,1937, # 2768
|
||||
4056,3382,2224,2255,3868,2305,5327,4645,3869,1258,3312,4057,3235,2139,2965,4058, # 2784
|
||||
4059,5328,2225, 258,3236,4646, 101,1227,5329,3313,1755,5330,1391,3314,5331,2924, # 2800
|
||||
2057, 893,5332,5333,5334,1402,4305,2347,5335,5336,3237,3611,5337,5338, 878,1325, # 2816
|
||||
1781,2801,4647, 259,1385,2585, 744,1183,2272,4648,5339,4060,2509,5340, 684,1024, # 2832
|
||||
4306,5341, 472,3612,3496,1165,3315,4061,4062, 322,2153, 881, 455,1695,1152,1340, # 2848
|
||||
660, 554,2154,4649,1058,4650,4307, 830,1065,3383,4063,4651,1924,5342,1703,1919, # 2864
|
||||
5343, 932,2273, 122,5344,4652, 947, 677,5345,3870,2637, 297,1906,1925,2274,4653, # 2880
|
||||
2322,3316,5346,5347,4308,5348,4309, 84,4310, 112, 989,5349, 547,1059,4064, 701, # 2896
|
||||
3613,1019,5350,4311,5351,3497, 942, 639, 457,2306,2456, 993,2966, 407, 851, 494, # 2912
|
||||
4654,3384, 927,5352,1237,5353,2426,3385, 573,4312, 680, 921,2925,1279,1875, 285, # 2928
|
||||
790,1448,1984, 719,2168,5354,5355,4655,4065,4066,1649,5356,1541, 563,5357,1077, # 2944
|
||||
5358,3386,3061,3498, 511,3015,4067,4068,3733,4069,1268,2572,3387,3238,4656,4657, # 2960
|
||||
5359, 535,1048,1276,1189,2926,2029,3167,1438,1373,2847,2967,1134,2013,5360,4313, # 2976
|
||||
1238,2586,3109,1259,5361, 700,5362,2968,3168,3734,4314,5363,4315,1146,1876,1907, # 2992
|
||||
4658,2611,4070, 781,2427, 132,1589, 203, 147, 273,2802,2407, 898,1787,2155,4071, # 3008
|
||||
4072,5364,3871,2803,5365,5366,4659,4660,5367,3239,5368,1635,3872, 965,5369,1805, # 3024
|
||||
2699,1516,3614,1121,1082,1329,3317,4073,1449,3873, 65,1128,2848,2927,2769,1590, # 3040
|
||||
3874,5370,5371, 12,2668, 45, 976,2587,3169,4661, 517,2535,1013,1037,3240,5372, # 3056
|
||||
3875,2849,5373,3876,5374,3499,5375,2612, 614,1999,2323,3877,3110,2733,2638,5376, # 3072
|
||||
2588,4316, 599,1269,5377,1811,3735,5378,2700,3111, 759,1060, 489,1806,3388,3318, # 3088
|
||||
1358,5379,5380,2391,1387,1215,2639,2256, 490,5381,5382,4317,1759,2392,2348,5383, # 3104
|
||||
4662,3878,1908,4074,2640,1807,3241,4663,3500,3319,2770,2349, 874,5384,5385,3501, # 3120
|
||||
3736,1859, 91,2928,3737,3062,3879,4664,5386,3170,4075,2669,5387,3502,1202,1403, # 3136
|
||||
3880,2969,2536,1517,2510,4665,3503,2511,5388,4666,5389,2701,1886,1495,1731,4076, # 3152
|
||||
2370,4667,5390,2030,5391,5392,4077,2702,1216, 237,2589,4318,2324,4078,3881,4668, # 3168
|
||||
4669,2703,3615,3504, 445,4670,5393,5394,5395,5396,2771, 61,4079,3738,1823,4080, # 3184
|
||||
5397, 687,2046, 935, 925, 405,2670, 703,1096,1860,2734,4671,4081,1877,1367,2704, # 3200
|
||||
3389, 918,2106,1782,2483, 334,3320,1611,1093,4672, 564,3171,3505,3739,3390, 945, # 3216
|
||||
2641,2058,4673,5398,1926, 872,4319,5399,3506,2705,3112, 349,4320,3740,4082,4674, # 3232
|
||||
3882,4321,3741,2156,4083,4675,4676,4322,4677,2408,2047, 782,4084, 400, 251,4323, # 3248
|
||||
1624,5400,5401, 277,3742, 299,1265, 476,1191,3883,2122,4324,4325,1109, 205,5402, # 3264
|
||||
2590,1000,2157,3616,1861,5403,5404,5405,4678,5406,4679,2573, 107,2484,2158,4085, # 3280
|
||||
3507,3172,5407,1533, 541,1301, 158, 753,4326,2886,3617,5408,1696, 370,1088,4327, # 3296
|
||||
4680,3618, 579, 327, 440, 162,2244, 269,1938,1374,3508, 968,3063, 56,1396,3113, # 3312
|
||||
2107,3321,3391,5409,1927,2159,4681,3016,5410,3619,5411,5412,3743,4682,2485,5413, # 3328
|
||||
2804,5414,1650,4683,5415,2613,5416,5417,4086,2671,3392,1149,3393,4087,3884,4088, # 3344
|
||||
5418,1076, 49,5419, 951,3242,3322,3323, 450,2850, 920,5420,1812,2805,2371,4328, # 3360
|
||||
1909,1138,2372,3885,3509,5421,3243,4684,1910,1147,1518,2428,4685,3886,5422,4686, # 3376
|
||||
2393,2614, 260,1796,3244,5423,5424,3887,3324, 708,5425,3620,1704,5426,3621,1351, # 3392
|
||||
1618,3394,3017,1887, 944,4329,3395,4330,3064,3396,4331,5427,3744, 422, 413,1714, # 3408
|
||||
3325, 500,2059,2350,4332,2486,5428,1344,1911, 954,5429,1668,5430,5431,4089,2409, # 3424
|
||||
4333,3622,3888,4334,5432,2307,1318,2512,3114, 133,3115,2887,4687, 629, 31,2851, # 3440
|
||||
2706,3889,4688, 850, 949,4689,4090,2970,1732,2089,4335,1496,1853,5433,4091, 620, # 3456
|
||||
3245, 981,1242,3745,3397,1619,3746,1643,3326,2140,2457,1971,1719,3510,2169,5434, # 3472
|
||||
3246,5435,5436,3398,1829,5437,1277,4690,1565,2048,5438,1636,3623,3116,5439, 869, # 3488
|
||||
2852, 655,3890,3891,3117,4092,3018,3892,1310,3624,4691,5440,5441,5442,1733, 558, # 3504
|
||||
4692,3747, 335,1549,3065,1756,4336,3748,1946,3511,1830,1291,1192, 470,2735,2108, # 3520
|
||||
2806, 913,1054,4093,5443,1027,5444,3066,4094,4693, 982,2672,3399,3173,3512,3247, # 3536
|
||||
3248,1947,2807,5445, 571,4694,5446,1831,5447,3625,2591,1523,2429,5448,2090, 984, # 3552
|
||||
4695,3749,1960,5449,3750, 852, 923,2808,3513,3751, 969,1519, 999,2049,2325,1705, # 3568
|
||||
5450,3118, 615,1662, 151, 597,4095,2410,2326,1049, 275,4696,3752,4337, 568,3753, # 3584
|
||||
3626,2487,4338,3754,5451,2430,2275, 409,3249,5452,1566,2888,3514,1002, 769,2853, # 3600
|
||||
194,2091,3174,3755,2226,3327,4339, 628,1505,5453,5454,1763,2180,3019,4096, 521, # 3616
|
||||
1161,2592,1788,2206,2411,4697,4097,1625,4340,4341, 412, 42,3119, 464,5455,2642, # 3632
|
||||
4698,3400,1760,1571,2889,3515,2537,1219,2207,3893,2643,2141,2373,4699,4700,3328, # 3648
|
||||
1651,3401,3627,5456,5457,3628,2488,3516,5458,3756,5459,5460,2276,2092, 460,5461, # 3664
|
||||
4701,5462,3020, 962, 588,3629, 289,3250,2644,1116, 52,5463,3067,1797,5464,5465, # 3680
|
||||
5466,1467,5467,1598,1143,3757,4342,1985,1734,1067,4702,1280,3402, 465,4703,1572, # 3696
|
||||
510,5468,1928,2245,1813,1644,3630,5469,4704,3758,5470,5471,2673,1573,1534,5472, # 3712
|
||||
5473, 536,1808,1761,3517,3894,3175,2645,5474,5475,5476,4705,3518,2929,1912,2809, # 3728
|
||||
5477,3329,1122, 377,3251,5478, 360,5479,5480,4343,1529, 551,5481,2060,3759,1769, # 3744
|
||||
2431,5482,2930,4344,3330,3120,2327,2109,2031,4706,1404, 136,1468,1479, 672,1171, # 3760
|
||||
3252,2308, 271,3176,5483,2772,5484,2050, 678,2736, 865,1948,4707,5485,2014,4098, # 3776
|
||||
2971,5486,2737,2227,1397,3068,3760,4708,4709,1735,2931,3403,3631,5487,3895, 509, # 3792
|
||||
2854,2458,2890,3896,5488,5489,3177,3178,4710,4345,2538,4711,2309,1166,1010, 552, # 3808
|
||||
681,1888,5490,5491,2972,2973,4099,1287,1596,1862,3179, 358, 453, 736, 175, 478, # 3824
|
||||
1117, 905,1167,1097,5492,1854,1530,5493,1706,5494,2181,3519,2292,3761,3520,3632, # 3840
|
||||
4346,2093,4347,5495,3404,1193,2489,4348,1458,2193,2208,1863,1889,1421,3331,2932, # 3856
|
||||
3069,2182,3521, 595,2123,5496,4100,5497,5498,4349,1707,2646, 223,3762,1359, 751, # 3872
|
||||
3121, 183,3522,5499,2810,3021, 419,2374, 633, 704,3897,2394, 241,5500,5501,5502, # 3888
|
||||
838,3022,3763,2277,2773,2459,3898,1939,2051,4101,1309,3122,2246,1181,5503,1136, # 3904
|
||||
2209,3899,2375,1446,4350,2310,4712,5504,5505,4351,1055,2615, 484,3764,5506,4102, # 3920
|
||||
625,4352,2278,3405,1499,4353,4103,5507,4104,4354,3253,2279,2280,3523,5508,5509, # 3936
|
||||
2774, 808,2616,3765,3406,4105,4355,3123,2539, 526,3407,3900,4356, 955,5510,1620, # 3952
|
||||
4357,2647,2432,5511,1429,3766,1669,1832, 994, 928,5512,3633,1260,5513,5514,5515, # 3968
|
||||
1949,2293, 741,2933,1626,4358,2738,2460, 867,1184, 362,3408,1392,5516,5517,4106, # 3984
|
||||
4359,1770,1736,3254,2934,4713,4714,1929,2707,1459,1158,5518,3070,3409,2891,1292, # 4000
|
||||
1930,2513,2855,3767,1986,1187,2072,2015,2617,4360,5519,2574,2514,2170,3768,2490, # 4016
|
||||
3332,5520,3769,4715,5521,5522, 666,1003,3023,1022,3634,4361,5523,4716,1814,2257, # 4032
|
||||
574,3901,1603, 295,1535, 705,3902,4362, 283, 858, 417,5524,5525,3255,4717,4718, # 4048
|
||||
3071,1220,1890,1046,2281,2461,4107,1393,1599, 689,2575, 388,4363,5526,2491, 802, # 4064
|
||||
5527,2811,3903,2061,1405,2258,5528,4719,3904,2110,1052,1345,3256,1585,5529, 809, # 4080
|
||||
5530,5531,5532, 575,2739,3524, 956,1552,1469,1144,2328,5533,2329,1560,2462,3635, # 4096
|
||||
3257,4108, 616,2210,4364,3180,2183,2294,5534,1833,5535,3525,4720,5536,1319,3770, # 4112
|
||||
3771,1211,3636,1023,3258,1293,2812,5537,5538,5539,3905, 607,2311,3906, 762,2892, # 4128
|
||||
1439,4365,1360,4721,1485,3072,5540,4722,1038,4366,1450,2062,2648,4367,1379,4723, # 4144
|
||||
2593,5541,5542,4368,1352,1414,2330,2935,1172,5543,5544,3907,3908,4724,1798,1451, # 4160
|
||||
5545,5546,5547,5548,2936,4109,4110,2492,2351, 411,4111,4112,3637,3333,3124,4725, # 4176
|
||||
1561,2674,1452,4113,1375,5549,5550, 47,2974, 316,5551,1406,1591,2937,3181,5552, # 4192
|
||||
1025,2142,3125,3182, 354,2740, 884,2228,4369,2412, 508,3772, 726,3638, 996,2433, # 4208
|
||||
3639, 729,5553, 392,2194,1453,4114,4726,3773,5554,5555,2463,3640,2618,1675,2813, # 4224
|
||||
919,2352,2975,2353,1270,4727,4115, 73,5556,5557, 647,5558,3259,2856,2259,1550, # 4240
|
||||
1346,3024,5559,1332, 883,3526,5560,5561,5562,5563,3334,2775,5564,1212, 831,1347, # 4256
|
||||
4370,4728,2331,3909,1864,3073, 720,3910,4729,4730,3911,5565,4371,5566,5567,4731, # 4272
|
||||
5568,5569,1799,4732,3774,2619,4733,3641,1645,2376,4734,5570,2938, 669,2211,2675, # 4288
|
||||
2434,5571,2893,5572,5573,1028,3260,5574,4372,2413,5575,2260,1353,5576,5577,4735, # 4304
|
||||
3183, 518,5578,4116,5579,4373,1961,5580,2143,4374,5581,5582,3025,2354,2355,3912, # 4320
|
||||
516,1834,1454,4117,2708,4375,4736,2229,2620,1972,1129,3642,5583,2776,5584,2976, # 4336
|
||||
1422, 577,1470,3026,1524,3410,5585,5586, 432,4376,3074,3527,5587,2594,1455,2515, # 4352
|
||||
2230,1973,1175,5588,1020,2741,4118,3528,4737,5589,2742,5590,1743,1361,3075,3529, # 4368
|
||||
2649,4119,4377,4738,2295, 895, 924,4378,2171, 331,2247,3076, 166,1627,3077,1098, # 4384
|
||||
5591,1232,2894,2231,3411,4739, 657, 403,1196,2377, 542,3775,3412,1600,4379,3530, # 4400
|
||||
5592,4740,2777,3261, 576, 530,1362,4741,4742,2540,2676,3776,4120,5593, 842,3913, # 4416
|
||||
5594,2814,2032,1014,4121, 213,2709,3413, 665, 621,4380,5595,3777,2939,2435,5596, # 4432
|
||||
2436,3335,3643,3414,4743,4381,2541,4382,4744,3644,1682,4383,3531,1380,5597, 724, # 4448
|
||||
2282, 600,1670,5598,1337,1233,4745,3126,2248,5599,1621,4746,5600, 651,4384,5601, # 4464
|
||||
1612,4385,2621,5602,2857,5603,2743,2312,3078,5604, 716,2464,3079, 174,1255,2710, # 4480
|
||||
4122,3645, 548,1320,1398, 728,4123,1574,5605,1891,1197,3080,4124,5606,3081,3082, # 4496
|
||||
3778,3646,3779, 747,5607, 635,4386,4747,5608,5609,5610,4387,5611,5612,4748,5613, # 4512
|
||||
3415,4749,2437, 451,5614,3780,2542,2073,4388,2744,4389,4125,5615,1764,4750,5616, # 4528
|
||||
4390, 350,4751,2283,2395,2493,5617,4391,4126,2249,1434,4127, 488,4752, 458,4392, # 4544
|
||||
4128,3781, 771,1330,2396,3914,2576,3184,2160,2414,1553,2677,3185,4393,5618,2494, # 4560
|
||||
2895,2622,1720,2711,4394,3416,4753,5619,2543,4395,5620,3262,4396,2778,5621,2016, # 4576
|
||||
2745,5622,1155,1017,3782,3915,5623,3336,2313, 201,1865,4397,1430,5624,4129,5625, # 4592
|
||||
5626,5627,5628,5629,4398,1604,5630, 414,1866, 371,2595,4754,4755,3532,2017,3127, # 4608
|
||||
4756,1708, 960,4399, 887, 389,2172,1536,1663,1721,5631,2232,4130,2356,2940,1580, # 4624
|
||||
5632,5633,1744,4757,2544,4758,4759,5634,4760,5635,2074,5636,4761,3647,3417,2896, # 4640
|
||||
4400,5637,4401,2650,3418,2815, 673,2712,2465, 709,3533,4131,3648,4402,5638,1148, # 4656
|
||||
502, 634,5639,5640,1204,4762,3649,1575,4763,2623,3783,5641,3784,3128, 948,3263, # 4672
|
||||
121,1745,3916,1110,5642,4403,3083,2516,3027,4132,3785,1151,1771,3917,1488,4133, # 4688
|
||||
1987,5643,2438,3534,5644,5645,2094,5646,4404,3918,1213,1407,2816, 531,2746,2545, # 4704
|
||||
3264,1011,1537,4764,2779,4405,3129,1061,5647,3786,3787,1867,2897,5648,2018, 120, # 4720
|
||||
4406,4407,2063,3650,3265,2314,3919,2678,3419,1955,4765,4134,5649,3535,1047,2713, # 4736
|
||||
1266,5650,1368,4766,2858, 649,3420,3920,2546,2747,1102,2859,2679,5651,5652,2000, # 4752
|
||||
5653,1111,3651,2977,5654,2495,3921,3652,2817,1855,3421,3788,5655,5656,3422,2415, # 4768
|
||||
2898,3337,3266,3653,5657,2577,5658,3654,2818,4135,1460, 856,5659,3655,5660,2899, # 4784
|
||||
2978,5661,2900,3922,5662,4408, 632,2517, 875,3923,1697,3924,2296,5663,5664,4767, # 4800
|
||||
3028,1239, 580,4768,4409,5665, 914, 936,2075,1190,4136,1039,2124,5666,5667,5668, # 4816
|
||||
5669,3423,1473,5670,1354,4410,3925,4769,2173,3084,4137, 915,3338,4411,4412,3339, # 4832
|
||||
1605,1835,5671,2748, 398,3656,4413,3926,4138, 328,1913,2860,4139,3927,1331,4414, # 4848
|
||||
3029, 937,4415,5672,3657,4140,4141,3424,2161,4770,3425, 524, 742, 538,3085,1012, # 4864
|
||||
5673,5674,3928,2466,5675, 658,1103, 225,3929,5676,5677,4771,5678,4772,5679,3267, # 4880
|
||||
1243,5680,4142, 963,2250,4773,5681,2714,3658,3186,5682,5683,2596,2332,5684,4774, # 4896
|
||||
5685,5686,5687,3536, 957,3426,2547,2033,1931,2941,2467, 870,2019,3659,1746,2780, # 4912
|
||||
2781,2439,2468,5688,3930,5689,3789,3130,3790,3537,3427,3791,5690,1179,3086,5691, # 4928
|
||||
3187,2378,4416,3792,2548,3188,3131,2749,4143,5692,3428,1556,2549,2297, 977,2901, # 4944
|
||||
2034,4144,1205,3429,5693,1765,3430,3189,2125,1271, 714,1689,4775,3538,5694,2333, # 4960
|
||||
3931, 533,4417,3660,2184, 617,5695,2469,3340,3539,2315,5696,5697,3190,5698,5699, # 4976
|
||||
3932,1988, 618, 427,2651,3540,3431,5700,5701,1244,1690,5702,2819,4418,4776,5703, # 4992
|
||||
3541,4777,5704,2284,1576, 473,3661,4419,3432, 972,5705,3662,5706,3087,5707,5708, # 5008
|
||||
4778,4779,5709,3793,4145,4146,5710, 153,4780, 356,5711,1892,2902,4420,2144, 408, # 5024
|
||||
803,2357,5712,3933,5713,4421,1646,2578,2518,4781,4782,3934,5714,3935,4422,5715, # 5040
|
||||
2416,3433, 752,5716,5717,1962,3341,2979,5718, 746,3030,2470,4783,4423,3794, 698, # 5056
|
||||
4784,1893,4424,3663,2550,4785,3664,3936,5719,3191,3434,5720,1824,1302,4147,2715, # 5072
|
||||
3937,1974,4425,5721,4426,3192, 823,1303,1288,1236,2861,3542,4148,3435, 774,3938, # 5088
|
||||
5722,1581,4786,1304,2862,3939,4787,5723,2440,2162,1083,3268,4427,4149,4428, 344, # 5104
|
||||
1173, 288,2316, 454,1683,5724,5725,1461,4788,4150,2597,5726,5727,4789, 985, 894, # 5120
|
||||
5728,3436,3193,5729,1914,2942,3795,1989,5730,2111,1975,5731,4151,5732,2579,1194, # 5136
|
||||
425,5733,4790,3194,1245,3796,4429,5734,5735,2863,5736, 636,4791,1856,3940, 760, # 5152
|
||||
1800,5737,4430,2212,1508,4792,4152,1894,1684,2298,5738,5739,4793,4431,4432,2213, # 5168
|
||||
479,5740,5741, 832,5742,4153,2496,5743,2980,2497,3797, 990,3132, 627,1815,2652, # 5184
|
||||
4433,1582,4434,2126,2112,3543,4794,5744, 799,4435,3195,5745,4795,2113,1737,3031, # 5200
|
||||
1018, 543, 754,4436,3342,1676,4796,4797,4154,4798,1489,5746,3544,5747,2624,2903, # 5216
|
||||
4155,5748,5749,2981,5750,5751,5752,5753,3196,4799,4800,2185,1722,5754,3269,3270, # 5232
|
||||
1843,3665,1715, 481, 365,1976,1857,5755,5756,1963,2498,4801,5757,2127,3666,3271, # 5248
|
||||
433,1895,2064,2076,5758, 602,2750,5759,5760,5761,5762,5763,3032,1628,3437,5764, # 5264
|
||||
3197,4802,4156,2904,4803,2519,5765,2551,2782,5766,5767,5768,3343,4804,2905,5769, # 5280
|
||||
4805,5770,2864,4806,4807,1221,2982,4157,2520,5771,5772,5773,1868,1990,5774,5775, # 5296
|
||||
5776,1896,5777,5778,4808,1897,4158, 318,5779,2095,4159,4437,5780,5781, 485,5782, # 5312
|
||||
938,3941, 553,2680, 116,5783,3942,3667,5784,3545,2681,2783,3438,3344,2820,5785, # 5328
|
||||
3668,2943,4160,1747,2944,2983,5786,5787, 207,5788,4809,5789,4810,2521,5790,3033, # 5344
|
||||
890,3669,3943,5791,1878,3798,3439,5792,2186,2358,3440,1652,5793,5794,5795, 941, # 5360
|
||||
2299, 208,3546,4161,2020, 330,4438,3944,2906,2499,3799,4439,4811,5796,5797,5798, # 5376
|
||||
)
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
######################## BEGIN LICENSE BLOCK ########################
|
||||
# The Original Code is Mozilla Communicator client code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Pilgrim - port to Python
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
######################### END LICENSE BLOCK #########################
|
||||
|
||||
from .mbcharsetprober import MultiByteCharSetProber
|
||||
from .codingstatemachine import CodingStateMachine
|
||||
from .chardistribution import Big5DistributionAnalysis
|
||||
from .mbcssm import BIG5_SM_MODEL
|
||||
|
||||
|
||||
class Big5Prober(MultiByteCharSetProber):
|
||||
def __init__(self):
|
||||
super(Big5Prober, self).__init__()
|
||||
self.coding_sm = CodingStateMachine(BIG5_SM_MODEL)
|
||||
self.distribution_analyzer = Big5DistributionAnalysis()
|
||||
self.reset()
|
||||
|
||||
@property
|
||||
def charset_name(self):
|
||||
return "Big5"
|
||||
|
||||
@property
|
||||
def language(self):
|
||||
return "Chinese"
|
||||
@ -0,0 +1,233 @@
|
||||
######################## BEGIN LICENSE BLOCK ########################
|
||||
# The Original Code is Mozilla Communicator client code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Mark Pilgrim - port to Python
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2.1 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
######################### END LICENSE BLOCK #########################
|
||||
|
||||
from .euctwfreq import (EUCTW_CHAR_TO_FREQ_ORDER, EUCTW_TABLE_SIZE,
|
||||
EUCTW_TYPICAL_DISTRIBUTION_RATIO)
|
||||
from .euckrfreq import (EUCKR_CHAR_TO_FREQ_ORDER, EUCKR_TABLE_SIZE,
|
||||
EUCKR_TYPICAL_DISTRIBUTION_RATIO)
|
||||
from .gb2312freq import (GB2312_CHAR_TO_FREQ_ORDER, GB2312_TABLE_SIZE,
|
||||
GB2312_TYPICAL_DISTRIBUTION_RATIO)
|
||||
from .big5freq import (BIG5_CHAR_TO_FREQ_ORDER, BIG5_TABLE_SIZE,
|
||||
BIG5_TYPICAL_DISTRIBUTION_RATIO)
|
||||
from .jisfreq import (JIS_CHAR_TO_FREQ_ORDER, JIS_TABLE_SIZE,
|
||||
JIS_TYPICAL_DISTRIBUTION_RATIO)
|
||||
|
||||
|
||||
class CharDistributionAnalysis(object):
|
||||
ENOUGH_DATA_THRESHOLD = 1024
|
||||
SURE_YES = 0.99
|
||||
SURE_NO = 0.01
|
||||
MINIMUM_DATA_THRESHOLD = 3
|
||||
|
||||
def __init__(self):
|
||||
# Mapping table to get frequency order from char order (get from
|
||||
# GetOrder())
|
||||
self._char_to_freq_order = None
|
||||
self._table_size = None # Size of above table
|
||||
# This is a constant value which varies from language to language,
|
||||
# used in calculating confidence. See
|
||||
# http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html
|
||||
# for further detail.
|
||||
self.typical_distribution_ratio = None
|
||||
self._done = None
|
||||
self._total_chars = None
|
||||
self._freq_chars = None
|
||||
self.reset()
|
||||
|
||||
def reset(self):
|
||||
"""reset analyser, clear any state"""
|
||||
# If this flag is set to True, detection is done and conclusion has
|
||||
# been made
|
||||
self._done = False
|
||||
self._total_chars = 0 # Total characters encountered
|
||||
# The number of characters whose frequency order is less than 512
|
||||
self._freq_chars = 0
|
||||
|
||||
def feed(self, char, char_len):
|
||||
"""feed a character with known length"""
|
||||
if char_len == 2:
|
||||
# we only care about 2-bytes character in our distribution analysis
|
||||
order = self.get_order(char)
|
||||
else:
|
||||
order = -1
|
||||
if order >= 0:
|
||||
self._total_chars += 1
|
||||
# order is valid
|
||||
if order < self._table_size:
|
||||
if 512 > self._char_to_freq_order[order]:
|
||||
self._freq_chars += 1
|
||||
|
||||
def get_confidence(self):
|
||||
"""return confidence based on existing data"""
|
||||
# if we didn't receive any character in our consideration range,
|
||||
# return negative answer
|
||||
if self._total_chars <= 0 or self._freq_chars <= self.MINIMUM_DATA_THRESHOLD:
|
||||
return self.SURE_NO
|
||||
|
||||
if self._total_chars != self._freq_chars:
|
||||
r = (self._freq_chars / ((self._total_chars - self._freq_chars)
|
||||
* self.typical_distribution_ratio))
|
||||
if r < self.SURE_YES:
|
||||
return r
|
||||
|
||||
# normalize confidence (we don't want to be 100% sure)
|
||||
return self.SURE_YES
|
||||
|
||||
def got_enough_data(self):
|
||||
# It is not necessary to receive all data to draw conclusion.
|
||||
# For charset detection, certain amount of data is enough
|
||||
return self._total_chars > self.ENOUGH_DATA_THRESHOLD
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# We do not handle characters based on the original encoding string,
|
||||
# but convert this encoding string to a number, here called order.
|
||||
# This allows multiple encodings of a language to share one frequency
|
||||
# table.
|
||||
return -1
|
||||
|
||||
|
||||
class EUCTWDistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(EUCTWDistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = EUCTW_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = EUCTW_TABLE_SIZE
|
||||
self.typical_distribution_ratio = EUCTW_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for euc-TW encoding, we are interested
|
||||
# first byte range: 0xc4 -- 0xfe
|
||||
# second byte range: 0xa1 -- 0xfe
|
||||
# no validation needed here. State machine has done that
|
||||
first_char = byte_str[0]
|
||||
if first_char >= 0xC4:
|
||||
return 94 * (first_char - 0xC4) + byte_str[1] - 0xA1
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
class EUCKRDistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(EUCKRDistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = EUCKR_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = EUCKR_TABLE_SIZE
|
||||
self.typical_distribution_ratio = EUCKR_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for euc-KR encoding, we are interested
|
||||
# first byte range: 0xb0 -- 0xfe
|
||||
# second byte range: 0xa1 -- 0xfe
|
||||
# no validation needed here. State machine has done that
|
||||
first_char = byte_str[0]
|
||||
if first_char >= 0xB0:
|
||||
return 94 * (first_char - 0xB0) + byte_str[1] - 0xA1
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
class GB2312DistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(GB2312DistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = GB2312_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = GB2312_TABLE_SIZE
|
||||
self.typical_distribution_ratio = GB2312_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for GB2312 encoding, we are interested
|
||||
# first byte range: 0xb0 -- 0xfe
|
||||
# second byte range: 0xa1 -- 0xfe
|
||||
# no validation needed here. State machine has done that
|
||||
first_char, second_char = byte_str[0], byte_str[1]
|
||||
if (first_char >= 0xB0) and (second_char >= 0xA1):
|
||||
return 94 * (first_char - 0xB0) + second_char - 0xA1
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
class Big5DistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(Big5DistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = BIG5_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = BIG5_TABLE_SIZE
|
||||
self.typical_distribution_ratio = BIG5_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for big5 encoding, we are interested
|
||||
# first byte range: 0xa4 -- 0xfe
|
||||
# second byte range: 0x40 -- 0x7e , 0xa1 -- 0xfe
|
||||
# no validation needed here. State machine has done that
|
||||
first_char, second_char = byte_str[0], byte_str[1]
|
||||
if first_char >= 0xA4:
|
||||
if second_char >= 0xA1:
|
||||
return 157 * (first_char - 0xA4) + second_char - 0xA1 + 63
|
||||
else:
|
||||
return 157 * (first_char - 0xA4) + second_char - 0x40
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
class SJISDistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(SJISDistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = JIS_TABLE_SIZE
|
||||
self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for sjis encoding, we are interested
|
||||
# first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe
|
||||
# second byte range: 0x40 -- 0x7e, 0x81 -- oxfe
|
||||
# no validation needed here. State machine has done that
|
||||
first_char, second_char = byte_str[0], byte_str[1]
|
||||
if (first_char >= 0x81) and (first_char <= 0x9F):
|
||||
order = 188 * (first_char - 0x81)
|
||||
elif (first_char >= 0xE0) and (first_char <= 0xEF):
|
||||
order = 188 * (first_char - 0xE0 + 31)
|
||||
else:
|
||||
return -1
|
||||
order = order + second_char - 0x40
|
||||
if second_char > 0x7F:
|
||||
order = -1
|
||||
return order
|
||||
|
||||
|
||||
class EUCJPDistributionAnalysis(CharDistributionAnalysis):
|
||||
def __init__(self):
|
||||
super(EUCJPDistributionAnalysis, self).__init__()
|
||||
self._char_to_freq_order = JIS_CHAR_TO_FREQ_ORDER
|
||||
self._table_size = JIS_TABLE_SIZE
|
||||
self.typical_distribution_ratio = JIS_TYPICAL_DISTRIBUTION_RATIO
|
||||
|
||||
def get_order(self, byte_str):
|
||||
# for euc-JP encoding, we are interested
|
||||
# first byte range: 0xa0 -- 0xfe
|
||||
# second byte range: 0xa1 -- 0xfe
|
||||
# no validation needed here. State machine has done that
|
||||
char = byte_str[0]
|
||||
if char >= 0xA0:
|
||||
return 94 * (char - 0xA1) + byte_str[1] - 0xa1
|
||||
else:
|
||||
return -1
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user