今天,预提交突然开始无法在我们的构建中安装isort钩子,并出现以下错误
[INFO] Installing environment for https://github.com/pycqa/isort.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/builds/.../.cache/pre-commit/repo0_h0f938/py_env-python3.8/bin/python', '-mpip', 'install', '.')
return code: 1
expected return code: 0
[...]
stderr:
ERROR: Command errored out with exit status 1:
[...]
File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/masonry/api.py", line 40, in prepare_metadata_for_build_wheel
poetry = Factory().create_poetry(Path(".").resolve(), with_groups=False)
File "/tmp/pip-build-env-_3j1398p/overlay/lib/python3.8/site-packages/poetry/core/factory.py", line 57, in create_poetry
raise RuntimeError("The Poetry configuration is invalid:\n" + message)
RuntimeError: The Poetry …Run Code Online (Sandbox Code Playgroud) 我试图在节点服务器上从 MongoDB运行 mongoDB 完整代码:
我的 mongo 版本:4.4.3
节点版本:v15.7.0
我从 MongoDB 导入了入门代码,代码如下:
const { MongoClient } = require("mongodb");
// Connection URI
const uri =
"mongodb+srv://sample-hostname:27017/?poolSize=20&writeConcern=majority";
// Create a new MongoClient
const client = new MongoClient(uri);
async function run() {
try {
// Connect the client to the server
await client.connect();
// Establish and verify connection
await client.db("admin").command({ ping: 1 });
console.log("Connected successfully to server");
} finally {
// Ensures that the client will close when you finish/error
await …Run Code Online (Sandbox Code Playgroud) Coveralls python 包装器 ( python-coveralls ) 最近收到了一个重大更新 (2.2.0 -> 3.0.0),我的 github-actions 工作流不再运行。
这是我的工作流程的相关部分:
test:
runs-on: ubuntu-latest
steps:
{... non-relevant steps...}
- name: Run test suite
run: tox -e $(echo py${{ matrix.python-version }}-mg${{ matrix.PYMONGO }} | tr -d . | sed -e 's/pypypy/pypy/') -- -a "--cov=my_project"
- name: Send coverage to Coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: coveralls
Run Code Online (Sandbox Code Playgroud)
这曾经适用于以前版本的python-coveralls,所以tox命令不是问题
这是我收到的错误:
Submitting coverage to coveralls.io...
Could not submit coverage: 422 Client Error: Unprocessable Entity for url: https://coveralls.io/api/v1/jobs
resubmitting with …Run Code Online (Sandbox Code Playgroud) 我正在使用python-telegram-bot库开发一个简单的 Telegram 聊天机器人。我的机器人目前正在使用ConversationHandler来跟踪对话状态。
我想通过将对话状态存储在 MongoDB 数据库中来使对话持久化。
我正在使用mongoenginepython 库与我的数据库进行通信。
通过阅读BasePersistence( https://python-telegram-bot.readthedocs.io/en/stable/telegram.ext.basepersistence.html )的文档,我了解到有必要使用自定义类扩展此类,我们称之为MongoPersistence,并覆盖以下方法:
get_conversations(name)update_conversation(name, key, new_state)文档没有指定dict返回的结构get_conversations(name),因此也很难理解如何实现update_conversation(name, key, new_state)
假设我有上面提到的类(store_user_data, store_chat_data,store_bot_data都设置为False因为我不想存储这些数据):
from telegram.ext import BasePersistence
class MongoPersistence(BasePersistence):
def __init__(self):
super(MongoPersistence, self).__init__(store_user_data=False,
store_chat_data=False,
store_bot_data=False)
def get_conversations(self, name):
pass
def update_conversation(self, name, key, new_state):
pass
Run Code Online (Sandbox Code Playgroud)
我怎样才能实现这个类,以便从数据库中获取和保存我的对话状态?
python ×3
coveralls ×1
isort ×1
javascript ×1
mongodb ×1
mongoengine ×1
node.js ×1
pre-commit ×1
telegram ×1