Skip to content

Commit

Permalink
Merge pull request #26 from PeterShinners/janitorial
Browse files Browse the repository at this point in the history
  • Loading branch information
pixar-oss committed Aug 30, 2016
2 parents c5024e6 + 9c78ca6 commit 30a04e1
Show file tree
Hide file tree
Showing 25 changed files with 131 additions and 152 deletions.
6 changes: 3 additions & 3 deletions pxr/base/lib/gf/testenv/testGfFrustum.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def test_PlaneIntersection(self):
def test_Position(self):
f1 = Gf.Frustum()
f2 = Gf.Frustum()
f1.position = Gf.Vec3d(1, 0, 0);
f2.position = Gf.Vec3d(0, 1, 0);
f1.position = Gf.Vec3d(1, 0, 0)
f2.position = Gf.Vec3d(0, 1, 0)
self.assertNotEqual(f1, f2)

def test_Properties(self):
Expand Down Expand Up @@ -314,7 +314,7 @@ def test_IntersectionViewVolume(self):
0.0, 4.2418940586972074, 0.0, 0.0,
0.0, 0.0, -1, -1.0,
0.0, 0.0, -20, 0.0)
viewProjMat = viewMat * projMat;
viewProjMat = viewMat * projMat

# a typical box entirely in the view
b = Gf.BBox3d( Gf.Range3d( Gf.Vec3d( 0, 0, 0 ), Gf.Vec3d( 1, 1, 1 ) ) )
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/lib/gf/testenv/testGfMatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def runTest(self):
v = Vec()
for i in range(v.dimension):
v[i] = i
m1 = Matrix().SetDiagonal(v);
m1 = Matrix().SetDiagonal(v)
m2 = Matrix(0)
for i in range(m2.dimension[0]):
m2[i,i] = i
Expand Down
4 changes: 2 additions & 2 deletions pxr/base/lib/gf/testenv/testGfRange.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def runTest(self):

v = makeValue(Value, [1, 2, 3, 4])
r = Range()
r.min = v;
r.min = v
self.assertEqual(r.min, v)
r.max = v;
r.max = v
self.assertEqual(r.max, v)

r = Range()
Expand Down
4 changes: 2 additions & 2 deletions pxr/base/lib/gf/testenv/testGfRay.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def test_IntersectCylinder(self):

# Ray behind cylinder, orthogonal to surface
x = radius * (1 + random.uniform(epsilon, 1))
distance = x - radius;
distance = x - radius
ray = Gf.Ray(Gf.Vec3d(-x, 0, 0), Gf.Vec3d().XAxis())
(hit, enter, exit) = ray.Intersect(origin, axis, radius)

Expand Down Expand Up @@ -434,7 +434,7 @@ def test_IntersectCone(self):
self.assertAlmostEqual(exit, radius, delta=epsilon)

# Ray behind cone, orthogonal to axis
distance = x - radius;
distance = x - radius
ray = Gf.Ray(Gf.Vec3d(-x, 0, 0), Gf.Vec3d().XAxis())
(hit, enter, exit) = ray.Intersect(origin, axis, radius, height)

Expand Down
4 changes: 2 additions & 2 deletions pxr/base/lib/gf/testenv/testGfSize.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ def runTest(self):
if Size.dimension == 2:
self.assertIsInstance(Size(Gf.Vec2i()), Size)
self.assertIsInstance(Size(3, 4), Size)
s = Size();
s = Size()
self.assertEqual(s.Set(3,4), Size(3,4))
elif Size.dimension == 3:
self.assertIsInstance(Size(Gf.Vec3i()), Size)
self.assertIsInstance(Size(3, 4, 5), Size)
s = Size();
s = Size()
self.assertEqual(s.Set(3,4,5), Size(3,4,5))

s = makeValue(Size, (1,2,3))
Expand Down
8 changes: 4 additions & 4 deletions pxr/base/lib/gf/testenv/testGfVec.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,18 @@ def MethodsTest(self, Vec):

# Normalize...
SetVec( v1, [3, 1, 4, 1] )
v2 = Vec(v1);
v2 = Vec(v1)
v2.Normalize()
nv = Gf.GetNormalized( v1 )
nv2 = v1.GetNormalized()
nvcheck = v1 / Gf.GetLength(v1);
nvcheck = v1 / Gf.GetLength(v1)
self.assertTrue(Gf.IsClose(nv, nvcheck, eps))
self.assertTrue(Gf.IsClose(nv2, nvcheck, eps))
self.assertTrue(Gf.IsClose(v2, nvcheck, eps))

