nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
385 stars 108 forks source link

backboneelement introduced cyclical import as of 8fe3dbcd #11

Closed mmabey closed 4 years ago

mmabey commented 4 years ago

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 uses backboneelement.BackboneElement (in my case an OperationOutcome) now triggers a cyclical import as can be seen in the attached screenshot. Briefly:

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'

image

nazrulworld commented 4 years ago

@mmabey please do merge request on https://github.com/nazrulworld/fhir.resources/tree/5.X.X 5.X.X branch

mmabey commented 4 years ago

As I mentioned in #12, the recent refactor has removed this bug.