Skip to content

Commit

Permalink
Merge pull request #399 from martin-belanger/codespell
Browse files Browse the repository at this point in the history
cosmetic: Ran codespell to fix typos in comments/docs
  • Loading branch information
martin-belanger committed Nov 2, 2023
2 parents fa23cc7 + bda4ae5 commit 71f8011
Show file tree
Hide file tree
Showing 17 changed files with 514 additions and 356 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/meson-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
sudo apt-get install --yes --quiet docbook-xml docbook-xsl xsltproc libglib2.0-dev libgirepository1.0-dev libsystemd-dev
sudo apt-get install --yes --quiet python3-systemd python3-pyudev python3-lxml
python3 -m pip install --upgrade dasbus pylint pyflakes PyGObject
python3 -m pip install --upgrade dasbus pylint==2.17.7 pyflakes PyGObject
python3 -m pip install --upgrade vermin pyfakefs importlib-resources
- name: "INSTALL: libnvme dependencies"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

docker-lint:
if: ${{ !github.event.act }} # skip during local actions testing
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
Expand All @@ -21,12 +21,12 @@ jobs:
ignore: DL3041

python-lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- name: "CHECKOUT: nvme-stas"
Expand All @@ -42,7 +42,7 @@ jobs:
sudo apt update
sudo apt-get install --yes --quiet python3-pip cmake libgirepository1.0-dev libsystemd-dev python3-systemd swig libjson-c-dev || true
sudo python3 -m pip install --upgrade pip wheel meson ninja
python3 -m pip install --upgrade dasbus pylint pyflakes PyGObject lxml pyudev
python3 -m pip install --upgrade dasbus pylint==2.17.7 pyflakes PyGObject lxml pyudev
- name: "BUILD: [libnvme, nvme-stas]"
uses: BSFishy/meson-build@v1.0.3
Expand Down
2 changes: 1 addition & 1 deletion doc/stafd.conf.xml
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@
DNS-SD/mDNS.
</para>
<para>
Discovery Controllers that support zeroconf advertize
Discovery Controllers that support zeroconf advertise
themselves over mDNS with the service type
<literal>_nvme-disc._tcp</literal>.
</para>
Expand Down
2 changes: 1 addition & 1 deletion etc/stas/stacd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
# before giving up. This value should never be
# set to 1. A value of 1 will automatically be
# increased to 2. That's because a single
# failure may be normal and a mimimum of 2
# failure may be normal and a minimum of 2
# attempts is required to conclude that a
# connection is not possible.
# Default: 0
Expand Down
6 changes: 3 additions & 3 deletions etc/stas/sys.conf.doc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# indicates that the Host NQN can be retrieved from a separate file.
# Typically, nvme-cli saves the Host NQN in /etc/nvme/hostnqn. For
# compatibility with nvme-cli, nvme-stas defaults to looking for the
# existance of this file and will read the NQN from it. Otherwise, you
# existence of this file and will read the NQN from it. Otherwise, you
# can overwrite the default NQN by specifying its value here or
# specifying another file that contains the Host NQN to use.
# Type: string
Expand All @@ -28,7 +28,7 @@
# indicates that the Host ID can be retrieved from a separate file.
# Typically, nvme-cli saves the Host ID in /etc/nvme/hostid. For
# compatibility with nvme-cli, nvme-stas defaults to looking for the
# existance of this file and will read the ID from it. Otherwise, you
# existence of this file and will read the ID from it. Otherwise, you
# can overwrite the default ID by specifying its value here or
# specifying another file that contains the Host ID to use.
# Type: string
Expand All @@ -41,7 +41,7 @@
# A value starting with "file://" indicates that the Host Key can
# be retrieved from a separate file. Typically, nvme-cli saves the
# Host Key in /etc/nvme/hostkey. For compatibility with nvme-cli,
# nvme-stas defaults to looking for the existance of this file and
# nvme-stas defaults to looking for the existence of this file and
# will read the Key from it. Otherwise, you can overwrite the default
# Key by specifying its value here or specifying another file that
# contains an alternate Host Key to use.
Expand Down
6 changes: 3 additions & 3 deletions stacd.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def tron(self):
return STAC.tron

@tron.setter
def tron(self, value): # pylint: disable=no-self-use
def tron(self, value):
'''@brief Set Trace ON property'''
STAC.tron = value

Expand All @@ -89,14 +89,14 @@ def process_info(self) -> str:
info.update(STAC.info())
return json.dumps(info)

