sequences.utils package

Submodules

sequences.utils.fileStructure module

class sequences.utils.fileStructure.FilestructurePath(path)[source]

Bases: object

classmethod from_path(path, *args, **kwargs)[source]
classmethod find_type(path, *args, **kwargs)[source]
path
parent()[source]
name()[source]
type
class sequences.utils.fileStructure.PerforcePath(path, *args, **kwargs)[source]

Bases: sequences.utils.fileStructure.FilestructurePath

priority = 40
p4
local_path
depot_path
tracked()[source]
get_stats()[source]

Get Perforces stats (fstat) for this Perforce path This always retrieves the latest information, no caching

stats

Get Perforces stats (fstat) for this Perforce path Uses caching

get_revisions()[source]

Get Perforces revsions (filelog) for this Perforce path This always retrieves the latest information, no caching

revisions

Get Perforces revisions (filelog) for this Perforce path Uses caching

get_client_data()[source]
clientData
get_where()[source]

Get Perforces where (where) for this Perforce path No caching

where

Get Perforces where (where) for this Perforce path Uses caching

get_fileinfo()[source]

Get Perforces fileinfo (file) for this Perforce path No caching

fileinfo

Get Perforces fileinfo (file) for this Perforce path Uses caching

item_cmp(a, b)[source]

Return the comparison for two items. Sort by isfile/isdir and then by name

editable()[source]
deleted()[source]
latest()[source]
checkedOut()[source]
different
revision
next_revision
exists()[source]
refresh()[source]
sync(revision=None, *args, **kwargs)[source]
remove()[source]
checkout()[source]
revert()[source]
revert_unchanged()[source]

Reverts unchanged file

submit(description=None, force=False)[source]
get_children(includeDirs=True, includeFiles=True)[source]
read(forceP4=False)[source]
isfile()[source]
isdir()[source]
validate()[source]
class sequences.utils.fileStructure.DiskPath(path)[source]

Bases: sequences.utils.fileStructure.FilestructurePath

priority = 20
local_path
exists()[source]
editable()[source]
read()[source]
get_children()[source]
isfile()[source]
isdir()[source]
validate()[source]

sequences.utils.perforce module

sequences.utils.perforce.refresh()[source]

Delete all cached p4 connections

sequences.utils.perforce.newInstance(dialog=False)[source]
sequences.utils.perforce.is_valid_user(p4)[source]
class sequences.utils.perforce.TempP4ExceptionLevel(p4, lvl)[source]

Bases: object

Temporarily adjust the P4 exception level

Example

>>> with TempP4ExceptionLevel(p4, 1):
>>>     # do stuff
Parameters:
  • p4 (P4.P4) – P4 instance
  • lvl (int) – Exception Level
sequences.utils.perforce.get_p4_and_client_from_path(path)[source]

Given a path, return a p4 instance and clientData if possible. Will search within the cached instances, otherwise attempts to find an appropriate client and returns the new data

sequences.utils.perforce.get_p4_from_path(path)[source]
sequences.utils.perforce.get_client_data(p4)[source]
sequences.utils.perforce.get_client_from_path(p4, path, clients=None, includeData=False)[source]
sequences.utils.perforce.check_path_in_client(p4, c, path, filterHost=True)[source]
sequences.utils.perforce.find_client(p4, path, host=None)[source]

Find a client by root path

sequences.utils.perforce.get_depots(p4=None, refresh=False)[source]

Return a list of all depots

sequences.utils.perforce.get_depot_paths(p4=None, refresh=False)[source]

From a p4 instance, get a list of all depot paths available

Parameters:p4 (P4) – perforce instance
Returns:
Depot paths in the format of
[‘//{depotName}’, ...]
Return type:list of str
sequences.utils.perforce.get_clients(p4=None, refresh=False)[source]

Return a list of all clients

sequences.utils.perforce.get_clients_with_specs(p4=None, clients=None, ignoreStreams=False, useCache=True)[source]

Get a list of clients with their full specs This contains the view mappings

sequences.utils.perforce.get_child_dirs(p4, path, **kwargs)[source]

Return all child directories of the given path as strings Kwargs are passed to filter_item

sequences.utils.perforce.get_child_files(p4, path, includeDeleted=False, **kwargs)[source]

Return all perforce files inside the given directory as strings

sequences.utils.perforce.build_changelist(p4, files, description)[source]
sequences.utils.perforce.is_path_tracked(path, p4=None)[source]
sequences.utils.perforce.is_file_tracked(path, p4=None)[source]

Return True if the given file is currently tracked in perforce

sequences.utils.perforce.is_dir_tracked(path, p4=None)[source]

Return True if the given directory is currently tracked in perforce

sequences.utils.utils module

sequences.utils.utils.get_os()

Get the os of the current system in a standard format. mac, windows, linux

sequences.utils.utils.path_normalize(filename, allowBackslash=False, normcase=False, removeDoubleSlashes=True)

Normalize filename Make sure all slashes match the platform

sequences.utils.utils.path_contains(root, path, normalize=True, normcase=True)

Return True if root contains path Prevents false positives such as:

/root /root2/project
sequences.utils.utils.join_paths(*paths)

Join paths using forward slashes

sequences.utils.utils.filter_item(item, include=['*'], exclude=[])

Return True if the given item passes the given filters, False if it doesn’t

key - can be given an attrgetter or itemgetter to be used on item

sequences.utils.utils.get_folder_contents(path, includeFiles=True, includeDirs=True, **kwargs)

Module contents