-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import typing | ||
|
||
|
||
def passthrough(method: typing.Callable) -> typing.Callable: | ||
return method | ||
|
||
|
||
class ExampleClass: | ||
"""This class has a docstring.""" | ||
|
||
def __init__(self, item): | ||
self._item = item | ||
|
||
@passthrough | ||
def print_item(self): | ||
print(self._item) | ||
|
||
def try_except(self): | ||
try: | ||
frozenset({self._item}) | ||
except Exception as ex: | ||
print(f'Format string: conversion error: {ex}') | ||
finally: | ||
pass | ||
|
||
|
||
def main(): | ||
example = ExampleClass([1, 2, 3]) | ||
example.print_item() | ||
example.try_except() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
PYTHON_PROGRAM="program.py" | ||
# Prepending `pwd` doesn't do much, it is here for demonstrating highlighting | ||
# of backticks, and a comment. | ||
input_file=`pwd`/$PYTHON_PROGRAM | ||
|
||
cat $input_file | while read line | ||
do | ||
echo "| Python | $line" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters