mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-21 20:08:15 +00:00
fix the type annotations and such
This commit is contained in:
parent
d0ee17d99e
commit
f8655f149b
@ -25,6 +25,11 @@ if PY2:
|
|||||||
from past.builtins import unicode
|
from past.builtins import unicode
|
||||||
from six import ensure_text
|
from six import ensure_text
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Dict, Callable
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from base64 import b32encode
|
from base64 import b32encode
|
||||||
from functools import (
|
from functools import (
|
||||||
@ -622,7 +627,7 @@ class GridTestMixin(object):
|
|||||||
f.write(corruptdata)
|
f.write(corruptdata)
|
||||||
|
|
||||||
def corrupt_all_shares(self, uri, corruptor, debug=False):
|
def corrupt_all_shares(self, uri, corruptor, debug=False):
|
||||||
# type: (bytes, Callable[[bytes, bool], bytes] -> bytes), bool) -> None
|
# type: (bytes, Callable[[bytes, bool], bytes], bool) -> None
|
||||||
"""
|
"""
|
||||||
Apply ``corruptor`` to the contents of all share files associated with a
|
Apply ``corruptor`` to the contents of all share files associated with a
|
||||||
given capability and replace the share file contents with its result.
|
given capability and replace the share file contents with its result.
|
||||||
@ -630,7 +635,7 @@ class GridTestMixin(object):
|
|||||||
for (i_shnum, i_serverid, i_sharefile) in self.find_uri_shares(uri):
|
for (i_shnum, i_serverid, i_sharefile) in self.find_uri_shares(uri):
|
||||||
with open(i_sharefile, "rb") as f:
|
with open(i_sharefile, "rb") as f:
|
||||||
sharedata = f.read()
|
sharedata = f.read()
|
||||||
corruptdata = corruptor(sharedata, debug=debug)
|
corruptdata = corruptor(sharedata, debug)
|
||||||
with open(i_sharefile, "wb") as f:
|
with open(i_sharefile, "wb") as f:
|
||||||
f.write(corruptdata)
|
f.write(corruptdata)
|
||||||
|
|
||||||
|
@ -14,6 +14,11 @@ if PY2:
|
|||||||
# a previous run. This asserts that the current code is capable of decoding
|
# a previous run. This asserts that the current code is capable of decoding
|
||||||
# shares from a previous version.
|
# shares from a previous version.
|
||||||
|
|
||||||
|
try:
|
||||||
|
from typing import Any
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
import six
|
import six
|
||||||
import os
|
import os
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
|
Loading…
Reference in New Issue
Block a user