Skip to content

Commit

Permalink
fix: python code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
DDSRem committed Dec 28, 2024
1 parent 06510c8 commit 51b5dd6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 22 deletions.
5 changes: 2 additions & 3 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{
'max-line-length': 120
}
[FORMAT]
max-line-length=120
10 changes: 5 additions & 5 deletions glue_python/aliyunopentoken/aliyunopentoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ def shutdown():
parser.add_argument('--qrcode_mode', type=str, required=True, help='扫码模式')
args = parser.parse_args()
logging.info('二维码生成中...')
re_count = 0
RE_COUNT = 0
while True:
re = requests.get('https://api.xhofe.top/alist/ali_open/qr', headers=headers, timeout=10)
if re.status_code == 200:
re_data = json.loads(re.content)
sid = re_data['sid']
qrCodeUrl = f"https://www.aliyundrive.com/o/oauth/authorize?sid={sid}"
qr_code_url = f"https://www.aliyundrive.com/o/oauth/authorize?sid={sid}"
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_H, box_size=5, border=4)
qr.add_data(qrCodeUrl)
qr.add_data(qr_code_url)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save(QRCODE_DIR)
Expand All @@ -164,8 +164,8 @@ def shutdown():
logging.warning("Too Many Requests 请一小时后重试!")
os._exit(0)
time.sleep(1)
re_count += 1
if re_count == 3:
RE_COUNT += 1
if RE_COUNT == 3:
logging.error('二维码生成失败,退出进程')
os._exit(1)
if args.qrcode_mode == 'web':
Expand Down
10 changes: 5 additions & 5 deletions glue_python/aliyunopentoken/aliyunopentoken_nn.ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,15 @@ def shutdown():
parser.add_argument('--qrcode_mode', type=str, required=True, help='扫码模式')
args = parser.parse_args()
logging.info('二维码生成中...')
re_count = 0
RE_COUNT = 0
while True:
re = requests.get('https://api-cf.nn.ci/alist/ali_open/qr', timeout=10)
if re.status_code == 200:
re_data = json.loads(re.content)
sid = re_data['sid']
qrCodeUrl = f"https://www.aliyundrive.com/o/oauth/authorize?sid={sid}"
qr_code_url = f"https://www.aliyundrive.com/o/oauth/authorize?sid={sid}"
qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_H, box_size=5, border=4)
qr.add_data(qrCodeUrl)
qr.add_data(qr_code_url)
qr.make(fit=True)
img = qr.make_image(fill_color="black", back_color="white")
img.save(QRCODE_DIR)
Expand All @@ -130,8 +130,8 @@ def shutdown():
logging.warning("Too Many Requests 请一小时后重试!")
os._exit(0)
time.sleep(1)
re_count += 1
if re_count == 3:
RE_COUNT += 1
if RE_COUNT == 3:
logging.error('二维码生成失败,退出进程')
os._exit(1)
if args.qrcode_mode == 'web':
Expand Down
7 changes: 4 additions & 3 deletions glue_python/aliyuntoken/aliyuntoken.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,12 @@ def shutdown():
parser.add_argument('--qrcode_mode', type=str, required=True, help='扫码模式')
args = parser.parse_args()
logging.info('二维码生成中...')
re_count = 0
RE_COUNT = 0
while True:
re = requests.get('https://api.xhofe.top/alist/ali/qr', headers=headers, timeout=10)
if re.status_code == 200:
re_data = json.loads(re.content)
# pylint: disable=C0103
t = str(re_data['content']['data']['t'])
codeContent = re_data['content']['data']['codeContent']
ck = re_data['content']['data']['ck']
Expand All @@ -134,8 +135,8 @@ def shutdown():
logging.info('二维码生成完成!')
break
time.sleep(1)
re_count += 1
if re_count == 3:
RE_COUNT += 1
if RE_COUNT == 3:
logging.error('二维码生成失败,退出进程')
os._exit(1)
if args.qrcode_mode == 'web':
Expand Down
7 changes: 4 additions & 3 deletions glue_python/aliyuntoken/aliyuntoken_nn.ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,12 @@ def shutdown():
parser.add_argument('--qrcode_mode', type=str, required=True, help='扫码模式')
args = parser.parse_args()
logging.info('二维码生成中...')
re_count = 0
RE_COUNT = 0
while True:
re = requests.get('https://api-cf.nn.ci/alist/ali/qr', timeout=10)
if re.status_code == 200:
re_data = json.loads(re.content)
# pylint: disable=C0103
t = str(re_data['content']['data']['t'])
codeContent = re_data['content']['data']['codeContent']
ck = re_data['content']['data']['ck']
Expand All @@ -117,8 +118,8 @@ def shutdown():
logging.info('二维码生成完成!')
break
time.sleep(1)
re_count += 1
if re_count == 3:
RE_COUNT += 1
if RE_COUNT == 3:
logging.error('二维码生成失败,退出进程')
os._exit(1)
if args.qrcode_mode == 'web':
Expand Down
7 changes: 4 additions & 3 deletions glue_python/aliyuntoken/aliyuntoken_vercel.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ def shutdown():
parser.add_argument('--qrcode_mode', type=str, required=True, help='扫码模式')
args = parser.parse_args()
logging.info('二维码生成中...')
re_count = 0
RE_COUNT = 0
while True:
re = requests.get('https://aliyuntoken.vercel.app/api/generate', timeout=10)
if re.status_code == 200:
re_data = json.loads(re.content)
# pylint: disable=C0103
t = str(re_data['t'])
codeContent = re_data['codeContent']
ck = re_data['ck']
Expand All @@ -120,8 +121,8 @@ def shutdown():
logging.info('二维码生成完成!')
break
time.sleep(1)
re_count += 1
if re_count == 3:
RE_COUNT += 1
if RE_COUNT == 3:
logging.error('二维码生成失败,退出进程')
os._exit(1)
if args.qrcode_mode == 'web':
Expand Down
2 changes: 2 additions & 0 deletions glue_python/aliyuntvtoken/alitoken2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# pylint: disable=C0114
# pylint: disable=C0116
# pylint: disable=C0103
#!/usr/local/bin/python3

import time
Expand Down

0 comments on commit 51b5dd6

Please sign in to comment.