Skip to content

Commit

Permalink
add: examples (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Sep 13, 2024
1 parent bb00d28 commit a14b144
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
Empty file added examples/pkg-nested/__init__.py
Empty file.
4 changes: 4 additions & 0 deletions examples/pkg-nested/sub-folder/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Example: package with nested folder"""

if "__main__" == __name__:
print(__doc__)
4 changes: 4 additions & 0 deletions examples/pkg-with-init/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"""Example: package with __init__.py"""

if __name__ == "__main__":
print(__doc__)
3 changes: 3 additions & 0 deletions examples/pkg-with-main/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .pkg import main

main()
5 changes: 5 additions & 0 deletions examples/pkg-with-main/pkg.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""Example: package with __main__.py"""


def main() -> None:
print(__doc__)
2 changes: 2 additions & 0 deletions examples/single-file/file-no-docstring.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
if __name__ == "__main__":
print("Example: file without docstring")
6 changes: 6 additions & 0 deletions examples/single-file/file-no-main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Example: file without `__main__`"""

# if __name__ == "__main__":
# print(__doc__)

print(__doc__)
5 changes: 5 additions & 0 deletions examples/single-file/file-with-main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python
"""Example: file with `__main__`"""

if __name__ == "__main__":
print(__doc__)

0 comments on commit a14b144

Please sign in to comment.