Skip to content
Permalink
Browse files

pylint related improvements.

pyfilter operations now use snake_case method names
  • Loading branch information...
captainhammy committed Sep 4, 2019
1 parent d8736df commit 461604e83f809df60010f462814a3d5a9b2951b5
Showing with 108 additions and 115 deletions.
  1. +4 −1 houdini/MainMenuCommon.xml
  2. +2 −4 houdini/OPmenu.xml
  3. +5 −10 houdini/PARMmenu.xml
  4. +3 −4 houdini/otls/Sop-cppwrangle.1.otl/com.houdinitoolbox_8_8Sop_1cppwrangle_8_81/PythonModule
  5. +16 −14 houdini/pyfilter/ht-pyfilter.py
  6. +1 −1 houdini/python2.7libs/nodegraphhooks.py
  7. +1 −2 houdini/python2.7libs/pythonrc.py
  8. +0 −1 houdini/scripts/beforescenesave.py
  9. +1 −2 houdini/scripts/externaldragdrop.py
  10. +1 −1 houdini/soho/IFDuserhooks.py
  11. +4 −2 houdini/toolbar/tool_copy_items.shelf
  12. +11 −10 houdini/toolbar/tool_generate_help_card.shelf
  13. +4 −2 houdini/toolbar/tool_paste_items.shelf
  14. +3 −2 python/ht/events/stats.py
  15. +2 −2 python/ht/inline/api.py
  16. +0 −2 python/ht/inline/lib.py
  17. +1 −1 python/ht/inline/utils.py
  18. +1 −1 python/ht/logging/shellio.py
  19. +7 −7 python/ht/machinery/sidefx_web_api.py
  20. +0 −1 python/ht/nodes/styles/__init__.py
  21. +2 −2 python/ht/pyfilter/manager.py
  22. +2 −2 python/ht/pyfilter/operations/deepimage.py
  23. +7 −7 python/ht/pyfilter/operations/ipoverrides.py
  24. +1 −1 python/ht/pyfilter/operations/logoutput.py
  25. +1 −1 python/ht/pyfilter/operations/primaryimage.py
  26. +5 −5 python/ht/pyfilter/operations/setproperties.py
  27. +1 −1 python/ht/pyfilter/operations/settilecallback.py
  28. +2 −2 python/ht/pyfilter/operations/zdepth.py
  29. +2 −3 python/ht/sohohooks/aovs/__init__.py
  30. +1 −1 python/ht/sohohooks/aovs/manager.py
  31. +2 −2 python/ht/sohohooks/manager.py
  32. +1 −1 python/ht/ui/aovs/dialogs.py
  33. +0 −1 python/ht/ui/aovs/uidata.py
  34. +4 −2 python/ht/ui/aovs/utils.py
  35. +1 −1 python/ht/ui/aovs/widgets.py
  36. +0 −1 python/ht/ui/menus/opmenu.py
  37. +1 −1 python/ht/ui/menus/parmmenu.py
  38. +0 −1 python/ht/ui/paste/dialogs.py
  39. +0 −1 python/ht/ui/paste/helpers.py
  40. +4 −4 python/ht/ui/paste/models.py
  41. +3 −4 python/ht/ui/paste/sources.py
  42. +1 −1 python/ht/ui/paste/widgets.py
@@ -7,7 +7,10 @@

