Skip to content

Commit

Permalink
Use try/except for str cases
Browse files Browse the repository at this point in the history
  • Loading branch information
doruchan authored and justinfx committed Jul 25, 2023
1 parent 729f5f1 commit d93f22f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/fileseq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,10 @@ def pad(number, width=0, decimal_places=None):
# See _DeriveClipTimeString for formating of templateAssetPath
# https://github.com/PixarAnimationStudios/USD/blob/release/pxr/usd/usd/clipSetDefinition.cpp
if decimal_places == 0:
if not isinstance(number, str):
try:
number = round(number)
except TypeError:
pass
return futils.native_str(number).partition(".")[0].zfill(width)

# USD ultimately uses vsnprintf to format floats for templateAssetPath:
Expand Down

0 comments on commit d93f22f

Please sign in to comment.