mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-21 13:53:15 -07:00
Update vendored windows libs
This commit is contained in:
parent
f61c211655
commit
b1cefa94e5
226 changed files with 33472 additions and 11882 deletions
33
libs/win/jaraco/text/show-newlines.py
Normal file
33
libs/win/jaraco/text/show-newlines.py
Normal file
|
@ -0,0 +1,33 @@
|
|||
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='')
|
||||
>>> report_newlines(filename)
|
||||
newline is '\n'
|
||||
>>> filename = tmp_path / 'out.txt'
|
||||
>>> _ = filename.write_text('foo\nbar\r\n', newline='')
|
||||
>>> 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)
|
Loading…
Add table
Add a link
Reference in a new issue