OXIESEC PANEL
- Current Dir:
/
/
snap
/
certbot
/
4730
/
lib
/
python3.12
/
site-packages
/
setuptools
/
_vendor
/
jaraco
/
text
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
06/10/2025 09:51:14 PM
rwxr-xr-x
📄
Lorem ipsum.txt
1.3 KB
06/10/2025 09:50:49 PM
rw-r--r--
📄
__init__.py
15.87 KB
06/10/2025 09:50:49 PM
rw-r--r--
📁
__pycache__
-
06/10/2025 09:51:14 PM
rwxr-xr-x
📄
layouts.py
643 bytes
06/10/2025 09:50:49 PM
rw-r--r--
📄
show-newlines.py
904 bytes
06/10/2025 09:50:49 PM
rw-r--r--
📄
strip-prefix.py
412 bytes
06/10/2025 09:50:49 PM
rw-r--r--
📄
to-dvorak.py
119 bytes
06/10/2025 09:50:49 PM
rw-r--r--
📄
to-qwerty.py
119 bytes
06/10/2025 09:50:49 PM
rw-r--r--
Editing: show-newlines.py
Close
import autocommand import inflect from more_itertools import always_iterable import jaraco.text def report_newlines(filename): r""" Report the newlines in the indicated file. >>> tmp_path = getfixture('tmp_path') >>> filename = tmp_path / 'out.txt' >>> _ = filename.write_text('foo\nbar\n', newline='', encoding='utf-8') >>> report_newlines(filename) newline is '\n' >>> filename = tmp_path / 'out.txt' >>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8') >>> report_newlines(filename) newlines are ('\n', '\r\n') """ newlines = jaraco.text.read_newlines(filename) count = len(tuple(always_iterable(newlines))) engine = inflect.engine() print( engine.plural_noun("newline", count), engine.plural_verb("is", count), repr(newlines), ) autocommand.autocommand(__name__)(report_newlines)