mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-20 05:13:21 -07:00
Update cherrypy==18.9.0
This commit is contained in:
parent
2fc618c01f
commit
51196a7fb1
137 changed files with 44442 additions and 11582 deletions
|
@ -227,10 +227,12 @@ def unwrap(s):
|
|||
return '\n'.join(cleaned)
|
||||
|
||||
|
||||
lorem_ipsum: str = files(__name__).joinpath('Lorem ipsum.txt').read_text()
|
||||
lorem_ipsum: str = (
|
||||
files(__name__).joinpath('Lorem ipsum.txt').read_text(encoding='utf-8')
|
||||
)
|
||||
|
||||
|
||||
class Splitter(object):
|
||||
class Splitter:
|
||||
"""object that will split a string with the given arguments for each call
|
||||
|
||||
>>> s = Splitter(',')
|
||||
|
@ -367,7 +369,7 @@ class WordSet(tuple):
|
|||
return self.trim_left(item).trim_right(item)
|
||||
|
||||
def __getitem__(self, item):
|
||||
result = super(WordSet, self).__getitem__(item)
|
||||
result = super().__getitem__(item)
|
||||
if isinstance(item, slice):
|
||||
result = WordSet(result)
|
||||
return result
|
||||
|
@ -582,7 +584,7 @@ def join_continuation(lines):
|
|||
['foobarbaz']
|
||||
|
||||
Not sure why, but...
|
||||
The character preceeding the backslash is also elided.
|
||||
The character preceding the backslash is also elided.
|
||||
|
||||
>>> list(join_continuation(['goo\\', 'dly']))
|
||||
['godly']
|
||||
|
@ -607,16 +609,16 @@ def read_newlines(filename, limit=1024):
|
|||
r"""
|
||||
>>> tmp_path = getfixture('tmp_path')
|
||||
>>> filename = tmp_path / 'out.txt'
|
||||
>>> _ = filename.write_text('foo\n', newline='')
|
||||
>>> _ = filename.write_text('foo\n', newline='', encoding='utf-8')
|
||||
>>> read_newlines(filename)
|
||||
'\n'
|
||||
>>> _ = filename.write_text('foo\r\n', newline='')
|
||||
>>> _ = filename.write_text('foo\r\n', newline='', encoding='utf-8')
|
||||
>>> read_newlines(filename)
|
||||
'\r\n'
|
||||
>>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='')
|
||||
>>> _ = filename.write_text('foo\r\nbar\nbing\r', newline='', encoding='utf-8')
|
||||
>>> read_newlines(filename)
|
||||
('\r', '\n', '\r\n')
|
||||
"""
|
||||
with open(filename) as fp:
|
||||
with open(filename, encoding='utf-8') as fp:
|
||||
fp.read(limit)
|
||||
return fp.newlines
|
||||
|
|
|
@ -12,11 +12,11 @@ def report_newlines(filename):
|
|||
|
||||
>>> tmp_path = getfixture('tmp_path')
|
||||
>>> filename = tmp_path / 'out.txt'
|
||||
>>> _ = filename.write_text('foo\nbar\n', newline='')
|
||||
>>> _ = 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='')
|
||||
>>> _ = filename.write_text('foo\nbar\r\n', newline='', encoding='utf-8')
|
||||
>>> report_newlines(filename)
|
||||
newlines are ('\n', '\r\n')
|
||||
"""
|
||||
|
|
21
lib/jaraco/text/strip-prefix.py
Normal file
21
lib/jaraco/text/strip-prefix.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import sys
|
||||
|
||||
import autocommand
|
||||
|
||||
from jaraco.text import Stripper
|
||||
|
||||
|
||||
def strip_prefix():
|
||||
r"""
|
||||
Strip any common prefix from stdin.
|
||||
|
||||
>>> import io, pytest
|
||||
>>> getfixture('monkeypatch').setattr('sys.stdin', io.StringIO('abcdef\nabc123'))
|
||||
>>> strip_prefix()
|
||||
def
|
||||
123
|
||||
"""
|
||||
sys.stdout.writelines(Stripper.strip_prefix(sys.stdin).lines)
|
||||
|
||||
|
||||
autocommand.autocommand(__name__)(strip_prefix)
|
Loading…
Add table
Add a link
Reference in a new issue