From bfff689926cc1fc47d5d89eb1624a2994d7ec365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Samohel?= Date: Mon, 23 Nov 2020 13:39:17 +0100 Subject: [PATCH] hound fixes --- igniter/bootstrap_repos.py | 5 +++-- pype.py | 3 +-- pype/cli.py | 1 + pype/lib/__init__.py | 2 -- pype/lib/avalon_context.py | 5 ++++- pype/lib/log.py | 8 +++++--- pype/modules/ftrack/__init__.py | 1 + pype/tools/tray/pype_tray.py | 6 ++++-- 8 files changed, 19 insertions(+), 12 deletions(-) diff --git a/igniter/bootstrap_repos.py b/igniter/bootstrap_repos.py index d778e096ef..999a6daa19 100644 --- a/igniter/bootstrap_repos.py +++ b/igniter/bootstrap_repos.py @@ -127,7 +127,8 @@ class PypeVersion: if self.major <= other.major and self.minor < other.minor: return True - if self.major <= other.major and self.minor <= other.minor and self.subversion < other.subversion: + if self.major <= other.major and self.minor <= other.minor and \ + self.subversion < other.subversion: return True if self.major == other.major and self.minor == other.minor and \ @@ -177,7 +178,7 @@ class BootstrapRepos: self.live_repo_dir = Path(Path(__file__).parent / ".." / "repos") @staticmethod - def get_version_path_from_list(version:str, version_list:list) -> Path: + def get_version_path_from_list(version: str, version_list: list) -> Path: """Get path for specific version in list of Pype versions. Args: diff --git a/pype.py b/pype.py index df5831e26a..71cd48d15f 100644 --- a/pype.py +++ b/pype.py @@ -43,7 +43,6 @@ import os import re import sys import traceback -from pathlib import Path from igniter.tools import load_environments @@ -165,7 +164,7 @@ def boot(): # HARDCODED: os.environ["AVALON_DB"] = "Avalon" os.environ["AVALON_LABEL"] = "Pype" - os.environ["AVALON_TIMEOUT"]= "1000" + os.environ["AVALON_TIMEOUT"] = "1000" # .-=-----------------------=-=. v .=-=--------------------------=-. # delete Pype module from cache so it is used from specific version diff --git a/pype/cli.py b/pype/cli.py index 72f15c31f4..9d66ff988a 100644 --- a/pype/cli.py +++ b/pype/cli.py @@ -22,6 +22,7 @@ def main(ctx): def settings(dev=False): PypeCommands().launch_settings_gui(dev) + @main.command() @click.option("-d", "--debug", is_flag=True, help=("Run pype tray in debug mode")) diff --git a/pype/lib/__init__.py b/pype/lib/__init__.py index e9b091196b..d5e23721dc 100644 --- a/pype/lib/__init__.py +++ b/pype/lib/__init__.py @@ -50,8 +50,6 @@ from .deprecated import ( set_io_database ) - - from .user_settings import IniSettingRegistry from .user_settings import JSONSettingRegistry from .user_settings import PypeSettingsRegistry diff --git a/pype/lib/avalon_context.py b/pype/lib/avalon_context.py index d4369a5a1f..48f388785e 100644 --- a/pype/lib/avalon_context.py +++ b/pype/lib/avalon_context.py @@ -14,10 +14,11 @@ log = logging.getLogger("AvalonContext") def with_avalon(func): @functools.wraps(func) def wrap_avalon(*args, **kwargs): - from avalon import api, io, pipeline + from avalon import api, io, pipeline # noqa: F401 return func(*args, **kwargs) pass + @with_avalon def is_latest(representation): """Return whether the representation is from latest version @@ -45,6 +46,7 @@ def is_latest(representation): else: return False + @with_avalon def any_outdated(): """Return whether the current scene has any outdated content""" @@ -73,6 +75,7 @@ def any_outdated(): checked.add(representation) return False + @with_avalon def get_asset(asset_name=None): """ Returning asset document from database by its name. diff --git a/pype/lib/log.py b/pype/lib/log.py index 4bc512adc4..f64d677ea8 100644 --- a/pype/lib/log.py +++ b/pype/lib/log.py @@ -382,11 +382,13 @@ class PypeLogger: def timeit(method): - """ Decorator to print how much time function took. - For debugging. - Depends on presence of 'log' object + """Print time in function. + + For debugging. + """ log = logging.getLogger() + def timed(*args, **kw): ts = time.time() result = method(*args, **kw) diff --git a/pype/modules/ftrack/__init__.py b/pype/modules/ftrack/__init__.py index 06cc5d5565..c223b6bbc8 100644 --- a/pype/modules/ftrack/__init__.py +++ b/pype/modules/ftrack/__init__.py @@ -6,6 +6,7 @@ from .lib import BaseHandler, BaseEvent, BaseAction, ServerAction from pype.api import system_settings +# TODO: set in ftrack module os.environ["FTRACK_SERVER"] = ( system_settings()["global"]["modules"]["Ftrack"]["ftrack_server"] ) diff --git a/pype/tools/tray/pype_tray.py b/pype/tools/tray/pype_tray.py index 58c2430535..ea22b4c9c6 100644 --- a/pype/tools/tray/pype_tray.py +++ b/pype/tools/tray/pype_tray.py @@ -1,8 +1,6 @@ import os import sys -s = dict(os.environ) - import platform from avalon import style from Qt import QtCore, QtGui, QtWidgets, QtSvg @@ -381,6 +379,7 @@ class SystemTrayIcon(QtWidgets.QSystemTrayIcon): :param parent: Main widget that cares about all GUIs :type parent: QtWidgets.QMainWindow """ + def __init__(self, parent): self.icon = QtGui.QIcon(resources.pype_icon_filepath()) @@ -436,6 +435,7 @@ class TrayMainWindow(QtWidgets.QMainWindow): - ``hide_working()`` .. todo:: Hide working widget if idle is too long """ + def __init__(self, app): super().__init__() self.app = app @@ -488,6 +488,7 @@ class DragAndDropHelper: :param widget: Qt Widget where drag and drop ability will be added """ + def __init__(self, widget): self.widget = widget self.widget.mousePressEvent = self.mousePressEvent @@ -523,6 +524,7 @@ class DragAndDropHelper: class PypeTrayApplication(QtWidgets.QApplication): """Qt application manages application's control flow.""" + def __init__(self): super(self.__class__, self).__init__(sys.argv) # Allows to close widgets without exiting app