def controller_info( # pylint: disable=too-many-arguments,no-self-use
def controller_info( # pylint: disable=too-many-arguments
self, transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn
) -> str:
'''@brief D-Bus method used to return information about a controller'''
controller = STAC.get_controller(transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn)
return json.dumps(controller.info()) if controller else '{}'

def list_controllers(self, detailed) -> list: # pylint: disable=no-self-use
def list_controllers(self, detailed) -> list:
'''@brief Return the list of I/O controller IDs'''
return [
controller.details() if detailed else controller.controller_id_dict()
Expand Down
10 changes: 5 additions & 5 deletions stafd.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def tron(self):
return STAF.tron

@tron.setter
def tron(self, value): # pylint: disable=no-self-use
def tron(self, value):
'''@brief Set Trace ON property'''
STAF.tron = value

Expand All @@ -108,21 +108,21 @@ def process_info(self) -> str:
info.update(STAF.info())
return json.dumps(info)

def controller_info( # pylint: disable=no-self-use,too-many-arguments
def controller_info( # pylint: disable=too-many-arguments
self, transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn
) -> str:
'''@brief D-Bus method used to return information about a controller'''
controller = STAF.get_controller(transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn)
return json.dumps(controller.info()) if controller else '{}'

def get_log_pages( # pylint: disable=no-self-use,too-many-arguments
def get_log_pages( # pylint: disable=too-many-arguments
self, transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn
) -> list:
'''@brief D-Bus method used to retrieve the discovery log pages from one controller'''
controller = STAF.get_controller(transport, traddr, trsvcid, subsysnqn, host_traddr, host_iface, host_nqn)
return controller.log_pages() if controller else list()

def get_all_log_pages(self, detailed) -> str: # pylint: disable=no-self-use
def get_all_log_pages(self, detailed) -> str:
'''@brief D-Bus method used to retrieve the discovery log pages from all controllers'''
log_pages = list()
for controller in STAF.get_controllers():
Expand All @@ -134,7 +134,7 @@ def get_all_log_pages(self, detailed) -> str: # pylint: disable=no-self-use
)
return json.dumps(log_pages)

def list_controllers(self, detailed) -> list: # pylint: disable=no-self-use
def list_controllers(self, detailed) -> list:
'''@brief Return the list of discovery controller IDs'''
return [
controller.details() if detailed else controller.controller_id_dict()
Expand Down
2 changes: 1 addition & 1 deletion staslib/avahi.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def _service_identified( # pylint: disable=too-many-locals

self._check_for_duplicate_ips()

def _failure_handler( # pylint: disable=no-self-use
def _failure_handler(
self,
_connection,
_sender_name: str,
Expand Down
2 changes: 1 addition & 1 deletion staslib/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ def __init__(self):
'dhchap_ctrl_secret': defs.KERNEL_VERSION >= defs.KERNEL_CTRLKEY_MIN_VERSION,
}

# If some of the options are False, we need to check wether they can be
# If some of the options are False, we need to check whether they can be
# read from '/dev/nvme-fabrics'. This method allows us to determine that
# an older kernel actually supports a specific option because it was
# backported to that kernel.
Expand Down
4 changes: 2 additions & 2 deletions staslib/ctrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def all_ops_completed(self) -> bool:

@property
def origin(self):
'''@brief Return how this controller came into existance. Was it
'''@brief Return how this controller came into existence. Was it
"discovered" through mDNS service discovery (TP8009), was it manually
"configured" in stafd.conf, or was it a "referral".
'''
Expand Down Expand Up @@ -853,6 +853,6 @@ def update_dlpe(self, dlpe):
self._try_to_connect_deferred.schedule()

def _should_try_to_reconnect(self):
'''@brief This is used to determine when it's time to stop trying toi connect'''
'''@brief This is used to determine when it's time to stop trying to connect'''
max_connect_attempts = conf.SvcConf().connect_attempts_on_ncc if self.ncc else 0
return max_connect_attempts == 0 or self._connect_attempts < max_connect_attempts
2 changes: 1 addition & 1 deletion staslib/gutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def in_thread_exec(task, self, task_data, cancellable): # pylint: disable=unuse
task.run_in_thread(in_thread_exec)
return task

def communicate_finish(self, result): # pylint: disable=no-self-use
def communicate_finish(self, result):
'''@brief Use this function in your callback (see @cb_function) to
extract data from the result object.
Expand Down
2 changes: 1 addition & 1 deletion staslib/iputil.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def mac2iface(mac: str): # pylint: disable=too-many-locals

# ******************************************************************************
def ip_equal(ip1, ip2):
'''Check whther two IP addresses are equal.
'''Check whether two IP addresses are equal.
@param ip1: IPv4Address or IPv6Address object
@param ip2: IPv4Address or IPv6Address object
'''
Expand Down
2 changes: 1 addition & 1 deletion staslib/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ def _config_ctrls_finish(self, configured_ctrl_list: list):
'''@brief Finish discovery controllers configuration after
hostnames (if any) have been resolved. All the logic associated
with discovery controller creation/deletion is found here. To
avoid calling this algorith repetitively for each and every events,
avoid calling this algorithm repetitively for each and every events,
it is called after a soaking period controlled by self._cfg_soak_tmr.
@param configured_ctrl_list: List of TIDs configured in stafd.conf with
Expand Down
6 changes: 3 additions & 3 deletions staslib/stas.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
# Pre Python 3.9 backport of importlib.resources (if installed)
from importlib_resources import files
except ImportError:
# Less efficient, but avalable on older versions of Python
# Less efficient, but available on older versions of Python
import pkg_resources

def load_idl(idl_fname):
Expand Down Expand Up @@ -248,7 +248,7 @@ def _on_try_to_connect(self):
self._try_to_connect_deferred.schedule()
return GLib.SOURCE_REMOVE

def _should_try_to_reconnect(self): # pylint: disable=no-self-use
def _should_try_to_reconnect(self):
return True

def _try_to_connect(self):
Expand Down Expand Up @@ -537,7 +537,7 @@ def _config_ctrls(self):
# controllers with traddr specified as hostname instead of IP address.
# Because of this, we need to remove those excluded elements before
# running name resolution. And we will need to remove excluded
# elements after name resolution is complete (i.e. in the calback
# elements after name resolution is complete (i.e. in the callback
# function _config_ctrls_finish)
logging.debug('ServiceABC._config_ctrls()')
configured_controllers = [
Expand Down
6 changes: 6 additions & 0 deletions test/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ if libnvme_location == '?'
else
#---------------------------------------------------------------------------
# pylint and pyflakes

# There's a bug with pylint 3.X. Tests should be run with pylint
# 2.17.7 (or less), which can be installed with:
# python3 -m pip install --upgrade pylint==2.17.7


if modules_to_lint.length() != 0
pylint = find_program('pylint', required: false)
pyflakes = find_program('pyflakes3', required: false)
Expand Down
Loading

0 comments on commit 71f8011

Please sign in to comment.