<scriptItem id="ht.menurefresh">
<label>Reload Menus</label>
<scriptCode><![CDATA[hou.hscript("menurefresh")]]></scriptCode>
<scriptCode><![CDATA[import hou
hou.hscript("menurefresh")
]]></scriptCode>
</scriptItem>
</subMenu>
</menuBar>
@@ -8,8 +8,7 @@
<insertAfter>opmenu.refcopy</insertAfter>
<scriptCode><![CDATA[import ht.ui.menus.opmenu
ht.ui.menus.opmenu.create_absolute_reference_copy(kwargs)
ht.ui.menus.opmenu.create_absolute_reference_copy(kwargs) # pylint: disable=undefined-variable
]]></scriptCode>
</scriptItem>
</subMenu>
@@ -19,8 +18,7 @@ ht.ui.menus.opmenu.create_absolute_reference_copy(kwargs)
<label>To File...</label>
<scriptCode><![CDATA[import ht.ui.menus.opmenu
ht.ui.menus.opmenu.save_item_to_file(kwargs)
ht.ui.menus.opmenu.save_item_to_file(kwargs) # pylint: disable=undefined-variable
]]></scriptCode>
</scriptItem>
</subMenu>
@@ -7,8 +7,7 @@
<insertAfter>export_parm_type_props</insertAfter>
<scriptCode><![CDATA[import ht.ui.menus.parmmenu
ht.ui.menus.parmmenu.promote_parameter_to_node(kwargs)
ht.ui.menus.parmmenu.promote_parameter_to_node(kwargs) # pylint: disable=undefined-variable
]]></scriptCode>
</scriptItem>

@@ -18,14 +17,12 @@ ht.ui.menus.parmmenu.promote_parameter_to_node(kwargs)
<context>
<expression><![CDATA[import ht.ui.menus.parmmenu
return ht.ui.menus.parmmenu.convert_relative_to_absolute_path_context(kwargs)
return ht.ui.menus.parmmenu.convert_relative_to_absolute_path_context(kwargs) # pylint: disable=undefined-variable
]]></expression>
</context>
<scriptCode><![CDATA[import ht.ui.menus.parmmenu
ht.ui.menus.parmmenu.convert_relative_to_absolute_path(kwargs)
ht.ui.menus.parmmenu.convert_relative_to_absolute_path(kwargs) # pylint: disable=undefined-variable
]]></scriptCode>
</scriptItem>

@@ -35,14 +32,12 @@ ht.ui.menus.parmmenu.convert_relative_to_absolute_path(kwargs)
<context>
<expression><![CDATA[import ht.ui.menus.parmmenu
return ht.ui.menus.parmmenu.convert_absolute_to_relative_path_context(kwargs)
return ht.ui.menus.parmmenu.convert_absolute_to_relative_path_context(kwargs) # pylint: disable=undefined-variable
]]></expression>
</context>
<scriptCode><![CDATA[import ht.ui.menus.parmmenu
ht.ui.menus.parmmenu.convert_absolute_to_relative_path(kwargs)
ht.ui.menus.parmmenu.convert_absolute_to_relative_path(kwargs) # pylint: disable=undefined-variable
]]></scriptCode>
</scriptItem>
</menu>
@@ -256,7 +256,7 @@ def build_library(node):
if not function_sources:
raise NoFunctionSourcesError()

config = inlinecpp._create_cppinline_config()
config = inlinecpp._create_cppinline_config() # pylint: disable=protected-access

compile_target = _get_compile_target_folder(node)

@@ -298,12 +298,11 @@ def view_c_file(node):
"""
lib = build_library(node)

cpp_file_name = lib._cpp_file_name()
shared_object_path = lib._shared_object_path()
cpp_file_name = lib._cpp_file_name() # pylint: disable=protected-access
shared_object_path = lib._shared_object_path() # pylint: disable=protected-access

cpp_file_path = os.path.join(os.path.dirname(shared_object_path), cpp_file_name)

if os.path.exists(cpp_file_path):
args = os.environ.get("EDITOR", "gvim").split() + [cpp_file_path]
subprocess.Popen(args)

@@ -5,6 +5,7 @@
http://www.sidefx.com/docs/houdini/rendering/python
"""
# pylint: disable=invalid-name,wrong-import-position

# =============================================================================
# IMPORTS
@@ -16,6 +17,7 @@
# Houdini Toolbox Imports
import ht.logging

# Initialize logging config.
ht.logging.init_config()

