pkgcore.operations package

Submodules

Module contents

operation templates for package/repository/data source objects

For new format implementations, new formats, and generally any new extension, an operation class will likely have to be defined. While the implementations are a bit repetitive, the design of it is intentional to ensure that any derivative will be forced to adhere to the pkgcore internal api.

Basically it’s a crappy form of zope interfaces; converting to zope.interfaces may occur down the line if dependencies can be kept as minimal as possible.

exception pkgcore.operations.OperationError(api, exc=None)[source]

Bases: PkgcoreException

class pkgcore.operations.base(disable_overrides=(), enable_overrides=())[source]

Bases: object

UNSUPPORTED = <object object>
enabled_operations
raw_operations
run_if_supported(operation_name, *args, **kwds)[source]

invoke an operation if it’s supported

Parameters:
  • operation_name – operation to run if supported

  • args – positional args passed to the operation

  • kwds – optional args passed to the operation

  • or_return – if the operation isn’t supported, return this (if unspecified, it returns base.UNSUPPORTED)

Returns:

Either the value of or_return, or if the operation is supported, the return value from that operation

supports(operation_name=None, raw=False)[source]
pkgcore.operations.is_standalone(functor)[source]

decorator to mark a api operation method as containing the implementation

This is primarily useful for commands that can contain all of the logic in the template class itself, rather than requiring a glue method to be provided