Skip to content

Internals#

Perforce _Base Class

P4OO._Base provides consistent construction and attribute handling methods for all P4OO objects.


_P4OOP4Python dataclass #

Bases: _P4OOConnection

readCounter(counterName) #

Read the named counter from Perforce and return the value.

readSpec(specObj) #

Query Perforce for the specified object's spec and load it into the provided object doing any appropriate data conversions along the way.

If the spec has already been read and is present, no action is taken.

refreshSpec(specObj) #

Clear the cached objects and modifiedSpec and re-read spec from Perforce.

Any changes made via _setSpecAttr will be lost!

runCommand(cmdName, rawOutput=False, **kwargs) #

Wrapper around _execCmd that orchestrates validating the commandline arguments from P4OO Spec/Set objects, executing the command through P4Python, and parsing the returned output back into P4OO Spec/Set objects.

setCounter(counterName, newValue) #

Set the named counter in Perforce.


Provide a set of objects that allow for interaction and translation between P4Python output and our internally maintained Python-friendly versions of Spec objects and Command Output.

_P4OOP4PythonCommand #

getOptionArgs(optionConfig, optionArgs, origFilterKey) #

For a given option, verify all passed in arguments match valid types for the option according to the schema config.

getP4ooTypeOptionArgs(checkType, optionArg) #

If an option type that might be a P4OO type, do the following: - dynamically import the appropriate P4OO module - validate that the type matches the expected type - return the enumeration of the optionArg's objects

translateP4SpecToPython(p4OutputSpec) #

Translate a P4Python provided dictionary into something more Python-friendly.

P4Python is pretty lazy and only outputs string versions of spec attributes. We'll do integer and datetime conversion of attributes specified by the translation configuration.

As defined in the config, we'll rename attributes to internally consistent names, and we'll do any necessary type conversion.

translatePySpecToP4(pythonSpec, p4SpecDict) #

Copy any modified non-date attributes to the Perforce-generated dictionary ignoring any date attribtues we don't modify

validateQuery(queryDict) #

Take a dict of name=[list] args and separate out p4 config arguments from command arguments.

Validate each argument and its list of values, convert the list of values to p4 commandline string arguments as needed (if they are P4OO_ objects), and return the validated configuration and commandline arguments.

_P4OOP4PythonSchema #

Class to abstract the contents of our p4Config.yml file, separate from the execution of the p4 commands done in P4OO._P4Python._P4OOP4Python

getCmd(cmdName) #

Return the schema definition for a given command

getSpecCmd(specType) #

Return the schema definition for a given command if it's a Perforce Spec type

readSchema(configFile) #

Read in our YAML p4Config.yml file and return a dict of supported commands as _P4OOP4PythonCommand objects