SetVec( v1, [3, 1, 4, 1] )
nv = v1.GetNormalized()
nvcheck = v1 / Gf.GetLength(v1);
nvcheck = v1 / Gf.GetLength(v1)
self.assertEqual(nv, nvcheck)

SetVec(v1, [0,0,0,0])
Expand Down Expand Up @@ -357,7 +357,7 @@ def MethodsTest(self, Vec):
for i in range(Vec.dimension):
v1 = Vec.Axis(i)
v2 = Vec()
v2[i] = 1;
v2[i] = 1
self.assertEqual(v1, v2)

v1 = Vec.XAxis()
Expand Down
10 changes: 5 additions & 5 deletions pxr/base/lib/plug/testPlug.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,24 +252,24 @@ def test_ErrorCases(self):
# try to register a non-existent plugin path
self.assertFalse(os.path.exists('/nowhere'))
Plug.Registry().RegisterPlugins('/nowhere')
self.assertEqual(listener.numReceived, 0);
self.assertEqual(listener.numReceived, 0)

# try to register an incomplete plugin
badPluginPath = testPluginsDso + '/TestPlugDsoIncomplete.framework/Resources/'
Plug.Registry().RegisterPlugins(badPluginPath)
self.assertEqual(listener.numReceived, 0);
self.assertEqual(listener.numReceived, 0)

# try to register an incomplete python plugin path
badPluginPath = testPluginsPython + '/TestPlugModuleIncomplete'
Plug.Registry().RegisterPlugins(badPluginPath)
self.assertEqual(listener.numReceived, 0);
self.assertEqual(listener.numReceived, 0)

# try to find a plugin for a Tf type which doesn't exist
unknownPlug = None
with self.assertRaises(RuntimeError):
unknownPlug = Plug.Registry().GetPluginForType(Tf.Type.FindByName('Bad'))
self.assertFalse(unknownPlug)
self.assertEqual(listener.numReceived, 0);
self.assertEqual(listener.numReceived, 0)

# try to load an unloadable plugin
badPlugin = Plug.Registry().GetPluginForType('TestPlugUnloadable')
Expand Down Expand Up @@ -318,4 +318,4 @@ def test_ErrorCases(self):
Plug.Registry().RegisterPlugins(testPluginsDsoSearch)
Plug.Registry().RegisterPlugins(testPluginsPythonSearch)
self.assertEqual(allplugins, Plug.Registry().GetAllPlugins())
self.assertEqual(listener.numReceived, 0);
self.assertEqual(listener.numReceived, 0)
12 changes: 6 additions & 6 deletions pxr/base/lib/tf/testenv/testTfPyDiagnosticNotices.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,24 +96,24 @@ def test_Notices(self):
self.log.info("Issuing a couple of different types of errors.")

try:
Tf.RaiseRuntimeError("Runtime error!");
Tf.RaiseRuntimeError("Runtime error!")
assert False, "expected exception"
except Tf.ErrorException:
pass

try:
Tf.RaiseCodingError("Coding error!");
Tf.RaiseCodingError("Coding error!")
assert False, "expected exception"
except Tf.ErrorException:
pass

self.log.info("Issuing a few generic warnings.")
Tf.Warn("Warning 1");
Tf.Warn("Warning 2");
Tf.Warn("Warning 3");
Tf.Warn("Warning 1")
Tf.Warn("Warning 2")
Tf.Warn("Warning 3")

self.log.info("Issuing a status message.")
Tf.Status("Status: Almost done testing.");
Tf.Status("Status: Almost done testing.")

# Assert that two errors, three warnings and one status message were
# issued.
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/lib/tf/testenv/testTfType.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def test_FindDerivedByName(self):
def test_PythonSubclassOfCppClass(self):
class TestPyDerived( Tf.TestCppBase ):
def TestVirtual(self):
return 123;
return 123

tTestCppBase = Tf.Type.Find( Tf.TestCppBase )
tTestPyDerived = Tf.Type.Define( TestPyDerived )
Expand Down
2 changes: 1 addition & 1 deletion pxr/base/lib/vt/testenv/testVtArray.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_VtArraySlicingVsPythonSlicing(self):
for start in range(-2, 7):
for stop in range(-2, 7):
for step in range(-5, 6):
if step == 0 : break;
if step == 0 : break
sub_a = a[start:stop:step]
sub_l = l[start:stop:step]
self.assertEqual(len(a), len(l))
Expand Down
2 changes: 1 addition & 1 deletion pxr/usd/bin/usdcat/usdcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import argparse, sys, signal, os

def _Err(msg):
sys.stderr.write(msg + '\n');
sys.stderr.write(msg + '\n')

