In 8fe3dbcd, when Black was used on the code and unified the import statements, the import of extension was moved from the bottom of the file to the top. Any code that uses backboneelement.BackboneElement (in my case an OperationOutcome) now triggers a cyclical import as can be seen in the attached screenshot. Briefly:
backboneelement imports extension
extension imports annotation
annotation imports fhirreference
fhirreference imports bundle
bundle attempts to import backboneelement, which technically succeeds, but since the first import of backboneelement hasn't completed, the BackboneElement class isn't available and the import in bundle fails.
Expected behavior is for an import of operationoutcome.OperationOutcome to succeed.
What I Did
Text version of the attached image:
from fhir.resources.DSTU2.operationoutcome import OperationOutcome
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/operationoutcome.py", line 8, in <module>
from . import backboneelement, codeableconcept, domainresource
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/backboneelement.py", line 8, in <module>
from . import element, extension
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/extension.py", line 8, in <module>
from . import (address, annotation, attachment, codeableconcept, coding,
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/annotation.py", line 8, in <module>
from . import element, fhirdate, fhirreference
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/fhirreference.py", line 116, in <module>
from . import bundle
File "/home/app/.local/share/virtualenvs/ehr-TNUJx0lF/lib/python3.6/site-packages/fhir/resources/DSTU2/bundle.py", line 64, in <module>
class BundleEntry(backboneelement.BackboneElement):
AttributeError: module 'fhir.resources.DSTU2.backboneelement' has no attribute 'BackboneElement'
Description
In 8fe3dbcd, when Black was used on the code and unified the import statements, the import of
extension
was moved from the bottom of the file to the top. Any code that usesbackboneelement.BackboneElement
(in my case an OperationOutcome) now triggers a cyclical import as can be seen in the attached screenshot. Briefly:backboneelement
importsextension
extension
importsannotation
annotation
importsfhirreference
fhirreference
importsbundle
bundle
attempts to importbackboneelement
, which technically succeeds, but since the first import ofbackboneelement
hasn't completed, theBackboneElement
class isn't available and the import inbundle
fails.Expected behavior is for an import of
operationoutcome.OperationOutcome
to succeed.What I Did
Text version of the attached image: