Skip to content

Commit 60f3763

Browse files
sheeplinNorton-Linlll123githublll123githubcharlie0129
authored
feat: add quiz module (#188)
* refactor:create dto music_all (#132) * refactor:create dto music_all * refactor:create dto music_all * ci: fix lint * test: add test for one music * test: beautify test config * test: fix test music * feat: add MC0105 PUT /music/<int:id>/visibility * ci: use black instead of pylint [skip ci] * style: reformat with black * chore: update .gitignore * docs: add LICENSE [skip ci] * refactor: create dto character_normal * refactor: create dto character_all * style: make some notes in views.py and urls.py make it easy to find apis * refactor: make music_normal dto model this dto model can be used in MC0202 api * fix: delete "import imp" in views.py I dont know how it is in the scripts, but it do * refactor: add dto music_normal (#141) * style: make some notes in views.py and urls.py make it easy to find apis * refactor: make music_normal dto model this dto model can be used in MC0202 api * fix: delete "import imp" in views.py I dont know how it is in the scripts, but it do Co-authored-by: lll123github <[email protected]> * fix: update default avatar * refactor:create dto create dto article_all, article_normal, comment_normal * style: make some notes in HinghwaDict/urls.py and word/word.py make it easy to find apis about word * refactor: build word2pronunciation.py move the function word2pronunciation into word2pronunciation.py * refactor: create dto word_all create word_all.py and delete function word2pronunciation from the word.py completely, meanwhile import word2pronunciation.py in word.py * rafactor: create dto word_normal create dto word_normal in word_normal.py. this model is not used * refactor: create dto word_quick this model can be used in WD0201, word.py is modified, too * refactor: create dto word_simple create word_simple.py, which has not been used * style: style urls.py in HinghwaDict style urls.py in HinghwaDict * fix: delete "import imp" in views.py I dont know how it is in the scripts, but it do * fix: delete import response and Docs (blacked) we should catch sight on how they appeared * fix: return response in word_normal and word_simple linzichuan is not a qualified programer * fix: delete import User in word_simple.py delete import User in word_simple.py, which is nothing to explain * refactor: use word_simple in WD0202 modify woed.py and note in word_simple.py * fix: delete import Pronunciation from .models in word.py, which is not used * refactor: create dto create dto pronunciation_normal pronunciation_all pronunciation_simple already exists,and this model is not used * build: change dto used in WD0201 from word_quick to word_all word_quick will be changed to application_content which will be used with data type Application. the reference will be noted in word_all.py * style: note in models.py explain the relation between word and application * refactor: delete word_quick and make a dto named application_simple dto application_simple_content is used in application_simple's content * refactor: make a dto named application_all application_all_content is used in application_all's content * fix: return response in application_all.py return response in application_all.py * ci: add test word-creation (#161) * ci: add word-creation * test: rename some tests * fix: fix error filed name * docs: add TESTING.md (#162) * docs: rename TESTING.md * docs: update TESTING.md (#164) * refactor: refactor directories in module word (#166) * refactor: create word.character * refactor: create word.pronunciation * fix: fix response error * refactor: create word.word and word.application * refactor: move translate.py * fix: fix calling error * refactor: move word2pronunciation.py * style: beautify with black * refactor: refactor MultiApplication (#167) * feat: add ExceptionMiddleware * feat: add InvalidTokenException * fix: import ExceptionMiddleware * fix: fix CommonException * fix: fix ExceptionMiddleware * feat: add token checking * refactor: adjust output logs * refactor: refactor MultiApplication /words/applications * style: beautify with black * refactor: organize utils (#168) * refactor: rename islist * refactor: move TokenChecking * test: add new testing for word-creation (#169) * test: add new testing for word-creation * test: fix test script * fix: fix error response * Update word-creation.json * Update word-creation.json * feat: add quiz module (#160) * feat: add quiz modular * fix: fix formatting problems * test: add the test of apifox * fix: add urls.py * fix:fix quiz.json * fix : fix the problem of urls.py * Update apps.py * update urls.py、views.py and quiz.json * Update quiz.json * fix: the problem of url * 试一下ci * 试一下ci * fix: fix the problems of test * fix: quiz.json format * fix: add for migrations * 加错路径了 尴尬 * Create __init__.py * fix: optimize code structure * fix: fix the problem of quiz * fix: fixed the display problem Fixed the display problem of background management Co-authored-by: sheeplin <[email protected]> * test: add enhancement tests for module quiz (#172) * ci: add test quiz_401,quiz_404 * fix :fix the format of json * ci :add test quiz_403 * Update quiz_403.json * test: update quiz_403.json * ci: add common user * ci : update e2e.yml * ci: add user_test * ci: fix user_test Co-authored-by: Charlie Chiang <[email protected]> * ci: fix single quote * style: update quiz.json * style: modify the test folder structure * Revert "style: modify the test folder structure" This reverts commit ce38918. Co-authored-by: sheeplin <[email protected]> Co-authored-by: Charlie Chiang <[email protected]> * refactor: refactor music module (#177) * refactor: refactor music module * style: fix the problem of test * fix: fix the token check of MC0105 * style: update the music_403.json * style: update the music module * sytle: update the music module * style: format music_403.json,music_404.json * feat: check the password valid or not (#173) * fix: make the length of passwords in wechat program adaptable make the length of passwords in wechat program adaptable * feat: add a child exception 400 named InvalidPassword add a child exception of BadRequestException 400 named InvalidPassword * feat: create password_validator and class MaximumLengthValidator create password_validator and class MaximumLengthValidator in password_validation.py * feat: check the new passwords valid or not check the new passwords valid or not when retrieving updating or creating passwords * fix: import user.password_validation instead of password_validation * fix: deal with the exception in password_validation deal with the exception in password_validation * feat: create UserNotFoundException in NotFoundException(404) * style: make a note on updatepassword make a note on updatepassword * style: format urls.py format urls.py * style: delete "as e" which is not used when catch error ValidationError * perf: abolish the exception "WhenUpdatePassword" in WrongPassword this can be used in normal password checking * style: add some explaination on password_validator function add some explanation on password_validator function * fix: wrong word: UnauthorizedException add 'e' * refactor: new class UpdatePassword to replace function updatePassword * refactor: use new class UpdatePassword formally function updatePassword has been deleted and urls.py has been changed * style: format views.py with black format views.py with black * style:delete some excepting and raising without any significance * fix: delete "password" in MaximumLengthValidator(password).validator delete "password" in MaximumLengthValidator(password).validator * style: delete "(旧)" in a note delete "(旧)" in a note * refactor: arrange code about class UpdatePassword arrange code about class UpdatePassword * fix: add "id" in put(self,request) which is necessary for django * refactor: simplify code for the limitation of the length of new password simplify code for the limitation of the length of new password * fix: add returning CommenException add returning CommonException * fix: fix the condition of validating a password fix the condition of validating a password * style: move the password_validation to the filter utils and rename it and delete someting not used in it * style: black and delete something not used black and delete something not used in views.py * ci: update e2e.yml add a user for test * style: delete try except in UpdatePassword which is not useful * ci: update information about a user for test update password about a user for test * test: add two tests which are about the update-password actions * style: modify the format of the tests which are two commited before * test: try some tests in ci change the id of the user in tests * test: try some tests in ci change the ids of the user in tests * test: correct the password which may cause unauthorized occation * test: try some tests in ci change the id of the user in tests * test: try some tests in ci change the id of the user in tests * test: try some tests in ci change the id of the user in tests * ci: update e2e.yml update e2e.yml and set the password Co-authored-by: sheeplin <[email protected]> * ci: update e2e.yml add the ids of the users for test * test: try some tests in ci change the id of the user in tests * ci: fix the bug without checking before * ci: test somthing add a space * test: add the actions after logining catch tokens * test: add actions after logining catch ids * test: change the order of tests change the order of tests * style: style not_found.py black not_found.py * test: try some tests in ci change the id of users and fix the test suite Co-authored-by: lll123github <[email protected]> Co-authored-by: sheeplin <[email protected]> Co-authored-by: sheeplin <[email protected]> * refactor: refactor article module (#181) * refactor: refactor article module * fix: fix the known problems * refactor: refactor article.json * Update article.json * refactor: delete old code and fix known problems * refactor:delete invalid judgment * feat: add admin feature of quiz module (#185) * refactor: refactor article module * fix: fix the known problems * refactor: refactor article.json * Update article.json * refactor: delete old code and fix known problems * refactor:delete invalid judgment * feat: add admin review the quiz * refactor: format json Co-authored-by: Norton-Lin <[email protected]> Co-authored-by: lll123github <[email protected]> Co-authored-by: 林子川 <[email protected]> Co-authored-by: Charlie Chiang <[email protected]>
1 parent 584365e commit 60f3763

File tree

113 files changed

+18458
-2039
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+18458
-2039
lines changed

.github/workflows/e2e.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ jobs:
3434
python3 manage.py makemigrations
3535
python3 manage.py migrate
3636
DJANGO_SUPERUSER_PASSWORD=testtest123 python manage.py createsuperuser --username admin --email [email protected] --no-input
37+
DJANGO_SUPERUSER_PASSWORD=testtest222 python manage.py createsuperuser --username admin2 --email [email protected] --no-input
38+
echo -e "from django.contrib.auth.models import User\nuser=User.objects.create_user('user_test','user_test@user_test.com','123456')\nuser.set_password('123456')\nuser.save()\nexit()" | python manage.py shell
39+
echo -e "from django.contrib.auth.models import User\nuser=User.objects.create_user('user_test_old_password','user_test_old_password@user_test_old_password.com','12')\nuser.set_password('12')\nuser.save()\nexit()"| python manage.py shell
3740
python3 manage.py runserver &
3841
- uses: actions/setup-node@v3
3942
with:
@@ -44,6 +47,9 @@ jobs:
4447
- name: Run tests
4548
run: |
4649
curl 127.0.0.1:8000/users/1
50+
curl 127.0.0.1:8000/users/2
51+
curl 127.0.0.1:8000/users/3
52+
curl 127.0.0.1:8000/users/4
4753
cd tests
4854
for test in `ls .`
4955
do

.github/workflows/lint.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ jobs:
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
25-
pip install pylint
26-
pip install pylint-django
27-
cd hinghwa-dict-backend
28-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
29-
sudo apt-get update
30-
sudo apt-get install ffmpeg -y
25+
pip install black
3126
3227
- name: Get changed files
3328
id: changed-files
@@ -38,6 +33,6 @@ jobs:
3833
for file in ${{ steps.changed-files.outputs.all_changed_files }} ; do
3934
# check if file is python file
4035
if [[ ${file} == *.py ]]; then
41-
DJANGO_SETTINGS_MODULE=HinghwaDict.settings pylint --load-plugins pylint_django ${file}
36+
black --check ${file}
4237
fi
4338
done

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ material
66
logs
77
.env
88
db.sqlite3
9+
migrations

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

TESTING.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
## 测试说明
2+
3+
### 原则
4+
5+
理论上的测试类型包括:
6+
7+
- 单元测试(Unit test)
8+
- 集成测试(Integration test)
9+
- 端到端测试(End-to-End test, e2e test)
10+
11+
然而在这个项目中,由于时间精力和函数的实际复杂程度,我们直接使用端到端测试检验函数的正确性。(正常来说,应该是金字塔模型: 底部是单元测试,中间是集成测试,最上层是端到端测试)
12+
13+
一个功能的上线要经过下列流程:
14+
15+
- 发起 Pull Request 提交代码(具体见 [CONTRIBUTING.md](CONTRIBUTING.md)
16+
- 运行 [CI](./.github/workflows) 进行 `Github Actions` 进行一些相应的检查
17+
- 部署到测试服务器进行测试
18+
- 上线服务至正式服务器
19+
20+
### CI
21+
22+
CI,(*Continuous Integration*,持续集成),是一个可以帮助我们控制代码质量的好方法。
23+
24+
在本项目目前的 CI 包括:
25+
26+
- e2e:运行 [`tests`](./tests) 文件夹中的 `Apifox` 自动化测试脚本进行端到端测试
27+
- lint:通过 `blank` 进行代码格式化检查
28+
29+
在运行端到端测试时,在会通过以下命令创建初始数据库:
30+
31+
32+
```shell
33+
python3 manage.py makemigrations
34+
python3 manage.py migrate
35+
DJANGO_SUPERUSER_PASSWORD=testtest123 python manage.py createsuperuser --username admin --email [email protected] --no-input
36+
DJANGO_SUPERUSER_PASSWORD=testtest222 python manage.py createsuperuser --username admin2 --email [email protected] --no-input
37+
```
38+
39+
> 创建两个用户的原因是在目前的代码中,发送邮件默认是由2号用户进行发送。
40+
41+
而在启动服务之后,你需要首先运行:
42+
43+
```shell
44+
curl 127.0.0.1:8000/users/1
45+
curl 127.0.0.1:8000/users/2
46+
```
47+
48+
其原因是:直接创建的用户只有 Django 默认的用户模型,不包括我们自定义的 `UserInfo` 模型,在获取用户模块中实现了自动创建功能,否则在其他模块调用时会出错。
49+
50+
#### Apifox 自动化测试
51+
52+
-`Apifox` - `自动化测试` - `测试用例` 中添加相应的测试用例或测试套件。
53+
- 选择 `测试环境` 导出 `Apifox CLI` 格式的 `json` 源文件,格式化后放入 `tests` 文件夹即可。
54+
- 测试套件或测试用例可以自己根据需要进行组合、拼装。

hinghwa-dict-backend/AudioCompare/FFT.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ def series(self, chunks=-1):
3232
samples = self.input_file.get_audio_samples(chunks * self.chunk_size)
3333
# mix those samples down into one channel
3434
samples = samples.mean(axis=0)
35-
result = self.specgram(samples, NFFT=self.chunk_size,
36-
window=FFT.__window_hanning,
37-
noverlap=int(self.chunk_size / self.overlap_ratio))
35+
result = self.specgram(
36+
samples,
37+
NFFT=self.chunk_size,
38+
window=FFT.__window_hanning,
39+
noverlap=int(self.chunk_size / self.overlap_ratio),
40+
)
3841
result = result.transpose()
3942
return result
4043

@@ -65,7 +68,7 @@ def specgram(self, x, NFFT, window, noverlap):
6568

6669
# do the ffts of the slices
6770
for i in range(n):
68-
thisX = x[ind[i]:ind[i] + NFFT]
71+
thisX = x[ind[i] : ind[i] + NFFT]
6972
thisX = windowVals * thisX
7073
fx = np.fft.fft(thisX, n=NFFT)
7174
Pxx[:, i] = np.conjugate(fx[:numFreqs]) * fx[:numFreqs]

hinghwa-dict-backend/AudioCompare/InputFile.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99

1010
class InputFile:
11-
1211
def __init__(self, filename):
1312
"""Open an Audio file with the given file path.
1413
Supported formats: WAVE, MP3.
@@ -27,7 +26,7 @@ def __init__(self, filename):
2726
original_name = filename
2827
self.wav_file = open(filename, "rb")
2928
# try to use lame to convert
30-
self.workingdir = os.path.join(os.getcwd(), 'temp')
29+
self.workingdir = os.path.join(os.getcwd(), "temp")
3130
if not os.path.exists(self.workingdir):
3231
os.makedirs(self.workingdir)
3332
if not self.__is_wave_file(self.wav_file):
@@ -37,14 +36,16 @@ def __init__(self, filename):
3736
# make sure the filename has a ".mp3" extension before sending to lame
3837
if filename[-4:] != ".mp3":
3938
# create a copy of the file in
40-
temp_file_name = os.path.join(self.workingdir, str(time.time()) + ".mp3")
39+
temp_file_name = os.path.join(
40+
self.workingdir, str(time.time()) + ".mp3"
41+
)
4142
shutil.copyfile(filename, temp_file_name)
4243
filename = temp_file_name
4344
# Use lame to make a wav representation of the mp3 file to be analyzed
44-
lame = [lame, '--silent', '--decode', filename, canonical_form]
45+
lame = [lame, "--silent", "--decode", filename, canonical_form]
4546

4647
music = pydub.AudioSegment.from_file(filename)
47-
music.export(canonical_form, format='wav')
48+
music.export(canonical_form, format="wav")
4849

4950
if not os.path.exists(canonical_form):
5051
raise IOError("{f} 's format is not supported".format(f=original_name))
@@ -67,22 +68,22 @@ def __init__(self, filename):
6768

6869
self.wav_file.seek(40, 0)
6970
self.data_chunk_size = InputFile.__read_size(self.wav_file)
70-
self.total_samples = (self.data_chunk_size / self.block_align)
71+
self.total_samples = self.data_chunk_size / self.block_align
7172

7273
@staticmethod
7374
def __is_wave_file(file):
7475

75-
if (not InputFile.__check_riff_format(file)):
76+
if not InputFile.__check_riff_format(file):
7677
return False
77-
if (not InputFile.__check_wave_id(file)):
78+
if not InputFile.__check_wave_id(file):
7879
return False
79-
if (not InputFile.__check_fmt(file)):
80+
if not InputFile.__check_fmt(file):
8081
return False
8182

8283
file.seek(20)
8384
data = file.read(2)
8485
file.seek(0)
85-
if (not InputFile.__check_fmt_valid(data)):
86+
if not InputFile.__check_fmt_valid(data):
8687
return False
8788
return InputFile.__check_data(file)
8889

@@ -146,7 +147,7 @@ def get_audio_samples(self, n):
146147
data = np.fromfile(self.wav_file, dtype=np.int16, count=n * self.channels)
147148
result = np.zeros((self.channels, n), dtype=int)
148149
for c in range(self.channels):
149-
result[c] = data[c::self.channels]
150+
result[c] = data[c :: self.channels]
150151

151152
return result
152153

hinghwa-dict-backend/AudioCompare/Matcher.py

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
BUCKET_SIZE = 20
1717
BUCKETS = 4
1818
BITS_PER_NUMBER = int(math.ceil(math.log(BUCKET_SIZE, 2)))
19-
assert ((BITS_PER_NUMBER * BUCKETS) <= 32)
19+
assert (BITS_PER_NUMBER * BUCKETS) <= 32
2020

2121
NORMAL_CHUNK_SIZE = 1024
2222
NORMAL_SAMPLE_RATE = 44100.0
@@ -67,9 +67,13 @@ def __str__(self):
6767
short_file2 = os.path.basename(self.file2)
6868
if self.score > SCORE_THRESHOLD:
6969
if self.file1_len < self.file2_len:
70-
return "MATCH {f1} {f2} ({s})".format(f1=short_file1, f2=short_file2, s=self.score)
70+
return "MATCH {f1} {f2} ({s})".format(
71+
f1=short_file1, f2=short_file2, s=self.score
72+
)
7173
else:
72-
return "MATCH {f2} {f1} ({s})".format(f1=short_file1, f2=short_file2, s=self.score)
74+
return "MATCH {f2} {f1} ({s})".format(
75+
f1=short_file1, f2=short_file2, s=self.score
76+
)
7377
else:
7478
return "NO MATCH"
7579

@@ -91,7 +95,7 @@ def _to_fingerprints(freq_chunks):
9195
end_index = (bucket + 1) * BUCKET_SIZE
9296
bucket_vals = freq_chunks[chunk][start_index:end_index]
9397
max_index = bucket_vals.argmax()
94-
fingerprint += (max_index << (bucket * BITS_PER_NUMBER))
98+
fingerprint += max_index << (bucket * BITS_PER_NUMBER)
9599
fingerprints[chunk] = fingerprint
96100

97101
# return the indexes of the loudest frequencies
@@ -116,7 +120,7 @@ def _file_fingerprint(filename):
116120
# file. It is important that each chunk represent the
117121
# same amount of time, regardless of the sample
118122
# rate of the file.
119-
chunk_size_adjust_factor = (NORMAL_SAMPLE_RATE / file.get_sample_rate())
123+
chunk_size_adjust_factor = NORMAL_SAMPLE_RATE / file.get_sample_rate()
120124
fft = FFT(file, int(NORMAL_CHUNK_SIZE / chunk_size_adjust_factor))
121125
series = fft.series()
122126

@@ -153,7 +157,7 @@ def __init__(self, dir1, dir2):
153157
them for files."""
154158
self.dir1 = dir1
155159
self.dir2 = dir2
156-
if os.path.split(dir2)[1] != 'submit':
160+
if os.path.split(dir2)[1] != "submit":
157161
self.change = True
158162
else:
159163
self.change = False
@@ -196,7 +200,11 @@ def __search_dir(dir):
196200
if stat.S_ISREG(node_stat.st_mode):
197201
results.append(abs_node)
198202
else:
199-
warn("An inode that is not a regular file was found at {f}".format(abs_node))
203+
warn(
204+
"An inode that is not a regular file was found at {f}".format(
205+
abs_node
206+
)
207+
)
200208

201209
return results
202210

@@ -288,7 +296,9 @@ def __report_file_matches(file, master_hash, file_lengths):
288296
else:
289297
score = 0
290298

291-
results.append(MatchResult(file.filename, f, file.file_len, file_lengths[f], score))
299+
results.append(
300+
MatchResult(file.filename, f, file.file_len, file_lengths[f], score)
301+
)
292302

293303
return results
294304

@@ -321,13 +331,15 @@ def match(self):
321331
# map2_result = [_file_fingerprint(item) for item in dir2_files]
322332
# map1_result = pool.map_async(_file_fingerprint, dir1_files)
323333
dir1_results = map1_result
324-
if self.change or not os.path.exists(os.path.join(os.getcwd(), 'submit结果存储.pkl')):
334+
if self.change or not os.path.exists(
335+
os.path.join(os.getcwd(), "submit结果存储.pkl")
336+
):
325337
map2_result = [_file_fingerprint(item) for item in dir2_files]
326338
dir2_results = map2_result
327-
with open(os.path.join(os.getcwd(), 'submit结果存储.pkl'), 'wb') as f:
339+
with open(os.path.join(os.getcwd(), "submit结果存储.pkl"), "wb") as f:
328340
pickle.dump(dir2_results, f)
329341
else:
330-
with open(os.path.join(os.getcwd(), 'submit结果存储.pkl'), 'rb') as f:
342+
with open(os.path.join(os.getcwd(), "submit结果存储.pkl"), "rb") as f:
331343
dir2_results = pickle.load(f)
332344
print(len(dir2_results))
333345
# Wait for pool to finish processing
@@ -337,7 +349,7 @@ def match(self):
337349
# dir2_results = map2_result
338350
# Get results from process pool
339351

340-
shutil.rmtree(os.path.join(os.getcwd(), 'temp'))
352+
shutil.rmtree(os.path.join(os.getcwd(), "temp"))
341353
except KeyboardInterrupt:
342354
# pool.terminate()
343355
raise
@@ -351,8 +363,12 @@ def match(self):
351363

352364
# Proceed only with fingerprints that were computed
353365
# successfully
354-
dir1_successes = list(filter(lambda x: x.success and x.file_len > 0, dir1_results))
355-
dir2_successes = list(filter(lambda x: x.success and x.file_len > 0, dir2_results))
366+
dir1_successes = list(
367+
filter(lambda x: x.success and x.file_len > 0, dir1_results)
368+
)
369+
dir2_successes = list(
370+
filter(lambda x: x.success and x.file_len > 0, dir2_results)
371+
)
356372

357373
# Empty files should match other empty files
358374
# Our matching algorithm will not report these as a match,
@@ -400,7 +416,9 @@ def match(self):
400416
# same time difference relative to each
401417
# other. This indicates that the two files
402418
# contain similar audio.
403-
file_matches = Matcher.__report_file_matches(file, master_hash, file_lengths)
419+
file_matches = Matcher.__report_file_matches(
420+
file, master_hash, file_lengths
421+
)
404422
results.extend(file_matches)
405423

406424
return results
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
class BaseResult(object):
22
"""Used to report results of operations
33
performed in our algorithms."""
4+
45
def __init__(self, success, message):
56
self.success = success
67
self.message = message
78

89
def __str__(self):
910
return self.message
1011

12+
1113
class FileErrorResult(BaseResult):
1214
"""A result that indicates there was an error
1315
operating on a file."""
16+
1417
def __init__(self, message):
1518
super(FileErrorResult, self).__init__(False, message)

hinghwa-dict-backend/AudioCompare/error.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,3 @@ def die(msg):
88

99
def warn(msg):
1010
print(sys.stderr, "ERROR: {e}".format(e=msg))
11-
12-

hinghwa-dict-backend/HinghwaDict/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111

1212
from django.core.asgi import get_asgi_application
1313

14-
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'HinghwaDict.settings')
14+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "HinghwaDict.settings")
1515

1616
application = get_asgi_application()

0 commit comments

Comments
 (0)