first test
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from fastapi import APIRouter, Depends, HTTPException, Query
|
|
||||||
|
from fastapi import APIRouter, Depends, HTTPException, Query, Path
|
||||||
from sqlalchemy.orm import Session
|
from sqlalchemy.orm import Session
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
|
|||||||
+94
@@ -0,0 +1,94 @@
|
|||||||
|
# #
|
||||||
|
# # l1 = [1, 2, 3]
|
||||||
|
# # l2 = [4, 5, 6]
|
||||||
|
# #
|
||||||
|
# # dict11 = dict(zip(l1, l2))
|
||||||
|
# # print(dict)
|
||||||
|
# #
|
||||||
|
# # d1 = {l1[k]: l2[k] for k in range(len(l1))}
|
||||||
|
# # print(d1)
|
||||||
|
# # print("="*30)
|
||||||
|
# #
|
||||||
|
# # dict_1 = {2:'c', 1:'a', 3:'b'}
|
||||||
|
# # print(f'原始: {dict_1}')
|
||||||
|
# #
|
||||||
|
# # dict_2 = dict(sorted(dict_1.items()))
|
||||||
|
# # print(f'升序:: {dict_2}')
|
||||||
|
# #
|
||||||
|
# # dict_3 = dict(sorted(dict_1.items(), reverse = True))
|
||||||
|
# # print(f'降序:: {dict_3}')
|
||||||
|
# #
|
||||||
|
# # dict_4 = dict(sorted(dict_1.items(), reverse = True, key = lambda v: v[1]))
|
||||||
|
# # print(f'value 降序: {dict_4}')
|
||||||
|
# #
|
||||||
|
# # dict_5= dict(sorted(dict_1.items(), key = lambda v: v[1]))
|
||||||
|
# # print(f'value 升序 {dict_5}')
|
||||||
|
# #
|
||||||
|
# # d2 = {i:i for i in range(11)}
|
||||||
|
# # print(d2)
|
||||||
|
# # print('&&'*20)
|
||||||
|
# #
|
||||||
|
# # def func_1(func):
|
||||||
|
# # def hha():
|
||||||
|
# # print("支付成功!!!")
|
||||||
|
# # func()
|
||||||
|
# # return hha
|
||||||
|
# #
|
||||||
|
# # @func_1
|
||||||
|
# # def pay():
|
||||||
|
# # print('支付成功')
|
||||||
|
# # @func_1
|
||||||
|
# # def xia():
|
||||||
|
# # print('xia')
|
||||||
|
# #
|
||||||
|
# # pay()
|
||||||
|
# #
|
||||||
|
# # print("&"*20)
|
||||||
|
# # xia()
|
||||||
|
# import random
|
||||||
|
# # teacher_list = [i for i in range(1, 11)]
|
||||||
|
# # class_list = [[], [], []]
|
||||||
|
# #
|
||||||
|
# # for teacher in teacher_list:
|
||||||
|
# # index = random.randint(0,2)
|
||||||
|
# # class_list[index].append(teacher)
|
||||||
|
# #
|
||||||
|
# # print(class_list)
|
||||||
|
#
|
||||||
|
# num_set = set()
|
||||||
|
# while True:
|
||||||
|
# num_set.add(random.randint(1, 100))
|
||||||
|
#
|
||||||
|
# if len(num_set) == 10:
|
||||||
|
# break
|
||||||
|
#
|
||||||
|
# print(f'原始: {num_set}')
|
||||||
|
# num_set_1 = sorted(num_set, reverse=True)
|
||||||
|
# print(num_set_1)
|
||||||
|
|
||||||
|
class IterSelf:
|
||||||
|
def __init__(self, max_num):
|
||||||
|
self.max_num = max_num
|
||||||
|
self.a, self.b = 1, 1
|
||||||
|
self.cnt = 0
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return self
|
||||||
|
|
||||||
|
def __next__(self):
|
||||||
|
self.cnt += 1
|
||||||
|
ans = self.a
|
||||||
|
|
||||||
|
if ans > self.max_num:
|
||||||
|
raise StopIteration
|
||||||
|
|
||||||
|
self.a , self.b = self.b, self.a + self.b
|
||||||
|
return ans
|
||||||
|
|
||||||
|
temp = IterSelf(13)
|
||||||
|
# for i in temp:
|
||||||
|
# print(f'index is {temp.cnt} and value is {i}')
|
||||||
|
print(next(temp))
|
||||||
|
print(next(temp))
|
||||||
|
print(next(temp))
|
||||||
|
print(type(temp))
|
||||||
@@ -195,6 +195,8 @@ class StatisticsDao:
|
|||||||
.limit(top_n)
|
.limit(top_n)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ans = [
|
ans = [
|
||||||
TopSalaryStudentItem(
|
TopSalaryStudentItem(
|
||||||
stu_name=row.name,
|
stu_name=row.name,
|
||||||
@@ -290,7 +292,7 @@ class StatisticsDao:
|
|||||||
filter_query = base_query.filter(StuInfo.age > age)
|
filter_query = base_query.filter(StuInfo.age > age)
|
||||||
elif operator == "lt" or operator == "<":
|
elif operator == "lt" or operator == "<":
|
||||||
filter_query = base_query.filter(StuInfo.age < age)
|
filter_query = base_query.filter(StuInfo.age < age)
|
||||||
elif operator == "eq" or operator == "=":
|
elif operator == "eq" or operator == "==":
|
||||||
filter_query = base_query.filter(StuInfo.age == age)
|
filter_query = base_query.filter(StuInfo.age == age)
|
||||||
|
|
||||||
finally_data = filter_query.all()
|
finally_data = filter_query.all()
|
||||||
|
|||||||
Reference in New Issue
Block a user