126 lines
2.4 KiB
Text
126 lines
2.4 KiB
Text
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "2d3833aa-a58b-4752-9b8e-060fae34ed83",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import re"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 2,
|
|
"id": "005fe62c-1bf4-48bc-bc18-5cc46ea2e1ce",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"lck = r\"^pylock\\.([^.]+)\\.toml$\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "f3768a43-f740-4590-bf20-fba50486f627",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"pl = re.compile(lck)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 7,
|
|
"id": "b5d1fc98-4d71-42b7-a013-bbf18649f6c0",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"None\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(pl.match(\"pylock.toml\"))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 9,
|
|
"id": "b001ae47-6eac-4a18-9a7e-c379df48577d",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"<re.Match object; span=(0, 16), match='pylock.name.toml'>\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"print(pl.match(\"pylock.name.toml\"))"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 13,
|
|
"id": "2b86f199-f780-44c1-833e-9e3fc69b9f90",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"'v1'"
|
|
]
|
|
},
|
|
"execution_count": 13,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"filename = \"pylock.v1.toml\"\n",
|
|
"if len(filename) > 11 and filename.startswith(\"pylock.\") and filename.endswith(\".toml\"):\n",
|
|
" name = filename.removeprefix(\"pylock.\").removesuffix(\".toml\")\n",
|
|
"\n",
|
|
"name "
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "8a1d59ef-6c70-4693-a25c-0e58a6e37e21",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"uv --version"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.5"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|