Skip to content

Commit

Permalink
pylint
Browse files Browse the repository at this point in the history
  • Loading branch information
irgolic committed Aug 5, 2021
1 parent 4b7c66e commit 38e9d7c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
32 changes: 16 additions & 16 deletions Orange/widgets/data/owcsvimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
import lzma
import bz2
import zipfile

from Orange.widgets.settings import PerfectDomainContextHandler
from Orange.widgets.utils.itemdelegates import TableDataDelegate
from itertools import chain

from xml.sax.saxutils import escape
Expand All @@ -39,10 +36,10 @@
Qt, QFileInfo, QTimer, QSettings, QObject, QSize, QMimeDatabase, QMimeType
)
from AnyQt.QtGui import (
QStandardItem, QStandardItemModel, QPalette, QColor, QIcon, QTextOption
QStandardItem, QStandardItemModel, QPalette, QColor, QIcon,
)
from AnyQt.QtWidgets import (
QLabel, QComboBox, QPushButton, QDialog, QDialogButtonBox, QGridLayout,
QLabel, QComboBox, QPushButton, QDialog, QDialogButtonBox,
QVBoxLayout, QSizePolicy, QFileIconProvider, QFileDialog,
QApplication, QMessageBox, QTextBrowser,
QStyle, QMenu, QHBoxLayout, QTableView, QHeaderView
Expand All @@ -55,12 +52,18 @@

from pandas.api import types as pdtypes

from orangewidget.settings import Setting, SettingProvider, widget_settings_dir

import Orange.data
from Orange.data import Table, ContinuousVariable, StringVariable
from Orange.misc.collections import natural_sorted

from Orange.widgets import widget, gui, settings
from Orange.widgets import widget, gui
from Orange.widgets.data.owtable import DataTableView, RichTableModel, is_sortable, TableSliceProxy
from Orange.widgets.settings import PerfectDomainContextHandler
from Orange.widgets.utils.settings import (
QSettings_readArray, QSettings_writeArray
)
from Orange.widgets.utils.concurrent import PyOwned
from Orange.widgets.utils import (
textimport, concurrent as qconcurrent, unique_everseen, enum_get, qname
Expand All @@ -71,10 +74,7 @@
PathItem, VarPath, AbsPath, samepath, prettyfypath, isprefixed,
)
from Orange.widgets.utils.overlay import OverlayWidget
from Orange.widgets.utils.settings import (
QSettings_readArray, QSettings_writeArray
)
from orangewidget.settings import Setting, ContextSetting, SettingProvider
from Orange.widgets.utils.itemdelegates import TableDataDelegate

if typing.TYPE_CHECKING:
# pylint: disable=invalid-name
Expand Down Expand Up @@ -658,13 +658,13 @@ class Warning(widget.OWWidget.Warning):
'the Import Options to avoid this.')

#: Paths and options of files accessed in a 'session'
_session_items = settings.Setting(
_session_items = Setting(
[], schema_only=True) # type: List[Tuple[str, dict]]

_session_items_v2 = settings.Setting(
_session_items_v2 = Setting(
[], schema_only=True) # type: List[Tuple[Dict[str, str], dict]]
#: Saved dialog state (last directory and selected filter)
dialog_state = settings.Setting({
dialog_state = Setting({
"directory": "",
"filter": ""
}) # type: Dict[str, str]
Expand All @@ -678,7 +678,7 @@ class Warning(widget.OWWidget.Warning):
# with older saved workflows, where types not guessed differently, when
# compatibility_mode=True widget have older guessing behaviour
settings_version = 3
compatibility_mode = settings.Setting(False, schema_only=True)
compatibility_mode = Setting(False, schema_only=True)

MaxHistorySize = 50

Expand Down Expand Up @@ -968,7 +968,7 @@ def _path_must_be_relative_mb(self, prefix: str) -> QMessageBox:
return mb

@Slot()
def browse(self, prefixname=None, directory=None):
def browse(self):
"""
Open a file dialog and select a user specified file.
"""
Expand Down Expand Up @@ -1089,7 +1089,7 @@ def _local_settings(cls):
# type: () -> QSettings
"""Return a QSettings instance with local persistent settings."""
filename = "{}.ini".format(qname(cls))
fname = os.path.join(settings.widget_settings_dir(), filename)
fname = os.path.join(widget_settings_dir(), filename)
return QSettings(fname, QSettings.IniFormat)

def _add_recent(self, filename, options=None):
Expand Down
6 changes: 2 additions & 4 deletions Orange/widgets/utils/textimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
)

from AnyQt.QtCore import (
Qt, QSize, QPoint, QRect, QRectF, QRegularExpression, QAbstractTableModel,
Qt, QSize, QRect, QRectF, QRegularExpression, QAbstractTableModel,
QModelIndex, QItemSelectionModel, QTextBoundaryFinder, QTimer, QEvent
)
from AnyQt.QtCore import pyqtSignal as Signal, pyqtSlot as Slot
Expand Down Expand Up @@ -1123,7 +1123,6 @@ def __generate_type_columns_menu(self, columns, menu=None):
current = None
cb = self.column_type_edit_cb
g = QActionGroup(menu)
current_action = None
# 'Copy' the column types model into a menu
for i in range(cb.count()):
if cb.itemData(i, Qt.AccessibleDescriptionRole) == "separator":
Expand All @@ -1135,7 +1134,6 @@ def __generate_type_columns_menu(self, columns, menu=None):
ac.setCheckable(True)
if ac.data() == current:
ac.setChecked(True)
current_action = ac
g.addAction(ac)

def update_types(action):
Expand Down Expand Up @@ -1736,7 +1734,7 @@ def format_exception_csv(err):
def parse_datetime(text):
global _to_datetime
if _to_datetime is None:
from pandas import to_datetime as _to_datetime
from pandas import to_datetime as _to_datetime # pylint: disable=redefined-outer-name
return _to_datetime(text)


Expand Down

0 comments on commit 38e9d7c

Please sign in to comment.