sequences package¶
Subpackages¶
Submodules¶
sequences.core module¶
-
class
sequences.core.
AbstractSequence
(string, items=None, skipValidate=False, allowNegative=False)[source]¶ Bases:
_abcoll.Mapping
Initalize a base sequence
Parameters: - string (str) –
Sequence string Sequence must be prefixed by a period if it’s not at
the begining of a string00001 mySequence.0001
^- Only one sequence can exist in a string
- Ex:
- mySequence.0020.something.0001
Only this one will be used -> ^^^^
- Item number must be the last item in the string
- Ex:
Yes
- mySequence.0001
- No
- 0001.mySequence
- No
- mySequence.0001.something
- Sequence must be one of the below formats:
- Ex:
- mySequence.00001 (Numbers) mySequence.##### (Pound String) mySequence.{FORMATKEY:05d} (Format String) (Internal) mySequence.%05d (Percent String) mySequence.d{5} (Regex Pattern)
- items (list of str, optional) – List of item strings to use as the sequence items These items must be in the numbers format
- skipValidate (bool, optional) – Whether to skip validation on init
- allowNegative (bool, optional) – Whether to allow negative item numbers
-
regex
= <_sre.SRE_Pattern object at 0x000000000378ABF0>¶
-
formatStringKey
= 'item'¶
-
sequenceFormatTypes
= ['nums', 'pounds', 'regex', 'formatstring', 'percent']¶
-
items
¶ List of items in the version
Returns: paths Return type: list of str
-
parsed
¶
-
built
¶
-
firstItem
¶ First string item in the sequence
Returns: str
-
firstItemNumber
¶ First string item number
Returns: int
-
midItem
¶ Mid string item in the sequence
Returns: str
-
midItemNumber
¶ mid string item number
Returns: int
-
lastItem
¶ Last string item in the sequence
Returns: str
-
lastItemNumber
¶ last string item number
Returns: int
-
string
¶ Input sequence string
Returns: str
-
formatType
¶ Format type of the input sequence Ex:
aaa010.#####.png -> poundsReturns: str
-
currentItem
¶ Current item for the sequence value from the input sequence
- Ex:
- aaa010.00001.png
-> 00001
- aaa010.#####.png
Returns: str
-
currentItemNumber
¶ If the input sequence had a current item number return it
- Ex:
- aaa010.00001.png
-> 1
Parameters: value (int) – New item number Returns: int or None
-
padding
¶ Level of padding for the sequence
Returns: int
-
prefix
¶ Prefix of the file sequence
Returns: str
-
suffix
¶ Prefix of the file sequence
Returns: str
-
numbers
¶ List of all sequence item numbers
Returns: list of int
-
range
¶ Range of item numbers
Returns: (firstItemNumber, lastItemNumber) Return type: tuple of ints
-
rename
(padding=None, startFrame=None, ignoreMissing=False, replace=False, dryrun=False, progressCB=None)[source]¶
-
get_string
(itemNumber, padding=None)[source]¶ Return the sequence with the sequence numbers replaced with # Ex:
aaa010.00001.png -> itemNumber=5 aaa010.00005.pngParameters: - itemNumber (int) – The item number to use
- padding (int, optional) – Custom padding level to use If not supplied, uses the padding from the input sequence
Returns: str
-
get_pound_string
(padding=None)[source]¶ Return the sequence with the sequence numbers replaced with # Ex:
aaa010.00001.png -> aaa010.#####.pngParameters: padding (int, optional) – Custom padding level to use If not supplied, uses the padding from the input sequence Returns: str
-
get_format_string
(padding=None, formatKey=None)[source]¶ Returns the sequence with the sequence numbers replaced with a format string Ex:
aaa010.00001.png -> aaa010.{item:05d}.pngParameters: - padding (int, optional) – Custom padding level to use If not supplied, uses the padding from the input sequence
- formatKey (str, optional) – Custom format key to use If not supplied, uses the default format key for the class
Returns: str
-
get_percent_string
(padding=None)[source]¶ Return the sequence with the sequence numbers replaced with old python style string formatting Ex:
aaa010.00001.png -> aaa010.%05d.pngParameters: padding (int, optional) – Custom padding level to use If not supplied, uses the padding from the input sequence Returns: str
-
get_regex_string
(padding=None)[source]¶ Return the sequence with the sequence numbers replaced with a regex pattern Ex:
aaa010.00001.png -> aaa010.d{5}.pngParameters: padding (int, optional) – Custom padding level to use If not supplied, uses the padding from the input sequence Returns: str
-
num
(string)[source]¶ Return the number component of a sequenced string.
Parameters: string (str) – Sequence item >> num(‘apples.012’) ‘012’
-
is_part_of_sequence
(string)[source]¶ Check if the supplied string is part of this version
Parameters: string (str) – Can be any string format Returns: bool
-
get_next_item
(itemNumber=None)[source]¶ Get the next item in the sequence.
Parameters: itemNumber (int, optional) – Item number to use as the starting point. If not supplied, will use the sequences current item number. If the sequence does not have a current item number, it will raise an error. Returns: item string for next item, or None if already the last item Return type: str or None
-
get_previous_item
(itemNumber=None)[source]¶ Get the previous item in the sequence.
Parameters: itemNumber (int, optional) – Item number to use as the starting point. If not supplied, will use the sequences current item number. If the sequence does not have a current item number, it will raise an error. Returns: item string for next item, or None if already the first item Return type: str or None
- string (str) –
-
class
sequences.core.
BaseSequence
(string, items=None, skipValidate=False, allowNegative=False)[source]¶ Bases:
sequences.core.AbstractSequence
,_abcoll.MutableMapping
Base Sequence
Mutable sequence based only on supplied strings.
Parameters: - string (str) –
Sequence string Sequence must be prefixed by a period if it’s not at
the begining of a string00001 mySequence.0001
^- Only one sequence can exist in a string
- Ex:
- mySequence.0020.something.0001
Only this one will be used -> ^^^^
- Item number must be the last item in the string
- Ex:
Yes
- mySequence.0001
- No
- 0001.mySequence
- No
- mySequence.0001.something
- Sequence must be one of the below formats:
- Ex:
- mySequence.00001 (Numbers) mySequence.##### (Pound String) mySequence.{FORMATKEY:05d} (Format String) (Internal) mySequence.%05d (Percent String) mySequence.d{5} (Regex Pattern)
- items (list of str) – List of item strings These items must be in the numbers format
- skipValidate (bool) – Whether to skip validation on init
- allowNegative (bool) – Whether to allow negative item numbers
Initalize a base sequence
Parameters: - string (str) –
Sequence string Sequence must be prefixed by a period if it’s not at
the begining of a string00001 mySequence.0001
^- Only one sequence can exist in a string
- Ex:
- mySequence.0020.something.0001
Only this one will be used -> ^^^^
- Item number must be the last item in the string
- Ex:
Yes
- mySequence.0001
- No
- 0001.mySequence
- No
- mySequence.0001.something
- Sequence must be one of the below formats:
- Ex:
- mySequence.00001 (Numbers) mySequence.##### (Pound String) mySequence.{FORMATKEY:05d} (Format String) (Internal) mySequence.%05d (Percent String) mySequence.d{5} (Regex Pattern)
- items (list of str, optional) – List of item strings to use as the sequence items These items must be in the numbers format
- skipValidate (bool, optional) – Whether to skip validation on init
- allowNegative (bool, optional) – Whether to allow negative item numbers
- string (str) –
-
class
sequences.core.
FileSequence
(path, items=None, skipValidate=False, allowNegative=False, validateExists=True, fileInstance=None, normalizeInput=True)[source]¶ Bases:
sequences.core.AbstractSequence
File Sequence
Mutable sequence based on actual scanned files unless a list of items is provided for caching. Does not currently inherit base class because we don’t want the deleting of items from a sequence consisting of files.
Parameters: - path (str) –
Sequence string Sequence must be prefixed by a period if it’s not at
the begining of the pathpath/to/00001.png path/to/mySequence.0001.png
^- Only one sequence can exist in a string. If multiple exist,
- only the last sequence is used.
- Ex:
- mySequence.0020.something.0001
Only this one will be used -> ^^^^
- File number must be between periods
- Ex:
- mySequence.0001.png
- This works -> ^—-^
- 0001.mySequence.png
- Not ^^^^
- mySequence.png.0001
And Not this -> ^^^^
- Sequence must be one of the below formats:
- Ex:
- mySequence.00001 (Numbers) mySequence.##### (Pound String) mySequence.{FORMATKEY:05d} (Format String) (Internal) mySequence.%05d (Percent String) mySequence.d{5} (Regex Pattern)
- items (list of str) – List of paths in the sequence These items must be in the numbers format
- skipValidate (bool) – Whether to skip validation on init
- allowNegative (bool) – Whether to allow negative item numbers
-
regex
= <_sre.SRE_Pattern object at 0x000000000324C120>¶
-
classmethod
from_fileInstance
(instance, items=None, skipValidate=False, validateExists=True, allowNegative=False, p4=None, clientData=None)[source]¶
-
classmethod
from_item_paths
(paths, skipValidate=False, validateExists=True, allowNegative=False, p4=None, clientData=None)[source]¶
-
classmethod
from_item_files
(files, skipValidate=False, validateExists=True, allowNegative=False)[source]¶
-
sourceFile
¶
-
sourceClass
¶
-
sourcePath
¶
-
sourceLocalPath
¶
-
sourceNumber
¶
-
lastFile
¶
-
lastPath
¶
-
lastLocalPath
¶
-
lastNumber
¶
-
firstFile
¶
-
firstPath
¶
-
firstLocalPath
¶
-
firstNumber
¶
-
middleFile
¶
-
middlePath
¶
-
middleLocalPath
¶
-
middleNumber
¶
-
files
¶ List of files in the sequence
Returns: paths Return type: list of str
-
paths
¶ List of files in the sequence
Returns: paths Return type: list of str
-
localPaths
¶ List of files in the sequence
Returns: paths Return type: list of str
-
numbers
¶ List of files in the sequence
Returns: paths Return type: list of str
-
ext
¶ Extension of the file sequence
Returns: str
-
folder
¶ Path to the folder containing the sequence
Returns: str
-
localFolder
¶ Path to the folder containing the sequence
Returns: str
- path (str) –
-
class
sequences.core.
ImageSequence
(path, items=None, skipValidate=False, allowNegative=False, validateExists=True, fileInstance=None, normalizeInput=True)[source]¶ Bases:
sequences.core.FileSequence
Image Sequence
Same as file sequence with extra file extension validation for images.
File Sequence
Mutable sequence based on actual scanned files unless a list of items is provided for caching. Does not currently inherit base class because we don’t want the deleting of items from a sequence consisting of files.
Parameters: - path (str) –
Sequence string Sequence must be prefixed by a period if it’s not at
the begining of the pathpath/to/00001.png path/to/mySequence.0001.png
^- Only one sequence can exist in a string. If multiple exist,
- only the last sequence is used.
- Ex:
- mySequence.0020.something.0001
Only this one will be used -> ^^^^
- File number must be between periods
- Ex:
- mySequence.0001.png
- This works -> ^—-^
- 0001.mySequence.png
- Not ^^^^
- mySequence.png.0001
And Not this -> ^^^^
- Sequence must be one of the below formats:
- Ex:
- mySequence.00001 (Numbers) mySequence.##### (Pound String) mySequence.{FORMATKEY:05d} (Format String) (Internal) mySequence.%05d (Percent String) mySequence.d{5} (Regex Pattern)
- items (list of str) – List of paths in the sequence These items must be in the numbers format
- skipValidate (bool) – Whether to skip validation on init
- allowNegative (bool) – Whether to allow negative item numbers
-
imageExtensions
= ['tiff', 'tif', 'png', 'tga', 'jpg', 'jpeg', 'raw', 'bmp', 'gif', 'dpx', 'exr', 'psd']¶
-
formatStringKey
= 'frame'¶
- path (str) –
-
sequences.core.
scan_for_files
(path, recursive=False, groupFolders=False, _result=None)[source]¶ Scans for files under a folder, optionally recursive and optionally grouping based on each directory.