Skip to main content

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);
});

Metadata

Release files for maybach-requests 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for maybach-requests 1.0.1
File Size Uploaded Provenance
maybach_requests-1.0.1.tar.gz 2.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for maybach-requests 1.0.1
File Interpreter ABI Platform
maybach_requests-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 5.1 kB

Release files / maybach_requests-1.0.1.tar.gz

Download URL maybach_requests-1.0.1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a3c12febdd5b4f9988a1259114205f2c513fac4c24ff5f0455433d6873cbf8b5
BLAKE2b-256 checksum
How to use checksums
4c06de84942744d0b28d08f125cfa7d1a2e6f131091f0480e5df40176566c68e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / maybach_requests-1.0.1-py3-none-any.whl

Download URL maybach_requests-1.0.1-py3-none-any.whl
Size 2.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f39ffcef0506fe6af38acaab0f8065701fb2f090280a7da7f6596847243c4962
BLAKE2b-256 checksum
How to use checksums
1c4f4bcd13bca0aafb17c32740e15f48d2592661b25b61963cb8ab810bfb590b
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for maybach-requests 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page