def GetUsdData(filePath):
from pxr import Sdf
Expand Down
2 changes: 1 addition & 1 deletion pxr/usdImaging/lib/usdviewq/attributeValueEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ def _revert(self, all=False):

def _revertAll(self):
self._revert(True)

3 changes: 1 addition & 2 deletions pxr/usdImaging/lib/usdviewq/attributeViewContextMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#
from PySide import QtGui, QtCore
from PySide import QtGui
from usdviewContextMenuItem import UsdviewContextMenuItem
import os

#
# Specialized context menu for running commands in the attribute viewer.
Expand Down
9 changes: 4 additions & 5 deletions pxr/usdImaging/lib/usdviewq/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
AbstractPrimFont = NormalFont

# Keys for destinguishing items in the attribute inspector
class AttributeStatus:
class AttributeStatus(object):
DEFAULT, CLAMPED, KEYFRAME, FALLBACK, NOVALUE = range(5)

def PrintWarning(title, description):
Expand Down Expand Up @@ -121,7 +121,7 @@ def GetAttributeColor(attribute, frame, hasValue=None, hasAuthoredValue=None,

# Gathers information about a layer used as a subLayer, including its
# position in the layerStack hierarchy.
class SubLayerInfo:
class SubLayerInfo(object):
def __init__(self, sublayer, offset, containingLayer, prefix):
self.layer = sublayer
self.offset = offset
Expand Down Expand Up @@ -183,7 +183,7 @@ def PrettyFormatSize(sz):
return "%db" % sz


class Timer:
class Timer(object):
"""Use as a context object with python's "with" statement, like so:
with Timer() as t:
doSomeStuff()
Expand All @@ -204,7 +204,7 @@ def PrintTime(self, action):
print "Time to %s: %2.3fs" % (action, self.interval)


class BusyContext:
class BusyContext(object):
"""When used as a context object with python's "with" statement,
will set Qt's busy cursor upon entry and pop it on exit.
"""
Expand Down Expand Up @@ -384,4 +384,3 @@ def DumpMallocTags(stage, contextStr):
print "Unable to accumulate memory usage since the Pxr MallocTag system was not initialized"



40 changes: 18 additions & 22 deletions pxr/usdImaging/lib/usdviewq/customAttributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
# KIND, either express or implied. See the Apache License for the specific
# language governing permissions and limitations under the Apache License.
#
from PySide import QtGui, QtCore
from pxr import Tf
from pxr import UsdGeom
from datetime import datetime

#
# Edit the following to alter the set of custom attributes.
Expand All @@ -46,18 +42,18 @@ def _GetCustomAttributes(currentNode, bboxCache, xformCache):
#
class CustomAttribute:
def __init__(self, currentNode):
self._currentNode = currentNode
self._currentNode = currentNode

def IsVisible(self):
return True
return True

# GetName function to match UsdAttribute API
def GetName(self):
return ""
return ""

# Get function to match UsdAttribute API
def Get(self, frame):
return ""
return ""

# convenience function to make this look more like a UsdAttribute
def GetTypeName(self):
Expand All @@ -74,16 +70,16 @@ def __init__(self, currentNode, bboxCache):
self._bboxCache = bboxCache

def GetName(self):
return "World Bounding Box"
return "World Bounding Box"

def Get(self, frame):
try:
try:
bbox = self._bboxCache.ComputeWorldBound(self._currentNode)

except RuntimeError, err:
bbox = "Invalid: " + str(err)
return bbox
bbox = "Invalid: " + str(err)

return bbox

#
# Displays the Local to world xform of a node
Expand All @@ -96,15 +92,15 @@ def __init__(self, currentNode, xformCache):
self._xformCache = xformCache

def GetName(self):
return "Local to World Xform"
return "Local to World Xform"

def Get(self, frame):
try:
pwt = self._xformCache.GetLocalToWorldTransform(self._currentNode)
except RuntimeError, err:
pwt = "Invalid: " + str(err)
return pwt
try:
pwt = self._xformCache.GetLocalToWorldTransform(self._currentNode)
except RuntimeError, err:
pwt = "Invalid: " + str(err)

return pwt

#
# Displays a relationship on the node
Expand Down
2 changes: 1 addition & 1 deletion pxr/usdImaging/lib/usdviewq/headerContextMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HeaderContextMenu(QtGui.QMenu):
def __init__(self, parent):
QtGui.QMenu.__init__(self, parent)
self._menuItems = _GetContextMenuItems(parent)

for menuItem in self._menuItems:
if menuItem.isValid():
# create menu actions
Expand Down
Loading

0 comments on commit 30a04e1

Please sign in to comment.