mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-20 17:52:50 +00:00
Improve the name and type annotation of the tempfile factory
This commit is contained in:
parent
3129898563
commit
c838967a54
@ -1030,14 +1030,14 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||
def init_web(self, webport):
|
||||
self.log("init_web(webport=%s)", args=(webport,))
|
||||
|
||||
from allmydata.webish import WebishServer, anonymous_tempfile
|
||||
from allmydata.webish import WebishServer, anonymous_tempfile_factory
|
||||
nodeurl_path = self.config.get_config_path("node.url")
|
||||
staticdir_config = self.config.get_config("node", "web.static", "public_html")
|
||||
staticdir = self.config.get_config_path(staticdir_config)
|
||||
ws = WebishServer(
|
||||
self,
|
||||
webport,
|
||||
anonymous_tempfile(self._get_tempdir()),
|
||||
anonymous_tempfile_factory(self._get_tempdir()),
|
||||
nodeurl_path,
|
||||
staticdir,
|
||||
)
|
||||
|
@ -341,7 +341,7 @@ class WebMixin(TimezoneMixin):
|
||||
self.ws = webish.WebishServer(
|
||||
self.s,
|
||||
"0",
|
||||
webish.anonymous_tempfile(tempdir.path),
|
||||
webish.anonymous_tempfile_factory(tempdir.path),
|
||||
staticdir=self.staticdir,
|
||||
clock=self.clock,
|
||||
now_fn=lambda:self.fakeTime,
|
||||
|
@ -50,7 +50,7 @@ from ..common import (
|
||||
from ...webish import (
|
||||
TahoeLAFSRequest,
|
||||
TahoeLAFSSite,
|
||||
anonymous_tempfile,
|
||||
anonymous_tempfile_factory,
|
||||
)
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ class TahoeLAFSSiteTests(SyncTestCase):
|
||||
FilePath(tempdir).makedirs()
|
||||
|
||||
site = TahoeLAFSSite(
|
||||
anonymous_tempfile(tempdir),
|
||||
anonymous_tempfile_factory(tempdir),
|
||||
Resource(),
|
||||
logPath=logPath,
|
||||
)
|
||||
|
@ -217,7 +217,7 @@ def censor(queryargs: bytes) -> bytes:
|
||||
return urlencode(result, safe="[]").encode("ascii")
|
||||
|
||||
|
||||
def anonymous_tempfile(tempdir: bytes) -> BinaryIO:
|
||||
def anonymous_tempfile_factory(tempdir: bytes) -> Callable[[], BinaryIO]:
|
||||
"""
|
||||
Create a no-argument callable for creating a new temporary file in the
|
||||
given directory.
|
||||
|
Loading…
x
Reference in New Issue
Block a user