Skip to content

Commit

Permalink
Drop resource-template workaround for python2 imports
Browse files Browse the repository at this point in the history
These are unnecessary nowadays and dropping them will reduce
complexity and improve coverage reporting.
  • Loading branch information
mikix committed Jul 15, 2024
1 parent 6224d43 commit 05483c5
Show file tree
Hide file tree
Showing 191 changed files with 1,125 additions and 5,635 deletions.
11 changes: 1 addition & 10 deletions fhir-parser-resources/template-resource.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR {{ info.version }} ({{ profile.url }}) on {{ info.date }}.
# {{ info.year }}, SMART Health IT.

Expand Down Expand Up @@ -79,13 +76,7 @@ def elementProperties(self):
{%- endif %}
{%- endfor %}

{% if imports|length > 0 and imported|length != imports|length %}
import sys
{%- endif %}
{%- for imp in imports %}{% if imp.module not in imported %}
try:
from . import {{ imp.module }}
except ImportError:
{{ imp.module }} = sys.modules[__package__ + '.{{ imp.module }}']
from . import {{ imp.module }}
{%- endif %}{% endfor %}

26 changes: 4 additions & 22 deletions fhirclient/models/account.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Account) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -166,22 +163,7 @@ def elementProperties(self):
("period", "period", period.Period, False, None, False),
])
return js


import sys
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
from . import codeableconcept
from . import fhirreference
from . import identifier
from . import period
81 changes: 15 additions & 66 deletions fhirclient/models/activitydefinition.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/ActivityDefinition) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -376,66 +373,18 @@ def elementProperties(self):
("type", "type", str, False, None, True),
])
return js


import sys
try:
from . import age
except ImportError:
age = sys.modules[__package__ + '.age']
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import contactdetail
except ImportError:
contactdetail = sys.modules[__package__ + '.contactdetail']
try:
from . import dosage
except ImportError:
dosage = sys.modules[__package__ + '.dosage']
try:
from . import duration
except ImportError:
duration = sys.modules[__package__ + '.duration']
try:
from . import expression
except ImportError:
expression = sys.modules[__package__ + '.expression']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
try:
from . import quantity
except ImportError:
quantity = sys.modules[__package__ + '.quantity']
try:
from . import range
except ImportError:
range = sys.modules[__package__ + '.range']
try:
from . import relatedartifact
except ImportError:
relatedartifact = sys.modules[__package__ + '.relatedartifact']
try:
from . import timing
except ImportError:
timing = sys.modules[__package__ + '.timing']
try:
from . import usagecontext
except ImportError:
usagecontext = sys.modules[__package__ + '.usagecontext']
from . import age
from . import codeableconcept
from . import contactdetail
from . import dosage
from . import duration
from . import expression
from . import fhirdate
from . import fhirreference
from . import identifier
from . import period
from . import quantity
from . import range
from . import relatedartifact
from . import timing
from . import usagecontext
11 changes: 1 addition & 10 deletions fhirclient/models/address.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Address) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -85,10 +82,4 @@ def elementProperties(self):
("use", "use", str, False, None, False),
])
return js


import sys
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
from . import period
26 changes: 4 additions & 22 deletions fhirclient/models/adverseevent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/AdverseEvent) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -220,22 +217,7 @@ def elementProperties(self):
("productRelatedness", "productRelatedness", str, False, None, False),
])
return js


import sys
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
from . import codeableconcept
from . import fhirdate
from . import fhirreference
from . import identifier
5 changes: 0 additions & 5 deletions fhirclient/models/age.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Age) on 2024-07-15.
# 2024, SMART Health IT.

Expand All @@ -22,5 +19,3 @@ def __init__(self, jsondict=None, strict=True):
"""

super(Age, self).__init__(jsondict=jsondict, strict=strict)


46 changes: 8 additions & 38 deletions fhirclient/models/allergyintolerance.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -195,38 +192,11 @@ def elementProperties(self):
("substance", "substance", codeableconcept.CodeableConcept, False, None, False),
])
return js


import sys
try:
from . import age
except ImportError:
age = sys.modules[__package__ + '.age']
try:
from . import annotation
except ImportError:
annotation = sys.modules[__package__ + '.annotation']
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
try:
from . import range
except ImportError:
range = sys.modules[__package__ + '.range']
from . import age
from . import annotation
from . import codeableconcept
from . import fhirdate
from . import fhirreference
from . import identifier
from . import period
from . import range
16 changes: 2 additions & 14 deletions fhirclient/models/annotation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -51,14 +48,5 @@ def elementProperties(self):
("time", "time", fhirdate.FHIRDate, False, None, False),
])
return js


import sys
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
from . import fhirdate
from . import fhirreference
31 changes: 5 additions & 26 deletions fhirclient/models/appointment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -198,26 +195,8 @@ def elementProperties(self):
("type", "type", codeableconcept.CodeableConcept, True, None, False),
])
return js


import sys
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
from . import codeableconcept
from . import fhirdate
from . import fhirreference
from . import identifier
from . import period
26 changes: 4 additions & 22 deletions fhirclient/models/appointmentresponse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -69,22 +66,7 @@ def elementProperties(self):
("start", "start", fhirdate.FHIRDate, False, None, False),
])
return js


import sys
try:
from . import codeableconcept
except ImportError:
codeableconcept = sys.modules[__package__ + '.codeableconcept']
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
try:
from . import fhirreference
except ImportError:
fhirreference = sys.modules[__package__ + '.fhirreference']
try:
from . import identifier
except ImportError:
identifier = sys.modules[__package__ + '.identifier']
from . import codeableconcept
from . import fhirdate
from . import fhirreference
from . import identifier
11 changes: 1 addition & 10 deletions fhirclient/models/attachment.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Generated from FHIR 4.0.1-9346c8cc45 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2024-07-15.
# 2024, SMART Health IT.

Expand Down Expand Up @@ -70,10 +67,4 @@ def elementProperties(self):
("url", "url", str, False, None, False),
])
return js


import sys
try:
from . import fhirdate
except ImportError:
fhirdate = sys.modules[__package__ + '.fhirdate']
from . import fhirdate
Loading

0 comments on commit 05483c5

Please sign in to comment.