Commit Graph

11 Commits

Author SHA1 Message Date
Kovid Goyal
6546c1da9b
run pyupgrade to upgrade the codebase to python3.6 2021-10-21 12:43:55 +05:30
Kovid Goyal
9cd8637e9c
Remove another use of __file__ 2021-02-19 14:49:07 +05:30
Luflosi
5f855ce547
Use context managers to open files
Inspired by d50a6ddc1b.
2019-08-01 13:21:26 -05:00
Luflosi
2b095f720e
Use "with suppress()" to suppress python exceptions
Using
```Python
with suppress(OSError):
    os.remove('somefile.tmp')
```
instead of
```Python
try:
    os.remove('somefile.tmp')
except OSError:
    pass
```
makes the code more compact and more readable IMO.

This pattern was recommended by Raymond Hettinger, a Python Core
Developer in his talk "Transforming Code into Beautiful, Idiomatic Python" at https://www.youtube.com/watch?v=OSGv2VnC0go. The transcript is available at https://github.com/JeffPaine/beautiful_idiomatic_python
2019-06-03 12:27:43 +02:00
Luflosi
a792c94ccf
Use python3 shebang for all python scripts
Fixes #1624.
Use python3 shebang for all python scripts as python still defaults to python2 on many systems.
2019-05-20 14:44:24 +02:00
Kovid Goyal
815dd99f7c
Keep the Debian PC police happy
Fixes #661
2018-06-21 13:12:45 +05:30
Kovid Goyal
40722f42d3
... 2017-10-17 10:18:03 +05:30
Kovid Goyal
192b16e9ff
Add Lenna to the test dir so the gr.py script becomes self-sufficient 2017-10-17 10:15:38 +05:30
Kovid Goyal
55db07c79f
Only display Lenna if she exists in the gr script 2017-10-16 18:52:17 +05:30
Kovid Goyal
75e84a4519
Let the gr.pt script run with python2 as well 2017-10-16 18:50:57 +05:30
Kovid Goyal
664975b707
Show off kitty's graphics capabilities 2017-10-05 16:49:34 +05:30