from ht.pyfilter.manager import PyFilterManager
@@ -50,7 +52,7 @@ def filterCamera():
"""
_logger.debug("filterCamera")

_PYFILTER_MANAGER.run_operations_for_stage("filterCamera")
_PYFILTER_MANAGER.run_operations_for_stage("filter_camera")


def filterCameraSegment():
@@ -62,14 +64,14 @@ def filterCameraSegment():
"""
_logger.debug("filterCameraSegment")

_PYFILTER_MANAGER.run_operations_for_stage("filterCameraSegment")
_PYFILTER_MANAGER.run_operations_for_stage("filter_camera_segment")


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

_PYFILTER_MANAGER.run_operations_for_stage("filterEndRender")
_PYFILTER_MANAGER.run_operations_for_stage("filter_end_render")


def filterError(level, message, prefix):
@@ -78,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("filter_error", level, message, prefix)

return result

@@ -92,7 +94,7 @@ def filterFog():
"""
_logger.debug("filterFog (%s)", get_property("object:name"))

_PYFILTER_MANAGER.run_operations_for_stage("filterFog")
_PYFILTER_MANAGER.run_operations_for_stage("filter_fog")


def filterGeometry():
@@ -105,7 +107,7 @@ def filterGeometry():
"""
_logger.debug("filterGeometry")

_PYFILTER_MANAGER.run_operations_for_stage("filterGeometry")
_PYFILTER_MANAGER.run_operations_for_stage("filter_geometry")


def filterInstance():
@@ -117,7 +119,7 @@ def filterInstance():
"""
_logger.debug("filterInstance (%s)", get_property("object:name"))
_PYFILTER_MANAGER.run_operations_for_stage("filterInstance")
_PYFILTER_MANAGER.run_operations_for_stage("filter_instance")


def filterLight():
@@ -130,7 +132,7 @@ def filterLight():
"""
_logger.debug("filterLight (%s)", get_property("object:name"))

_PYFILTER_MANAGER.run_operations_for_stage("filterLight")
_PYFILTER_MANAGER.run_operations_for_stage("filter_light")


def filterMaterial():
@@ -143,7 +145,7 @@ def filterMaterial():
"""
_logger.debug("filterMaterial")

_PYFILTER_MANAGER.run_operations_for_stage("filterMaterial")
_PYFILTER_MANAGER.run_operations_for_stage("filter_material")


def filterOutputAssets(assets): # pylint: disable=unused-argument
@@ -155,7 +157,7 @@ def filterOutputAssets(assets): # pylint: disable=unused-argument
"""
_logger.debug("filterOutputAssets")

_PYFILTER_MANAGER.run_operations_for_stage("filterOutputAssets")
_PYFILTER_MANAGER.run_operations_for_stage("filter_output_assets")


def filterPlane():
@@ -168,14 +170,14 @@ def filterPlane():
else:
_logger.debug("filterPlane (%s -> %s)", variable, channel)

_PYFILTER_MANAGER.run_operations_for_stage("filterPlane")
_PYFILTER_MANAGER.run_operations_for_stage("filter_plane")


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

_PYFILTER_MANAGER.run_operations_for_stage("filterQuit")
_PYFILTER_MANAGER.run_operations_for_stage("filter_quit")


def filterRender():
@@ -188,12 +190,12 @@ def filterRender():
"""
_logger.debug("filterRender")

_PYFILTER_MANAGER.run_operations_for_stage("filterRender")
_PYFILTER_MANAGER.run_operations_for_stage("filter_render")


def main():
"""Build the manager."""
global _PYFILTER_MANAGER
global _PYFILTER_MANAGER # pylint: disable=global-statement

_PYFILTER_MANAGER = PyFilterManager()

@@ -23,7 +23,7 @@
# FUNCTIONS
# ==============================================================================

def createEventHandler(uievent, pending_actions): # pylint: disable=unused-argument
def createEventHandler(uievent, pending_actions): # pylint: disable=invalid-name,unused-argument
"""Create an event handler for Houdini's network editor.
:param uievent: The occurring event.
@@ -1,4 +1,5 @@
"""Run code on Houdini startup."""
# pylint: disable=wrong-import-position

