Skip to content

Commit

Permalink
Pylint related cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
captainhammy committed Jun 9, 2019
1 parent d7cf239 commit 417f51a
Show file tree
Hide file tree
Showing 57 changed files with 391 additions and 374 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -57,4 +57,4 @@ plugins/build
*.ifd
*/backup/*
houdini/otls/backup

*pylint.*.out
@@ -1,3 +1,5 @@
# pylint: disable=missing-docstring

# Houdini Imports
import hou
import hutil.cppinline
Expand Down
@@ -1,4 +1,4 @@

# pylint: disable=missing-docstring
# Python Imports
import ast
import os
Expand Down
65 changes: 33 additions & 32 deletions houdini/pyfilter/ht-pyfilter.py
Expand Up @@ -23,13 +23,14 @@
# Houdini Imports
import mantra

logger = logging.getLogger("ht-pyfilter")


# =============================================================================
# GLOBALS
# =============================================================================

LOGGER = logging.getLogger("ht-pyfilter")

PYFILTER_MANAGER = None
_PYFILTER_MANAGER = None


# =============================================================================
Expand All @@ -49,9 +50,9 @@ def filterCamera():
don't declare the property explicitly.
"""
LOGGER.debug("filterCamera")
logger.debug("filterCamera")

PYFILTER_MANAGER.run_operations_for_stage("filterCamera")
_PYFILTER_MANAGER.run_operations_for_stage("filterCamera")


def filterCameraSegment():
Expand All @@ -61,16 +62,16 @@ def filterCameraSegment():
camera motion segment.
"""
LOGGER.debug("filterCameraSegment")
logger.debug("filterCameraSegment")

PYFILTER_MANAGER.run_operations_for_stage("filterCameraSegment")
_PYFILTER_MANAGER.run_operations_for_stage("filterCameraSegment")


def filterEndRender():
"""Perform actions just after the image has been rendered."""
LOGGER.debug("filterEndRender")
logger.debug("filterEndRender")

PYFILTER_MANAGER.run_operations_for_stage("filterEndRender")
_PYFILTER_MANAGER.run_operations_for_stage("filterEndRender")


def filterError(level, message, prefix):
Expand All @@ -79,7 +80,7 @@ def filterError(level, message, prefix):
This function allows you to disable the printing of messages.
"""
result = PYFILTER_MANAGER.run_operations_for_stage("filterError", level, message, prefix)
result = _PYFILTER_MANAGER.run_operations_for_stage("filterError", level, message, prefix)

return result

Expand All @@ -91,9 +92,9 @@ def filterFog():
a fog object. The function can query fog: settings and possibly alter them.
"""
LOGGER.debug("filterFog ({})".format(mantra.property("object:name")[0]))
logger.debug("filterFog ({})".format(mantra.property("object:name")[0]))

PYFILTER_MANAGER.run_operations_for_stage("filterFog")
_PYFILTER_MANAGER.run_operations_for_stage("filterFog")


def filterGeometry():
Expand All @@ -104,9 +105,9 @@ def filterGeometry():
alter them.
"""
LOGGER.debug("filterGeometry")
logger.debug("filterGeometry")

PYFILTER_MANAGER.run_operations_for_stage("filterGeometry")
_PYFILTER_MANAGER.run_operations_for_stage("filterGeometry")


def filterInstance():
Expand All @@ -117,8 +118,8 @@ def filterInstance():
alter them.
"""
LOGGER.debug("filterInstance ({})".format(mantra.property("object:name")[0]))
PYFILTER_MANAGER.run_operations_for_stage("filterInstance")
logger.debug("filterInstance ({})".format(mantra.property("object:name")[0]))
_PYFILTER_MANAGER.run_operations_for_stage("filterInstance")


def filterLight():
Expand All @@ -129,9 +130,9 @@ def filterLight():
them.
"""
LOGGER.debug("filterLight ({})".format(mantra.property("object:name")[0]))
logger.debug("filterLight ({})".format(mantra.property("object:name")[0]))

PYFILTER_MANAGER.run_operations_for_stage("filterLight")
_PYFILTER_MANAGER.run_operations_for_stage("filterLight")


def filterMaterial():
Expand All @@ -142,9 +143,9 @@ def filterMaterial():
add or change properties on the material.
"""
LOGGER.debug("filterMaterial")
logger.debug("filterMaterial")

PYFILTER_MANAGER.run_operations_for_stage("filterMaterial")
_PYFILTER_MANAGER.run_operations_for_stage("filterMaterial")


def filterOutputAssets(assets):
Expand All @@ -154,9 +155,9 @@ def filterOutputAssets(assets):
during the render.
"""
LOGGER.debug("filterOutputAssets")
logger.debug("filterOutputAssets")

PYFILTER_MANAGER.run_operations_for_stage("filterOutputAssets")
_PYFILTER_MANAGER.run_operations_for_stage("filterOutputAssets")


def filterPlane():
Expand All @@ -165,18 +166,18 @@ def filterPlane():
channel = mantra.property("plane:channel")[0]

if variable == channel or channel == "":
LOGGER.debug("filterPlane ({})".format(variable))
logger.debug("filterPlane ({})".format(variable))
else:
LOGGER.debug("filterPlane ({} -> {})".format(variable, channel))
logger.debug("filterPlane ({} -> {})".format(variable, channel))

PYFILTER_MANAGER.run_operations_for_stage("filterPlane")
_PYFILTER_MANAGER.run_operations_for_stage("filterPlane")


def filterQuit():
"""Perform actions just before Mantra quits."""
LOGGER.debug("filterQuit")
logger.debug("filterQuit")

PYFILTER_MANAGER.run_operations_for_stage("filterQuit")
_PYFILTER_MANAGER.run_operations_for_stage("filterQuit")


def filterRender():
Expand All @@ -187,19 +188,19 @@ def filterRender():
statistics or validation, it might be useful to have this method available.
"""
LOGGER.debug("filterRender")
logger.debug("filterRender")

PYFILTER_MANAGER.run_operations_for_stage("filterRender")
_PYFILTER_MANAGER.run_operations_for_stage("filterRender")


def main():
"""Build the manager."""
global PYFILTER_MANAGER
global _PYFILTER_MANAGER

_PYFILTER_MANAGER = PyFilterManager()

PYFILTER_MANAGER = PyFilterManager()

# =============================================================================

if __name__ == "__main__":
main()

5 changes: 3 additions & 2 deletions python/ht/events/callbacks.py
Expand Up @@ -14,11 +14,12 @@
# Houdini Imports
import hou


# =============================================================================
# NON-PUBLIC FUNCTIONS
# =============================================================================

def _atexit_callback(*args, **kwargs):
def _atexit_callback(*args, **kwargs): # pylint: disable=unused-argument
"""Run SceneEvents.Exit events.
:return:
Expand All @@ -27,7 +28,7 @@ def _atexit_callback(*args, **kwargs):
run_event(SceneEvents.Exit)


def _emit_ui_available(*args, **kwargs):
def _emit_ui_available(*args, **kwargs): # pylint: disable=unused-argument
"""Run SceneEvents.WhenUIAvailable events.
:return:
Expand Down
1 change: 1 addition & 0 deletions python/ht/events/event.py
Expand Up @@ -8,6 +8,7 @@
from ht.events.item import HoudiniEventItem
from ht.events.stats import HoudiniEventStats


# =============================================================================
# CLASSES
# =============================================================================
Expand Down
30 changes: 13 additions & 17 deletions python/ht/events/events/rop_render.py
Expand Up @@ -19,12 +19,7 @@
# Houdini Imports
import hou


# =============================================================================
# GLOBALS
# =============================================================================

LOGGER = logging.getLogger(__name__)
logger = logging.getLogger(__name__)


# =============================================================================
Expand Down Expand Up @@ -66,7 +61,7 @@ def pre_frame(self, scriptargs):
# frame is completed to get the duration.
self._frame_start = scriptargs["time"]

LOGGER.info("Starting Frame: %s", scriptargs["frame"])
logger.info("Starting Frame: %s", scriptargs["frame"])

def pre_render(self, scriptargs):
"""Action run before the render starts.
Expand All @@ -83,10 +78,10 @@ def pre_render(self, scriptargs):
if frame_range is not None:
start, end, inc = frame_range

LOGGER.info("Starting render: %s-%s:%s", start, end, inc)
logger.info("Starting render: %s-%s:%s", start, end, inc)

else:
LOGGER.info("Starting render")
logger.info("Starting render")

def post_frame(self, scriptargs):
"""Action run after the frame has rendered.
Expand All @@ -104,11 +99,11 @@ def post_frame(self, scriptargs):
duration = end_time - self._frame_start

# Print a complete message that includes our calculated duration.
LOGGER.info("Completed Frame: %s (%0.5fs)", scriptargs["frame"], duration)
logger.info("Completed Frame: %s (%0.5fs)", scriptargs["frame"], duration)

# If we somehow didn't, just print the complete message.
else:
LOGGER.info("Completed Frame: %s", scriptargs["frame"])
logger.info("Completed Frame: %s", scriptargs["frame"])

def post_render(self, scriptargs):
"""Action run after the render is complete.
Expand All @@ -121,12 +116,12 @@ def post_render(self, scriptargs):
if self._render_start is not None:
end_time = scriptargs["time"]

LOGGER.info("Completed Render: %0.5fs", end_time-self._render_start)
logger.info("Completed Render: %0.5fs", end_time-self._render_start)

else:
LOGGER.info("Completed Render")
logger.info("Completed Render")

def post_write(self, scriptargs):
def post_write(self, scriptargs): # pylint: disable=no-self-use
"""Action run after the frame is written to disk.
:param scriptargs: Event data.
Expand All @@ -135,10 +130,10 @@ def post_write(self, scriptargs):
"""
if "path" in scriptargs:
LOGGER.info("Wrote frame %s to %s", scriptargs["frame"], scriptargs["path"])
logger.info("Wrote frame %s to %s", scriptargs["frame"], scriptargs["path"])

else:
LOGGER.info("Wrote frame %s", scriptargs["frame"])
logger.info("Wrote frame %s", scriptargs["frame"])


# =============================================================================
Expand Down Expand Up @@ -191,7 +186,7 @@ def _print_frame_write(scriptargs):
pass

else:
LOGGER.info("Wrote frame %s to %s", scriptargs["frame"], scriptargs["path"])
logger.info("Wrote frame %s to %s", scriptargs["frame"], scriptargs["path"])


# =============================================================================
Expand Down Expand Up @@ -227,3 +222,4 @@ def build_scriptargs(node=None):
scriptargs["path"] = _get_target_file(node)

return scriptargs

3 changes: 2 additions & 1 deletion python/ht/events/events/scene_load.py
Expand Up @@ -12,6 +12,7 @@
# Houdini Imports
import hou


# =============================================================================
# CLASSES
# =============================================================================
Expand All @@ -34,7 +35,7 @@ def __init__(self):
# METHODS
# =========================================================================

def clear_session_settings(self, scriptargs):
def clear_session_settings(self, scriptargs): # pylint: disable=no-self-use,unused-argument
"""Clear out potentially annoying/bad settings."""
# Remove an icon cache directory variable if it exists.
hou.hscript("set -u HOUDINI_ICON_CACHE_DIR")
1 change: 1 addition & 0 deletions python/ht/events/group.py
@@ -1,5 +1,6 @@
"""This module contains the Houdini event group class."""


# =============================================================================
# CLASSES
# =============================================================================
Expand Down
1 change: 1 addition & 0 deletions python/ht/events/item.py
Expand Up @@ -7,6 +7,7 @@
# Houdini Toolbox Imports
from ht.events.stats import HoudiniEventItemStats


# =============================================================================
# IMPORTS
# =============================================================================
Expand Down
3 changes: 3 additions & 0 deletions python/ht/events/manager.py
Expand Up @@ -16,6 +16,7 @@
from ht.events.group import HoudiniEventGroup
from ht.events.item import HoudiniEventItem


# =============================================================================
# CLASSES
# =============================================================================
Expand Down Expand Up @@ -192,6 +193,7 @@ def run_event(self, event_name, scriptargs=None):

event.run(scriptargs)


# =============================================================================
# FUNCTIONS
# =============================================================================
Expand Down Expand Up @@ -262,6 +264,7 @@ def run_event(event_name, scriptargs=None):
"""
MANAGER.run_event(event_name, scriptargs)


# =============================================================================

MANAGER = HoudiniEventManager()

0 comments on commit 417f51a

Please sign in to comment.