Package pycocoa :: Module internals
[frames] | no frames]

Module internals

Mostly INTERNAL, private classes, functions, constants, etc.


Version: 25.02.25

Classes
  proxy_RO
Decorator for a lazy module dict or Read-Only module property.
  Adict
A dict with key and attribute access to the items and callable to add items.
  frozendict
An immutable Python dict with key and attribute access to the items.
Functions
 
property_RO(method)
Decorator for Read_Only class/instance property.
 
bytes2repr(bytestr)
Represent bytes or str as b"...".
 
bytes2str(bytestr, dflt=missing, **name)
Convert bytes/unicode to str if needed.
 
iterbytes(bytestr)
Iterate bytes, yielding each as byte.
 
str2bytes(strbytes, dflt=missing, **name)
Convert strbytes to bytes/unicode if needed.
 
lambda1(arg)
Inlieu of using lambda arg: arg.
Variables
  missing = missing
Missing keyword argument value.
Function Details

property_RO(method)

 

Decorator for Read_Only class/instance property.

Parameters:
  • method - The callable to be decorated as Read_Only property.

Note: Like standard Python property without a property.setter and with an error message when trying to set.

bytes2repr(bytestr)

 

Represent bytes or str as b"...".

Parameters:
  • bytestr - bytes or str..
Returns:
Representation b'...' (str).

bytes2str(bytestr, dflt=missing, **name)

 

Convert bytes/unicode to str if needed.

Parameters:
  • bytestr - Original bytes, str or unicode.
  • dflt - Optional, default return value.
  • name - Optional name of bytestr argument.
Returns:
The str or dflt.
Raises:
  • TypeError - If neither str nor bytes, but only if no dflt is specified.

str2bytes(strbytes, dflt=missing, **name)

 

Convert strbytes to bytes/unicode if needed.

Parameters:
  • strbytes - Original str, bytes or unicode.
  • dflt - Optional, default return value.
  • name - Optional name of bytestr argument.
Returns:
The bytes or dflt.
Raises:
  • TypeError - If neither bytes nor str, but only if no dflt is specified.