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 54e6313
Show file tree
Hide file tree
Showing 197 changed files with 1,176 additions and 5,276 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ jobs:
coverage report -m --skip-covered
- name: Check coverage report
if: github.ref != 'refs/heads/main'
# Disable coverage checking from forks until there is a secure fix for:
# https://github.com/orgoro/coverage/issues/259
if: github.ref != 'refs/heads/main' && ${{ ! github.event.pull_request.head.repo.fork }}
uses: orgoro/[email protected]
with:
coverageFile: coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
thresholdAll: .35
thresholdAll: .45
thresholdNew: 1
thresholdModified: 0
thresholdModified: .40
13 changes: 2 additions & 11 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 }}']
{% for imp in imports %}{% if imp.module not in imported %}
from . import {{ imp.module }}
{%- endif %}{% endfor %}

10 changes: 2 additions & 8 deletions fhirclient/auth.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# -*- coding: utf-8 -*-

import uuid
import logging
from datetime import datetime, timedelta
try: # Python 2.x
import urlparse
from urllib import urlencode
except Exception as e: # Python 3
import urllib.parse as urlparse
from urllib.parse import urlencode
import urllib.parse as urlparse
from urllib.parse import urlencode

logger = logging.getLogger(__name__)

Expand Down
2 changes: 0 additions & 2 deletions fhirclient/client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

import logging

from .server import FHIRServer, FHIRUnauthorizedException, FHIRNotFoundException
Expand Down
24 changes: 4 additions & 20 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 @@ -168,20 +165,7 @@ def elementProperties(self):
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
79 changes: 15 additions & 64 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 @@ -378,64 +375,18 @@ def elementProperties(self):
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
9 changes: 1 addition & 8 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 @@ -87,8 +84,4 @@ def elementProperties(self):
return js


import sys
try:
from . import period
except ImportError:
period = sys.modules[__package__ + '.period']
from . import period
24 changes: 4 additions & 20 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 @@ -222,20 +219,7 @@ def elementProperties(self):
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
3 changes: 0 additions & 3 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 Down
44 changes: 8 additions & 36 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 @@ -197,36 +194,11 @@ def elementProperties(self):
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
14 changes: 2 additions & 12 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 @@ -53,12 +50,5 @@ def elementProperties(self):
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
29 changes: 5 additions & 24 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 @@ -200,24 +197,8 @@ def elementProperties(self):
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
24 changes: 4 additions & 20 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 @@ -71,20 +68,7 @@ def elementProperties(self):
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
9 changes: 1 addition & 8 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 @@ -72,8 +69,4 @@ def elementProperties(self):
return js


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

0 comments on commit 54e6313

Please sign in to comment.