17.1.2.1. BytesDictWithDirtyFlag

class xattrfile.BytesDictWithDirtyFlag[source]

Bases: xattrfile.DictWithDirtyFlag

Dictionnary with modification (dirty) flag for bytes keys/values.

This class overrides DictWithDirtyFlag class. It adds checks and conversions to be sure that both keys and values are bytes strings.

Example (in python3):

>>> d = BytesDictWithDirtyFlag()
>>> d['foo'] = 'bar'
>>> d.dirty
True
>>> d['foo']
b'bar'
>>> d[b'foo']
b'bar'

Methods Summary

get(key[, default])

Return the value for key if key is in the dictionary, else default.

Methods Documentation

get(key, default=None)[source]

Return the value for key if key is in the dictionary, else default.