Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Sep 17, 2023
1 parent 6161773 commit a970554
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions examples/pathvalidate_examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,31 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": []
"outputs": [
{
"data": {
"text/plain": [
"'._'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from pathvalidate import sanitize_filename, ValidationError\n",
"\n",
"def add_trailing_underscore(e: ValidationError) -> str:\n",
" if e.reusable_name:\n",
" return e.reserved_name\n",
"\n",
" return f\"{e.reserved_name}_\"\n",
"\n",
"sanitize_filename(\".\", reserved_name_handler=add_trailing_underscore, additional_reserved_names=[\".\"])\n"
]
}
],
"metadata": {
Expand Down

0 comments on commit a970554

Please sign in to comment.