Generating from the attached XSD like this:
pyxbgen -u multipleRestriction.xsd -m mr
results in the following output:
urn:uuid:4abace1e-3282-11df-89bf-000e0ca22035
Attribute {http://www.example.org/multipleRestriction}Type1.anAttribute renamed to anAttribute_
Attribute None.anAttribute renamed to anAttribute_2
Python for http://www.example.org/multipleRestriction requires 1 modules
Saved binding source to ./mr.py
Multiple attributes are generated from anAttribute, when there should only be one:
import mr
import re
r = mr.root()
[ v for v in dir (r) if re.match(".anAttribute.",v)]
['CTD_ANON_1anAttribute_2', '_Type1anAttribute', 'Type3anAttribute', '_Type4anAttribute', 'httpwww_example_orgmultipleRestriction_Type1_anAttribute', 'anAttribute', 'anAttribute', 'anAttribute_2']
anAttribute is inherited by the complex type definition in the root element from its great-great grandparent. anAttribute_ and anAttribute_2 should not have been created, I think.
In this case, the renaming happens on every second derivation step, once on a restriction and once on an extension.
Example XSD illustrating defect
Patch to fix #80
PyXB generates unique names for each attribute declaration. An attribute
use, which is what appears in the generated class, may be a restriction of
another attribute use, in which case the generated names should correspond
to the names used in that use. The code improperly traversed only a single
restrictionOf step when determining the names to be used.
Fixed in the trac/80 branch, and patch uploaded. Will be integrated into 1.1.2.