Repository: rsgalloway/pyseq

Issue:
padded sequence changes to unpadded
frame sequence pad can change to unpadded (`%d`) if frame numbers lose leading "0".

for example, create 3 frames: 001, 100, and 101. the pad should be `%03d`  because frame 001 is padded:

```bash
$ touch file.001.exr file.100.exr file.101.exr
$ ls
file.001.exr  file.100.exr  file.101.exr
$ lss
   3 file.%d.exr [1, 100-101]
```

using strict padding it works, however:

```bash
$ lss -s
   3 file.%03d.exr [1, 100-101]
```

Hints from issue comments:

Solution patch:
diff --git a/README.md b/README.md
index e9d1885..2fba748 100644
--- a/README.md
+++ b/README.md
@@ -87,7 +87,7 @@ tests
     ├── bnc01_TinkSO_tx_0_ty_1.101-105.tif
     ├── bnc01_TinkSO_tx_1_ty_0.101-105.tif
     ├── bnc01_TinkSO_tx_1_ty_1.101-105.tif
-    ├── file.1-2.tif
+    ├── file.1-99.tif
     ├── file.info.03.rgb
     ├── file01.1-4.j2k
     ├── file01_40-43.rgb
diff --git a/lib/pyseq/__init__.py b/lib/pyseq/__init__.py
index 3253ebb..8741197 100644
--- a/lib/pyseq/__init__.py
+++ b/lib/pyseq/__init__.py
@@ -48,7 +48,7 @@ Docs and latest version available for download at
 """
 
 __author__ = "Ryan Galloway"
-__version__ = "0.8.2"
+__version__ = "0.8.3"
 
 try:
     import envstack
diff --git a/lib/pyseq/seq.py b/lib/pyseq/seq.py
index 3ee56a0..1a548d8 100755
--- a/lib/pyseq/seq.py
+++ b/lib/pyseq/seq.py
@@ -330,7 +330,7 @@ class Item(str):
         if is_sibling:
             frame = d[0]["frames"][0]
             self.frame = int(frame)
-            self.pad = padsize(item, frame)
+            self.pad = padsize(item, frame) if self.pad is None else self.pad
             self.head = self.name[: d[0]["start"]]
             self.tail = self.name[d[0]["end"] :]  # noqa
             frame = d[0]["frames"][1]


Test patch:
diff --git a/tests/test_pyseq.py b/tests/test_pyseq.py
index 3567488..a1ace64 100644
--- a/tests/test_pyseq.py
+++ b/tests/test_pyseq.py
@@ -582,7 +582,7 @@ class LSSTestCase(unittest.TestCase):
    5 bnc01_TinkSO_tx_0_ty_1.%04d.tif [101-105]
    5 bnc01_TinkSO_tx_1_ty_0.%04d.tif [101-105]
    5 bnc01_TinkSO_tx_1_ty_1.%04d.tif [101-105]
-   2 file.%02d.tif [1-2]
+   4 file.%02d.tif [1-2, 98-99]
    1 file.info.03.rgb 
    3 file01.%03d.j2k [1-2, 4]
    4 file01_%04d.rgb [40-43]
@@ -848,7 +848,7 @@ class TestIssues(unittest.TestCase):
         # test padded frames
         seqs = get_sequences(padded)
         self.assertEqual(len(seqs), 1)
-        self.assertEqual(seqs[0].format(seqformat), "   4 file.%d.jpg [8-11]")
+        self.assertEqual(seqs[0].format(seqformat), "   4 file.%02d.jpg [8-11]")
 
         # test unpadded frames
         seqs = get_sequences(unpadded)