Fix some typos in docstrings

This commit is contained in:
alessandro90
2019-05-30 21:49:43 +02:00
parent 9369b3218f
commit 3dea2a0e56
8 changed files with 37 additions and 37 deletions

View File

@@ -761,13 +761,13 @@ class Artemis(QMainWindow, Ui_MainWindow):
@pyqtSlot(QListWidgetItem)
def remove_if_unselected_modulation(self, item):
"""If an item is unselected from the modulations list, remove the item."""
"""If an item is unselected from the modulations list, hide the item."""
if not item.isSelected():
self.show_matching_modulations(self.search_bar_modulation.text())
@pyqtSlot(QListWidgetItem)
def remove_if_unselected_location(self, item):
"""If an item is unselected from the locations list, remove the item."""
"""If an item is unselected from the locations list, hide the item."""
if not item.isSelected():
self.show_matching_locations(self.search_bar_location.text())
@@ -786,7 +786,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
self.show_matching_strings(self.locations_list, text)
def show_matching_strings(self, list_elements, text):
"""Show all elements of QListWidget the matches (even partially) a target text.
"""Show all elements of QListWidget that matches (even partially) a target text.
Arguments:
list_elements -- the QListWidget
@@ -926,7 +926,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
"""Check if the database is at its latest version.
If a new database version is available, ask if it should be downloaded.
If not display a message.
If a new database version is not available display a message.
If already downloading do nothing.
Handle possible connection errors.
"""
@@ -972,7 +972,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
"""Load the database from file.
Populate the signals list and set the total number of signals.
Handle possible missing file.
Handle possible missing file error.
"""
names = Database.NAMES
try:
@@ -1014,9 +1014,8 @@ class Artemis(QMainWindow, Ui_MainWindow):
"""Collect all the entrys of a QListWidget.
Handle multiple entries in one item seprated by a separator.
Keyword argument:
seprator -- the separator character for multiple-entries items.
separator -- the separator character for multiple-entries items.
"""
values = self.db[list_property]
values = list(
@@ -1176,7 +1175,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
@pyqtSlot()
def reset_fb_filters(self, ftype):
"""Reset the Frequency or Bandwidth depending og 'ftype'.
"""Reset the Frequency or Bandwidth depending on 'ftype'.
ftype can be either Ftype.FREQ or Ftype.BAND.
"""
@@ -1273,7 +1272,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
self.acf_confidence.setValue(0)
def frequency_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the frequency filters."""
"""Evalaute if the signal matches the frequency filters."""
if not self.apply_remove_freq_filter_btn.isChecked():
return True
undef_freq = is_undef_freq(self.db.loc[signal_name])
@@ -1313,7 +1312,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return lower_limit_ok and upper_limit_ok
def band_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the band filters."""
"""Evalaute if the signal matches the band filters."""
if not self.apply_remove_band_filter_btn.isChecked():
return True
undef_band = is_undef_band(self.db.loc[signal_name])
@@ -1343,7 +1342,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return lower_limit_ok and upper_limit_ok
def category_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the category filters."""
"""Evalaute if the signal matches the category filters."""
if not self.apply_remove_cat_filter_btn.isChecked():
return True
cat_code = self.db.at[signal_name, Signal.CATEGORY_CODE]
@@ -1360,7 +1359,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return cat_checked == positive_cases and cat_checked > 0
def mode_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the mode filters."""
"""Evalaute if the signal matches the mode filters."""
if not self.apply_remove_mode_filter_btn.isChecked():
return True
signal_mode = self.db.at[signal_name, Signal.MODE]
@@ -1384,7 +1383,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return any(ok)
def modulation_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the modulation filters."""
"""Evalaute if the signal matches the modulation filters."""
if not self.apply_remove_modulation_filter_btn.isChecked():
return True
signal_modulation = [
@@ -1396,7 +1395,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return False
def location_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the location filters."""
"""Evalaute if the signal matches the location filters."""
if not self.apply_remove_location_filter_btn.isChecked():
return True
signal_location = self.db.at[signal_name, Signal.LOCATION]
@@ -1406,7 +1405,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
return False
def acf_filters_ok(self, signal_name):
"""Evalaute if the a signal matches the acf filters."""
"""Evalaute if the signal matches the acf filters."""
if not self.apply_remove_acf_filter_btn.isChecked():
return True
signal_acf = self.db.at[signal_name, Signal.ACF]
@@ -1429,8 +1428,8 @@ class Artemis(QMainWindow, Ui_MainWindow):
def display_specs(self, item, previous_item):
"""Display the signal properties.
item is the item corresponding to the selected signal
previous_item is unused.
'item' is the item corresponding to the selected signal
'previous_item' is unused.
"""
self.display_spectrogram()
if item is not None:
@@ -1569,7 +1568,7 @@ class Artemis(QMainWindow, Ui_MainWindow):
def go_to_web_page_signal(self):
"""Go the web page of the signal's wiki.
Do nothing is no signal is selected.
Do nothing if no signal is selected.
"""
if self.current_signal_name:
self.url_button.setStyleSheet(

View File

@@ -77,7 +77,7 @@ class AudioPlayer(QObject):
@pyqtSlot()
def __update_bar(self):
"""Upadte the progress bar."""
"""Update the progress bar."""
pos = mixer.music.get_pos()
if pos == -1:
self.__timer.stop()

View File

@@ -6,7 +6,7 @@ import os.path
class Ftype:
"""Container class to differentiate between frequency and band.
used in reset_fb_filters.
Used in reset_fb_filters.
"""
FREQ = "freq"
@@ -91,6 +91,7 @@ class Database:
class ForecastColors:
"""Container class for the forecast labels colors."""
WARNING_COLOR = "#F95423"
KP9_COLOR = "#FFCCCB"
KP8_COLOR = "#FFCC9A"
@@ -100,7 +101,7 @@ class ForecastColors:
class Constants:
"""Container class for several contants of the software."""
"""Container class for several constants of the software."""
CLICK_TO_UPDATE_STR = "Click to update"
SIGIDWIKI = "https://www.sigidwiki.com/wiki/Signal_Identification_Guide"

View File

@@ -3,7 +3,7 @@ from PyQt5.QtCore import QSize
class FixedAspectRatioWidget(QWidget):
"""Subclass QWidget. Keep all the internal labels to a fixed aaspect ratio."""
"""Subclass QWidget. Keep all the internal labels to a fixed aspect ratio."""
space = 10
def __init__(self, parent=None):

View File

@@ -6,17 +6,17 @@ class _BaseSwitchableLabel(QLabel):
"""Subclass QLabel. Base class for the switchable labels."""
def __init__(self, parent=None):
"""Set is_on = False and level = 0."""
"""Set is_on to False and level to 0."""
super().__init__(parent)
self.is_on = False
self.level = 0
def switch_on(self):
"""Set is_on = True."""
"""Set is_on to True."""
self.is_on = True
def switch_off(self):
"""Set is_on = False."""
"""Set is_on to False."""
self.is_on = False
@@ -130,7 +130,7 @@ class SwitchableLabelsIterable:
yield lab
def switch_on(self, label):
"""Switch on the label 'label. Switch off all the other labels."""
"""Switch on the label 'label'. Switch off all the other labels."""
for lab in self.labels:
if lab is label:
lab.switch_on()
@@ -150,7 +150,7 @@ class SwitchableLabelsIterable:
def refresh(self):
"""Refresh the state of all the labels.
Used after theme has changed."""
Used after the applied theme has changed."""
for lab in self.labels:
if lab.is_on:
lab.switch_on()

View File

@@ -11,7 +11,7 @@ from utilities import pop_up
class ThemeConstants:
"""Container class for all the relevant theme-related constants."""
"""Container class for all the theme-related constants."""
FOLDER = "themes"
EXTENSION = ".qss"
@@ -106,7 +106,7 @@ class _ColorsHandler:
class ThemeManager:
"""Manage all the operations releted the the themes."""
"""Manage all the operations releted to the themes."""
def __init__(self, parent):
"""Initialize the ThemeManager instance."""
@@ -231,9 +231,9 @@ class ThemeManager:
def __change(self):
"""Change the current theme.
Apply the stylesheet and set active and inactive colors.
Set all the new images needed.
Save the new current theme on file."""
Apply the stylesheet and set active and inactive colors.
Set all the new images needed.
Save the new current theme on file."""
theme_name = os.path.basename(self.__theme_path) + ThemeConstants.EXTENSION
try:
with open(os.path.join(self.__theme_path, theme_name), "r") as stylesheet:

View File

@@ -27,7 +27,7 @@ class BaseDownloadThread(QThread):
"""Subclass QThread. Base class for the download threads."""
def __init__(self, parent=None):
"""Set the status as 'UNDEFINED'."""
"""Set the status to 'UNDEFINED'."""
super().__init__(parent)
self.status = ThreadStatus.UNDEFINED
@@ -63,7 +63,7 @@ class DownloadThread(BaseDownloadThread):
)
def run(self):
"""QThread.run. Download the database, images and audio samples.
"""Override QThread.run. Download the database, images and audio samples.
Handle all possible exceptions. Also extract the files
in the local folder."""

View File

@@ -95,7 +95,7 @@ def is_undef_band(current_signal):
return lower_band == Constants.UNKNOWN or upper_band == Constants.UNKNOWN
def _change_unit(str_num):
"""Return a scale factor givent the number of digits of a numeric string."""
"""Return a scale factor given the number of digits of a numeric string."""
digits = len(str_num)
if digits < 4:
return 1
@@ -129,9 +129,9 @@ def format_numbers(lower, upper):
return f"{lower:,} {units[lower_factor]}"
def safe_cast(value, cast_type, default=-1):
"""Calls 'cast_type(value)' and returns the result.
"""Call 'cast_type(value)' and return the result.
If the operation fails returns 'default'.
If the operation fails return 'default'.
Should be used to perform 'safe casts'.
Keyword argument:
default -- default value returned if the cast fails.