Fix typos (the the > the) (#52711)

* Fix typos (`the the` > `the`)

It looks like humans aren't only very bad at recognizing a double `the` in a sentence when reading [1], but they're also very good at sneaking them in unintentionally without noticing.

Fix this by running:
```
ack --ignore-dir=doc/man --ignore-dir=doc/topics/releases -i 'the the\W' -l | xargs sed -i 's|the the\(\W\)|the\1|g'
```

[1] Eye movements and word skipping during reading: Effects of word length and predictability: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3543826/

* Blacken changed files

* Blacken changed files

* Re-add unintentional delete

* Bad merge fix

* Fix broken docstring

* Another try

* pre-commit should pass now?

Co-authored-by: Daniel A. Wozniak <dwozniak@saltstack.com>
Co-authored-by: Wayne Werner <wwerner@saltstack.com>
This commit is contained in:
Elias Probst 2020-04-28 19:02:41 +02:00 committed by GitHub
parent a8d3c06414
commit 34fb50b134
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 89 additions and 86 deletions

View file

@ -53,7 +53,7 @@ build_stubs() {
get_excludes() {
# This is a tad convoluted. We need to list all top-level files and
# directories in the main Salt dir _except_ for the main __init__.py file
# and the the module directory for the module we're building for.
# and the module directory for the module we're building for.
# ...that way sphinx-apidoc will exclude them from the build. (o_O)
exclude="${1:?Dirname to exclude is required.}"

View file

@ -176,7 +176,6 @@ execution of the tests. Additionally, if the ``libcloud`` library is not
available, since that's not actually part of what's being tested, we mocked that
import by patching ``sys.modules`` when tests are running.
Mocking Filehandles
-------------------
@ -341,7 +340,7 @@ Multiple File Contents
For cases in which a file is being read more than once, and it is necessary to
test a function's behavior based on what the file looks like the second (or
third, etc.) time it is read, just specify the the contents for that file as a
third, etc.) time it is read, just specify the contents for that file as a
list. Each time the file is opened, ``mock_open`` will cycle through the list
and produce a mocked filehandle with the specified contents. For example:

View file

@ -28,7 +28,7 @@ FirewallD use the command line client ``firewall-cmd``.
firewall-cmd --permanent --zone=<zone> --add-port=4505-4506/tcp
A network zone defines the security level of trust for the the network.
A network zone defines the security level of trust for the network.
The user should choose an appropriate zone value for their setup.
Possible values include: drop, block, public, external, dmz, work, home, internal, trusted.

View file

@ -3,7 +3,7 @@ Function Start_Process_and_test_exitcode {
# This function is a wrapper for Start-Process that checks the exitcode
# It receives 3 parameters:
# $fun - the process that shall be started
# $args - the the arguments of $fun
# $args - the arguments of $fun
# $descr - the short description shown in the case of an error
Param(

View file

@ -107,7 +107,7 @@ __virtualname__ = "status"
def validate(config):
"""
Validate the the config is a dict
Validate the config is a dict
"""
if not isinstance(config, list):
return False, ("Configuration for status beacon must be a list.")

View file

@ -26,13 +26,13 @@ from __future__ import absolute_import, division, print_function
import functools
import platform
import sys
import textwrap
import traceback
import sys
from salt.ext.tornado.log import app_log
from salt.ext.tornado.stack_context import ExceptionStackContext, wrap
from salt.ext.tornado.util import raise_exc_info, ArgReplacer, is_finalizing
from salt.ext.tornado.util import ArgReplacer, is_finalizing, raise_exc_info
try:
from concurrent import futures
@ -47,13 +47,16 @@ except ImportError:
# Can the garbage collector handle cycles that include __del__ methods?
# This is true in cpython beginning with version 3.4 (PEP 442).
_GC_CYCLE_FINALIZERS = (platform.python_implementation() == 'CPython' and
sys.version_info >= (3, 4))
_GC_CYCLE_FINALIZERS = platform.python_implementation() == "CPython" and sys.version_info >= (
3,
4,
)
class ReturnValueIgnoredError(Exception):
pass
# This class and associated code in the future object is derived
# from the Trollius project, a backport of asyncio to Python 2.x - 3.x
@ -86,7 +89,7 @@ class _TracebackLogger(object):
the Future is collected, and the helper is present, the helper
object is also collected, and its __del__() method will log the
traceback. When the Future's result() or exception() method is
called (and a helper object is present), it removes the the helper
called (and a helper object is present), it removes the helper
object, after calling its clear() method to prevent it from
logging.
@ -108,7 +111,7 @@ class _TracebackLogger(object):
in a discussion about closing files when they are collected.
"""
__slots__ = ('exc_info', 'formatted_tb')
__slots__ = ("exc_info", "formatted_tb")
def __init__(self, exc_info):
self.exc_info = exc_info
@ -126,8 +129,10 @@ class _TracebackLogger(object):
def __del__(self, is_finalizing=is_finalizing):
if not is_finalizing() and self.formatted_tb:
app_log.error('Future exception was never retrieved: %s',
''.join(self.formatted_tb).rstrip())
app_log.error(
"Future exception was never retrieved: %s",
"".join(self.formatted_tb).rstrip(),
)
class Future(object):
@ -166,23 +171,28 @@ class Future(object):
suppress the logging by ensuring that the exception is observed:
``f.add_done_callback(lambda f: f.exception())``.
"""
def __init__(self):
self._done = False
self._result = None
self._exc_info = None
self._log_traceback = False # Used for Python >= 3.4
self._tb_logger = None # Used for Python <= 3.3
self._log_traceback = False # Used for Python >= 3.4
self._tb_logger = None # Used for Python <= 3.3
self._callbacks = []
# Implement the Python 3.5 Awaitable protocol if possible
# (we can't use return and yield together until py33).
if sys.version_info >= (3, 3):
exec(textwrap.dedent("""
exec(
textwrap.dedent(
"""
def __await__(self):
return (yield self)
"""))
"""
)
)
else:
# Py2-compatible version for use with cython.
def __await__(self):
@ -282,9 +292,8 @@ class Future(object):
def set_exception(self, exception):
"""Sets the exception of a ``Future.``"""
self.set_exc_info(
(exception.__class__,
exception,
getattr(exception, '__traceback__', None)))
(exception.__class__, exception, getattr(exception, "__traceback__", None))
)
def exc_info(self):
"""Returns a tuple in the same format as `sys.exc_info` or None.
@ -325,14 +334,14 @@ class Future(object):
try:
cb(self)
except Exception:
app_log.exception('Exception in callback %r for %r',
cb, self)
app_log.exception("Exception in callback %r for %r", cb, self)
self._callbacks = None
# On Python 3.3 or older, objects with a destructor part of a reference
# cycle are never destroyed. It's no longer the case on Python 3.4 thanks to
# the PEP 442.
if _GC_CYCLE_FINALIZERS:
def __del__(self, is_finalizing=is_finalizing):
if is_finalizing() or not self._log_traceback:
# set_exception() was not called, or result() or exception()
@ -341,8 +350,11 @@ class Future(object):
tb = traceback.format_exception(*self._exc_info)
app_log.error('Future %r exception was never retrieved: %s',
self, ''.join(tb).rstrip())
app_log.error(
"Future %r exception was never retrieved: %s",
self,
"".join(tb).rstrip(),
)
TracebackFuture = Future
@ -390,6 +402,7 @@ def run_on_executor(*args, **kwargs):
.. versionchanged:: 4.2
Added keyword arguments to use alternative attributes.
"""
def run_on_executor_decorator(fn):
executor = kwargs.get("executor", "executor")
io_loop = kwargs.get("io_loop", "io_loop")
@ -400,9 +413,12 @@ def run_on_executor(*args, **kwargs):
future = getattr(self, executor).submit(fn, self, *args, **kwargs)
if callback:
getattr(self, io_loop).add_future(
future, lambda future: callback(future.result()))
future, lambda future: callback(future.result())
)
return future
return wrapper
if args and kwargs:
raise ValueError("cannot combine positional and keyword args")
if len(args) == 1:
@ -454,18 +470,19 @@ def return_future(f):
same function, provided ``@return_future`` appears first. However,
consider using ``@gen.coroutine`` instead of this combination.
"""
replacer = ArgReplacer(f, 'callback')
replacer = ArgReplacer(f, "callback")
@functools.wraps(f)
def wrapper(*args, **kwargs):
future = TracebackFuture()
callback, args, kwargs = replacer.replace(
lambda value=_NO_RESULT: future.set_result(value),
args, kwargs)
lambda value=_NO_RESULT: future.set_result(value), args, kwargs
)
def handle_error(typ, value, tb):
future.set_exc_info((typ, value, tb))
return True
exc_info = None
with ExceptionStackContext(handle_error):
try:
@ -473,7 +490,8 @@ def return_future(f):
if result is not None:
raise ReturnValueIgnoredError(
"@return_future should not be used with functions "
"that return values")
"that return values"
)
except:
exc_info = sys.exc_info()
raise
@ -490,14 +508,17 @@ def return_future(f):
# immediate exception, and again when the future resolves and
# the callback triggers its exception by calling future.result()).
if callback is not None:
def run_callback(future):
result = future.result()
if result is _NO_RESULT:
callback()
else:
callback(future.result())
future.add_done_callback(wrap(run_callback))
return future
return wrapper
@ -507,16 +528,20 @@ def chain_future(a, b):
The result (success or failure) of ``a`` will be copied to ``b``, unless
``b`` has already been completed or cancelled by the time ``a`` finishes.
"""
def copy(future):
assert future is a
if b.done():
return
if (isinstance(a, TracebackFuture) and
isinstance(b, TracebackFuture) and
a.exc_info() is not None):
if (
isinstance(a, TracebackFuture)
and isinstance(b, TracebackFuture)
and a.exc_info() is not None
):
b.set_exc_info(a.exc_info())
elif a.exception() is not None:
b.set_exception(a.exception())
else:
b.set_result(a.result())
a.add_done_callback(copy)

View file

@ -66,7 +66,7 @@ def compare_changes(obj, **kwargs):
def _clean_kwargs(keep_name=False, **kwargs):
"""
Sanatize the the arguments for use with shade
Sanatize the arguments for use with shade
"""
if "name" in kwargs and not keep_name:
kwargs["name_or_id"] = kwargs.pop("name")

View file

@ -89,7 +89,7 @@ def get_entity(ent_type, **kwargs):
def _clean_kwargs(keep_name=False, **kwargs):
"""
Sanatize the the arguments for use with shade
Sanatize the arguments for use with shade
"""
if "name" in kwargs and not keep_name:
kwargs["name_or_id"] = kwargs.pop("name")

View file

@ -8,7 +8,6 @@ lxc >= 1.0 (even beta alpha) is required
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import copy
@ -26,8 +25,6 @@ import textwrap
import time
import salt.config
# Import salt libs
import salt.utils.args
import salt.utils.cloud
import salt.utils.data
@ -40,12 +37,10 @@ import salt.utils.odict
import salt.utils.path
import salt.utils.stringutils
from salt.exceptions import CommandExecutionError, SaltInvocationError
# Import 3rd-party libs
from salt.ext import six
# pylint: disable=import-error,no-name-in-module
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
from salt.ext.six.moves import range
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse
from salt.utils.versions import LooseVersion as _LooseVersion
@ -1962,7 +1957,7 @@ def create(
def select(key, default=None):
kw_overrides_match = kw_overrides.pop(key, None)
profile_match = profile.pop(key, default)
# Return the profile match if the the kwarg match was None, as the
# Return the profile match if the kwarg match was None, as the
# lxc.present state will pass these kwargs set to None by default.
if kw_overrides_match is None:
return profile_match

View file

@ -243,7 +243,7 @@ def get_last_change(name):
def get_login_failed_count(name):
"""
Get the the number of failed login attempts
Get the number of failed login attempts
:param str name: The username of the account

View file

@ -67,7 +67,7 @@ def compare_changes(obj, **kwargs):
def _clean_kwargs(keep_name=False, **kwargs):
"""
Sanatize the the arguments for use with shade
Sanatize the arguments for use with shade
"""
if "name" in kwargs and not keep_name:
kwargs["name_or_id"] = kwargs.pop("name")

View file

@ -504,7 +504,7 @@ def install(
``user@proxy.server:port`` then you will be prompted for a password.
.. note::
If the the Minion has a globaly configured proxy - it will be used
If the Minion has a globaly configured proxy - it will be used
even if no proxy was set here. To explicitly disable proxy for pip
you should pass ``False`` as a value.
@ -1050,7 +1050,7 @@ def uninstall(
``user@proxy.server:port`` then you will be prompted for a password.
.. note::
If the the Minion has a globaly configured proxy - it will be used
If the Minion has a globaly configured proxy - it will be used
even if no proxy was set here. To explicitly disable proxy for pip
you should pass ``False`` as a value.

View file

@ -18,7 +18,7 @@ can have a value assigned to them under the (Default)
When passing a key on the CLI it must be quoted correctly depending on the
backslashes being used (``\`` vs ``\\``). The following are valid methods of
passing the the key on the CLI:
passing the key on the CLI:
Using single backslashes:
``"SOFTWARE\Python"``

View file

@ -2371,7 +2371,7 @@ def system_info(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_datacenters(host, username, password, protocol=None, port=None):
"""
Returns a list of datacenters for the the specified host.
Returns a list of datacenters for the specified host.
host
The location of the host.
@ -2407,7 +2407,7 @@ def list_datacenters(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_clusters(host, username, password, protocol=None, port=None):
"""
Returns a list of clusters for the the specified host.
Returns a list of clusters for the specified host.
host
The location of the host.
@ -2443,7 +2443,7 @@ def list_clusters(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_datastore_clusters(host, username, password, protocol=None, port=None):
"""
Returns a list of datastore clusters for the the specified host.
Returns a list of datastore clusters for the specified host.
host
The location of the host.
@ -2478,7 +2478,7 @@ def list_datastore_clusters(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_datastores(host, username, password, protocol=None, port=None):
"""
Returns a list of datastores for the the specified host.
Returns a list of datastores for the specified host.
host
The location of the host.
@ -2513,7 +2513,7 @@ def list_datastores(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_hosts(host, username, password, protocol=None, port=None):
"""
Returns a list of hosts for the the specified VMware environment.
Returns a list of hosts for the specified VMware environment.
host
The location of the host.
@ -2548,7 +2548,7 @@ def list_hosts(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_resourcepools(host, username, password, protocol=None, port=None):
"""
Returns a list of resource pools for the the specified host.
Returns a list of resource pools for the specified host.
host
The location of the host.
@ -2583,7 +2583,7 @@ def list_resourcepools(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_networks(host, username, password, protocol=None, port=None):
"""
Returns a list of networks for the the specified host.
Returns a list of networks for the specified host.
host
The location of the host.
@ -2618,7 +2618,7 @@ def list_networks(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_vms(host, username, password, protocol=None, port=None):
"""
Returns a list of VMs for the the specified host.
Returns a list of VMs for the specified host.
host
The location of the host.
@ -2653,7 +2653,7 @@ def list_vms(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_folders(host, username, password, protocol=None, port=None):
"""
Returns a list of folders for the the specified host.
Returns a list of folders for the specified host.
host
The location of the host.
@ -2688,7 +2688,7 @@ def list_folders(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_dvs(host, username, password, protocol=None, port=None):
"""
Returns a list of distributed virtual switches for the the specified host.
Returns a list of distributed virtual switches for the specified host.
host
The location of the host.
@ -2723,7 +2723,7 @@ def list_dvs(host, username, password, protocol=None, port=None):
@ignores_kwargs("credstore")
def list_vapps(host, username, password, protocol=None, port=None):
"""
Returns a list of vApps for the the specified host.
Returns a list of vApps for the specified host.
host
The location of the host.
@ -5405,7 +5405,7 @@ def update_storage_policy(policy, policy_dict, service_instance=None):
@gets_service_instance_via_proxy
def list_default_storage_policy_of_datastore(datastore, service_instance=None):
"""
Returns a list of datastores assign the the storage policies.
Returns a list of datastores assign the storage policies.
datastore
Name of the datastore to assign.
@ -6503,7 +6503,7 @@ def list_hosts_via_proxy(
hostnames=None, datacenter=None, cluster=None, service_instance=None
):
"""
Returns a list of hosts for the the specified VMware environment. The list
Returns a list of hosts for the specified VMware environment. The list
of hosts can be filtered by datacenter name and/or cluster name
hostnames

View file

@ -365,7 +365,7 @@ def apply_config(path, source=None, salt_env="base"):
CLI Example:
To apply a config that already exists on the the system
To apply a config that already exists on the system
.. code-block:: bash

View file

@ -837,7 +837,7 @@ def set_wu_settings(
# Apparently the Windows Update framework in Windows Vista - Windows 8.1 has
# been changed quite a bit in Windows 10 / Server 2016. It is now called the
# Unified Update Platform (UUP). I haven't found an API or a Powershell
# commandlet for working with the the UUP. Perhaps there will be something
# commandlet for working with the UUP. Perhaps there will be something
# forthcoming. The `win_lgpo` module might be an option for changing the
# Windows Update settings using local group policy.
ret = {"Success": True}

View file

@ -135,7 +135,7 @@ may be updating for an ESXi host either via the
execution module function or via the
:mod:`esxi.password_present <salt.states.esxi.password_present>` state
function. This way, after the password is changed, you should not need to
restart the proxy minion--it should just pick up the the new password
restart the proxy minion--it should just pick up the new password
provided in the list. You can then change pillar at will to move that
password to the front and retire the unused ones.
@ -270,22 +270,18 @@ for standing up an ESXi host from scratch.
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
import os
from salt.config.schemas.esxi import EsxiProxySchema
# Import Salt Libs
from salt.exceptions import InvalidConfigError, SaltSystemExit
from salt.utils.dictupdate import merge
# This must be present or the Salt loader won't load this module.
__proxyenabled__ = ["esxi"]
# External libraries
try:
import jsonschema

View file

@ -54,11 +54,7 @@ import os
import salt.utils.args
import salt.utils.data
import salt.utils.dockermod
# Import Salt libs
from salt.exceptions import CommandExecutionError
# Import 3rd-party libs
from salt.ext import six
# Enable proper logging
@ -2017,7 +2013,7 @@ def running(
# "not cleanup_temp" means that the temp container became permanent, either
# because the named container did not exist or changes were detected
# "cleanup_temp" means that the container already existed and no changes
# were detected, so the the temp container was discarded
# were detected, so the temp container was discarded
if (
not cleanup_temp
and (not exists or (exists and start))

View file

@ -67,7 +67,7 @@ def init(
):
"""
Initalizes the LXD Daemon, as LXD doesn't tell if its initialized
we touch the the done_file and check if it exist.
we touch the done_file and check if it exist.
This can only be called once per host unless you remove the done_file.

View file

@ -6,7 +6,7 @@ The following can be retrieved:
(1) List of added, removed, intersect elements
(2) List of diffs having the following format:
<key_val>: {<elem_key: {'old': <old_value>, 'new': <new_value>}}
A recursive diff is done between the the values (dicts) with the same
A recursive diff is done between the values (dicts) with the same
key
(3) List with the new values for each key
(4) List with the old values for each key

View file

@ -14,23 +14,18 @@ There are 3 functions in this salt util.
- get_interface_info_wmi
- get_interface_info
The ``get_interface_info`` function will call one of the other two functions
depending on the the version of Windows this is run on. Once support for Windows
depending on the version of Windows this is run on. Once support for Windows
7 is dropped we can remove the WMI stuff and just use .NET.
:depends: - pythonnet
- wmi
"""
# https://docs.microsoft.com/en-us/dotnet/api/system.net.networkinformation.networkinterface.getallnetworkinterfaces?view=netframework-4.7.2
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import ipaddress
import platform
# Import 3rd party libs
# I don't understand why I need this import, but the linter fails without it
from salt.ext.six.moves import range
# Import Salt libs
from salt.utils.versions import StrictVersion
IS_WINDOWS = platform.system() == "Windows"

View file

@ -27,7 +27,6 @@ The wheel key functions can also be called via a ``salt`` command at the CLI
using the :mod:`saltutil execution module <salt.modules.saltutil>`.
"""
# Import python libs
from __future__ import absolute_import, print_function, unicode_literals
import hashlib
@ -38,8 +37,6 @@ import salt.crypt
import salt.utils.crypt
import salt.utils.files
import salt.utils.platform
# Import salt libs
from salt.key import get_key
from salt.utils.sanitizers import clean
@ -352,7 +349,7 @@ def gen(id_=None, keysize=2048):
r"""
Generate a key pair. No keys are stored on the master. A key pair is
returned as a dict containing pub and priv keys. Returns a dictionary
containing the the ``pub`` and ``priv`` keys with their generated values.
containing the ``pub`` and ``priv`` keys with their generated values.
id\_
Set a name to generate a key pair for use with salt. If not specified,

View file

@ -19,7 +19,7 @@ from tests.support.unit import skipIf
class WinPKGTest(ModuleCase):
"""
Tests for salt.modules.win_pkg. There are already
some pkg execution module tests in the the test
some pkg execution module tests in the test
integration.modules.test_pkg but this will be for
specific windows software repository tests while
using the win_pkg module.

View file

@ -1366,7 +1366,7 @@ class OpenNebulaTestCase(TestCase, LoaderModuleMockMixin):
def test_vm_migrate_no_host_id_or_host_name(self):
"""
Tests that a SaltCloudSystemExit is raised when the the host_id and the
Tests that a SaltCloudSystemExit is raised when the host_id and the
host_name args are missing.
"""
self.assertRaises(