# =============================================================================
# IMPORTS
@@ -14,12 +15,10 @@
import ht.logging
ht.logging.init_config()


import ht.events
import ht.events.callbacks
import ht.sohohooks.aovs
import ht.nodes.styles

# Create any dynamic event handlers, such as using Python's atexit module
ht.events.callbacks.register_callbacks()

@@ -11,4 +11,3 @@
# =============================================================================

run_event(SceneEvents.PreSave, kwargs) # pylint: disable=undefined-variable

@@ -15,7 +15,7 @@
# FUNCTIONS
# =============================================================================

def dropAccept(file_paths):
def dropAccept(file_paths): # pylint: disable=invalid-name
"""Accept a list of files.
This function is called by Houdini when files are dropped onto the UI.
@@ -36,4 +36,3 @@ def dropAccept(file_paths):

# Return whether or not the drop was accepted by the handler.
return scriptargs.get("drop_accepted", False)

@@ -12,7 +12,7 @@
# FUNCTIONS
# =============================================================================

def call(hook_name="", *args, **kwargs):
def call(hook_name="", *args, **kwargs): # pylint: disable=keyword-arg-before-vararg
"""Hook callback function.
:param hook_name: The name of the hook to call.
@@ -5,9 +5,11 @@
Note, that two definitions of the same element are not allowed in
a single file. -->
<tool name="copy_items" label="Copy Items to File" icon="BUTTONS_copy">
<script scriptType="python"><![CDATA[from ht.ui.paste import copy_items
<script scriptType="python"><![CDATA["""Copy selected items to a file."""
copy_items(kwargs)
from ht.ui.paste import copy_items
copy_items(kwargs) # pylint: disable=undefined-variable
]]></script>
<toolMenuContext name="network">
<contextNetType>OBJ</contextNetType>
@@ -6,7 +6,8 @@
a single file. -->

<tool name="generate_help_card" label="Generate Help Card" icon="PANETYPES_help_browser">
<script scriptType="python"><![CDATA[
<script scriptType="python"><![CDATA["""Generate a help card."""
# =============================================================================
# IMPORTS
# =============================================================================
@@ -26,19 +27,19 @@ options = (
"Inputs block",
"Related nodes list",
"Create a 'Using xxx' block",
)
)
node_path = hou.ui.selectNode()
target_node = hou.node(node_path)
if target_node is not None:
choices = hou.ui.selectFromList(
options,
message="Choose help card options",
num_visible_rows=len(options),
clear_on_cancel=True
)
inputs = 0 in choices
related = 1 in choices
using = 2 in choices
@@ -49,29 +50,29 @@ if target_node is not None:
if type_definition is not None:
open_type_properties = False
help_section = type_definition.sections().get("Help")
if help_section is not None:
overwrite = hou.ui.displayMessage(
"Help card exists. Overwrite?",
("Yes", "No"),
severity=hou.severityType.Warning
)
if overwrite == 0:
help_section.setContents(help_text)
open_type_properties = True
else:
six.print_(help_text)
else:
help_section = type_definition.addSection("Help")
help_section.setContents(help_text)
open_type_properties = True
if open_type_properties:
hou.ui.openTypePropertiesDialog(target_node)
else:
@@ -5,9 +5,11 @@
Note, that two definitions of the same element are not allowed in
a single file. -->
<tool name="paste_items" label="Paste Items from File" icon="BUTTONS_paste">
<script scriptType="python"><![CDATA[from ht.ui.paste import paste_items
<script scriptType="python"><![CDATA["""Paste items from a file."""
paste_items(kwargs)
from ht.ui.paste import paste_items
paste_items(kwargs) # pylint: disable=undefined-variable
]]></script>
<toolMenuContext name="network">
<contextNetType>OBJ</contextNetType>

0 comments on commit 461604e

Please sign in to comment.
You can’t perform that action at this time.