Skip to content

Commit

Permalink
Change path in validation_decorator_types example to a relative path (#…
Browse files Browse the repository at this point in the history
…4341)

* Change path in validation_decorator_types example to a relative path

* make the example a little clearer

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
  • Loading branch information
hramezani and samuelcolvin committed Aug 9, 2022
1 parent 0500610 commit 697459a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions docs/examples/validation_decorator_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
from pathlib import Path
from typing import Pattern, Optional

Expand All @@ -13,5 +14,8 @@ def find_file(path: DirectoryPath, regex: Pattern, max=None) -> Optional[Path]:
return f


print(find_file('/etc/', '^sys.*'))
print(find_file('/etc/', '^foobar.*', max=3))
# note: this_dir is a string here
this_dir = os.path.dirname(__file__)

print(find_file(this_dir, '^validation.*'))
print(find_file(this_dir, '^foobar.*', max=3))

0 comments on commit 697459a

Please sign in to comment.