Skip to main content

No project description provided

Project description

maybach_requests

用户实现 Python 自动批改的库

下载

pip install maybach_requests

使用

举一个例子,现在要断言一下代码的正确性:

# main.py
# student_code_starts
name = input('请输入姓名:')
print(name)
# student_code_ends

要求:用户输入 xigua,控制台能正确打印出来 xigua 并且能检查到 name 变量为 xigua

from maybach-requests import get_print, pass_test, no_pass_test

# 获取用户的输入
text = get_print()
passed = False
msg = '请打印name变量'
if name == 'xigua':
  for i in text:
    if i.find('xigua'):
      passed = True
      msg = 'success'
      break
else:
  msg = '请声明name变量'

if passed:
  # 通过测试
  pass_test(msg)
else:
  # 测试不通过
  no_pass_test(msg)

依赖

maybach-requests 依赖服务提供接口获取用户的输入,以及通知服务测试的结果。 @xigua/maybach-server 提供了整套服务。

动态端口号

maybach-requests 依赖的服务端口号是动态产生的,因此在执行相应的 python 代码的时候,需要通过 argv的形式传递给 python 进程

python xxx.py --port port

这样 maybach-requests 能够拿到相应的端口号,跟对应的进程通信。如果使用了 @xigua/maybach-vm

import { run } from '@xigua/maybach-vm';

run(0, xxx.py, cwd, ['--port', port]).then((res) => {
  console.log(res);
});

run(1, 'print(123)', cwd, ['--port', port], (res) => {
  console.log(res);
});

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maybach_requests-1.0.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

maybach_requests-1.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file maybach_requests-1.0.1.tar.gz.

File metadata

  • Download URL: maybach_requests-1.0.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for maybach_requests-1.0.1.tar.gz
Algorithm Hash digest
SHA256 a3c12febdd5b4f9988a1259114205f2c513fac4c24ff5f0455433d6873cbf8b5
MD5 b823ba8c2fd11587d9edfbdb89635a47
BLAKE2b-256 4c06de84942744d0b28d08f125cfa7d1a2e6f131091f0480e5df40176566c68e

See more details on using hashes here.

File details

Details for the file maybach_requests-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: maybach_requests-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1.post20200604 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.3

File hashes

Hashes for maybach_requests-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f39ffcef0506fe6af38acaab0f8065701fb2f090280a7da7f6596847243c4962
MD5 6f2d6dd4a319480505f749cd88f37099
BLAKE2b-256 1c4f4bcd13bca0aafb17c32740e15f48d2592661b25b61963cb8ab810bfb590b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page