mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-09 11:51:21 +00:00
Merge remote-tracking branch 'origin/master' into 3565.web-tests-python-3-part-1
This commit is contained in:
commit
5315d48355
@ -59,10 +59,10 @@ def run_cli_native(verb, *args, **kwargs):
|
||||
Most code should prefer ``run_cli_unicode`` which deals with all the
|
||||
necessary encoding considerations.
|
||||
|
||||
:param native_str verb: The command to run. For example, ``b"create-node"``.
|
||||
:param native_str verb: The command to run. For example, ``"create-node"``.
|
||||
|
||||
:param [native_str] args: The arguments to pass to the command. For example,
|
||||
``(b"--hostname=localhost",)``.
|
||||
``("--hostname=localhost",)``.
|
||||
|
||||
:param [native_str] nodeargs: Extra arguments to pass to the Tahoe executable
|
||||
before ``verb``.
|
||||
|
@ -70,7 +70,13 @@ from ..scripts.common import (
|
||||
|
||||
def run_cli(*args, **kwargs):
|
||||
"""
|
||||
Backwards compatible version so we don't have to change all the tests.
|
||||
Run a Tahoe-LAFS CLI utility, but inline.
|
||||
|
||||
Version of run_cli_unicode() that takes any kind of string, and the
|
||||
command-line args inline instead of as verb + list.
|
||||
|
||||
Backwards compatible version so we don't have to change all the tests that
|
||||
expected this API.
|
||||
"""
|
||||
nodeargs = [ensure_text(a) for a in kwargs.pop("nodeargs", [])]
|
||||
kwargs["nodeargs"] = nodeargs
|
||||
@ -658,7 +664,7 @@ def flush_but_dont_ignore(res):
|
||||
|
||||
def _render_config(config):
|
||||
"""
|
||||
Convert a ``dict`` of ``dict`` of ``bytes`` to an ini-format string.
|
||||
Convert a ``dict`` of ``dict`` of ``unicode`` to an ini-format string.
|
||||
"""
|
||||
return u"\n\n".join(list(
|
||||
_render_config_section(k, v)
|
||||
@ -668,8 +674,8 @@ def _render_config(config):
|
||||
|
||||
def _render_config_section(heading, values):
|
||||
"""
|
||||
Convert a ``bytes`` heading and a ``dict`` of ``bytes`` to an ini-format
|
||||
section as ``bytes``.
|
||||
Convert a ``unicode`` heading and a ``dict`` of ``unicode`` to an ini-format
|
||||
section as ``unicode``.
|
||||
"""
|
||||
return u"[{}]\n{}\n".format(
|
||||
heading, _render_section_values(values)
|
||||
@ -677,8 +683,8 @@ def _render_config_section(heading, values):
|
||||
|
||||
def _render_section_values(values):
|
||||
"""
|
||||
Convert a ``dict`` of ``bytes`` to the body of an ini-format section as
|
||||
``bytes``.
|
||||
Convert a ``dict`` of ``unicode`` to the body of an ini-format section as
|
||||
``unicode``.
|
||||
"""
|
||||
return u"\n".join(list(
|
||||
u"{} = {}".format(k, v)
|
||||
|
@ -134,8 +134,7 @@ def a2b(cs):
|
||||
@param cs the base-32 encoded data (as bytes)
|
||||
"""
|
||||
# Workaround Future newbytes issues by converting to real bytes on Python 2:
|
||||
if hasattr(cs, "__native__"):
|
||||
cs = cs.__native__()
|
||||
cs = backwardscompat_bytes(cs)
|
||||
precondition(could_be_base32_encoded(cs), "cs is required to be possibly base32 encoded data.", cs=cs)
|
||||
precondition(isinstance(cs, bytes), cs)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user