compressedfhir 1.0.9__tar.gz → 1.0.10__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of compressedfhir might be problematic. Click here for more details.

Files changed (69) hide show
  1. {compressedfhir-1.0.9/compressedfhir.egg-info → compressedfhir-1.0.10}/PKG-INFO +1 -1
  2. compressedfhir-1.0.10/VERSION +1 -0
  3. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle.py +6 -2
  4. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle_entry.py +1 -1
  5. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle_entry_request.py +1 -1
  6. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle_entry_response.py +1 -1
  7. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle_entry_search.py +1 -1
  8. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_identifier.py +1 -1
  9. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_link.py +1 -1
  10. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_meta.py +1 -1
  11. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_resource.py +1 -1
  12. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/compressed_dict.py +40 -33
  13. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_helpers.py +12 -6
  14. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/test/test_json_helpers.py +7 -5
  15. {compressedfhir-1.0.9 → compressedfhir-1.0.10/compressedfhir.egg-info}/PKG-INFO +1 -1
  16. compressedfhir-1.0.9/VERSION +0 -1
  17. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/LICENSE +0 -0
  18. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/MANIFEST.in +0 -0
  19. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/Makefile +0 -0
  20. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/README.md +0 -0
  21. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/__init__.py +0 -0
  22. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/__init__.py +0 -0
  23. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/base_resource_list.py +0 -0
  24. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_bundle_entry_list.py +0 -0
  25. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_resource_list.py +0 -0
  26. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/fhir_resource_map.py +0 -0
  27. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/__init__.py +0 -0
  28. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_bundle_entry.py +0 -0
  29. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_bundle_entry_list.py +0 -0
  30. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_bundle_entry_request.py +0 -0
  31. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_bundle_entry_response.py +0 -0
  32. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_fhir_bundle.py +0 -0
  33. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_fhir_resource.py +0 -0
  34. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_fhir_resource_list.py +0 -0
  35. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/fhir/test/test_fhir_resource_map.py +0 -0
  36. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/py.typed +0 -0
  37. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/__init__.py +0 -0
  38. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/__init__.py +0 -0
  39. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/__init__.py +0 -0
  40. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/compressed_dict_access_error.py +0 -0
  41. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/compressed_dict_storage_mode.py +0 -0
  42. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/test/__init__.py +0 -0
  43. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/compressed_dict/v1/test/test_compressed_dict.py +0 -0
  44. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/fhir_json_encoder.py +0 -0
  45. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/__init__.py +0 -0
  46. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/test/__init__.py +0 -0
  47. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/test/test_type_preservation_decoder.py +0 -0
  48. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/test/test_type_preservation_encoder.py +0 -0
  49. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/test/test_type_preservation_serializer.py +0 -0
  50. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/type_preservation_decoder.py +0 -0
  51. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/type_preservation_encoder.py +0 -0
  52. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/json_serializers/type_preservation_serializer.py +0 -0
  53. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/ordered_dict_to_dict_converter/__init__.py +0 -0
  54. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/ordered_dict_to_dict_converter/ordered_dict_to_dict_converter.py +0 -0
  55. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/string_compressor/__init__.py +0 -0
  56. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/string_compressor/v1/__init__.py +0 -0
  57. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/string_compressor/v1/string_compressor.py +0 -0
  58. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/string_compressor/v1/test/__init__.py +0 -0
  59. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/string_compressor/v1/test/test_string_compressor.py +0 -0
  60. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/test/__init__.py +0 -0
  61. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir/utilities/test/test_fhir_json_encoder.py +0 -0
  62. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir.egg-info/SOURCES.txt +0 -0
  63. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir.egg-info/dependency_links.txt +0 -0
  64. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir.egg-info/not-zip-safe +0 -0
  65. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir.egg-info/requires.txt +0 -0
  66. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/compressedfhir.egg-info/top_level.txt +0 -0
  67. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/setup.cfg +0 -0
  68. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/setup.py +0 -0
  69. {compressedfhir-1.0.9 → compressedfhir-1.0.10}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressedfhir
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Summary: Stores FHIR JSON resources in compressed form in memory
5
5
  Home-page: https://github.com/icanbwell/compressed-fhir
6
6
  Author: Imran Qureshi
@@ -0,0 +1 @@
1
+ 1.0.10
@@ -68,7 +68,7 @@ class FhirBundle:
68
68
  self.link: Optional[List[FhirLink]] = link
69
69
  self.meta: Optional[FhirMeta] = meta
70
70
 
71
- def dict(self) -> OrderedDict[str, Any]:
71
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
72
72
  entries: List[Dict[str, Any]] | None = (
73
73
  [entry.dict() for entry in self.entry] if self.entry else None
74
74
  )
@@ -289,4 +289,8 @@ class FhirBundle:
289
289
 
290
290
  :return: Plain dictionary representation of the Bundle
291
291
  """
292
- return OrderedDictToDictConverter.convert(self.dict())
292
+ return (
293
+ OrderedDictToDictConverter.convert(self.dict()) # type: ignore[arg-type]
294
+ if isinstance(self.dict(), OrderedDict)
295
+ else self.dict()
296
+ )
@@ -134,7 +134,7 @@ class FhirBundleEntry:
134
134
  else:
135
135
  self._resource = None
136
136
 
137
- def dict(self) -> OrderedDict[str, Any]:
137
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
138
138
  result: OrderedDict[str, Any] = OrderedDict[str, Any]()
139
139
  if self.fullUrl is not None:
140
140
  result["fullUrl"] = self.fullUrl
@@ -27,7 +27,7 @@ class FhirBundleEntryRequest:
27
27
  self.ifNoneMatch: Optional[str] = ifNoneMatch
28
28
  self.ifNoneExist: Optional[str] = ifNoneExist
29
29
 
30
- def dict(self) -> OrderedDict[str, Any]:
30
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
31
31
  result: OrderedDict[str, Any] = OrderedDict[str, Any](
32
32
  {"url": self.url, "method": self.method}
33
33
  )
@@ -27,7 +27,7 @@ class FhirBundleEntryResponse:
27
27
  self.etag: Optional[str] = etag
28
28
  self.location: Optional[str] = location
29
29
 
30
- def dict(self) -> OrderedDict[str, Any]:
30
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
31
31
  result: OrderedDict[str, Any] = OrderedDict[str, Any]({"status": self.status})
32
32
  if self.lastModified is not None:
33
33
  result["lastModified"] = self.lastModified.isoformat()
@@ -21,7 +21,7 @@ class FhirBundleEntrySearch:
21
21
  self.mode: Optional[str] = mode
22
22
  self.score: Optional[float] = score
23
23
 
24
- def dict(self) -> OrderedDict[str, Any]:
24
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
25
25
  """
26
26
  Converts the FhirBundleEntrySearch instance to a dictionary.
27
27
 
@@ -28,7 +28,7 @@ class FhirIdentifier:
28
28
  self.system: Optional[str] = system
29
29
  self.value: Optional[str] = value
30
30
 
31
- def dict(self) -> OrderedDict[str, Any]:
31
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
32
32
  """
33
33
  Convert the FhirIdentifier object to a dictionary.
34
34
 
@@ -22,7 +22,7 @@ class FhirLink:
22
22
  self.url: str = url
23
23
  self.relation: str = relation
24
24
 
25
- def dict(self) -> OrderedDict[str, Any]:
25
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
26
26
  """
27
27
  Converts the FhirLink instance to a dictionary.
28
28
 
@@ -17,7 +17,7 @@ class FhirMeta:
17
17
  security: list[Dict[str, Any]] | None = None
18
18
  tag: list[str] | None = None
19
19
 
20
- def dict(self) -> OrderedDict[str, Any]:
20
+ def dict(self) -> OrderedDict[str, Any] | Dict[str, Any]:
21
21
  result: OrderedDict[str, Any] = OrderedDict[str, Any]()
22
22
  if self.version_id is not None:
23
23
  result["versionId"] = self.version_id
@@ -150,7 +150,7 @@ class FhirResource(CompressedDict[str, Any]):
150
150
  """Convert the resource to a JSON string."""
151
151
 
152
152
  # working_dict preserves the python types so create a fhir friendly version
153
- raw_dict: OrderedDict[str, Any] = self.raw_dict()
153
+ raw_dict: OrderedDict[str, Any] | Dict[str, Any] = self.raw_dict()
154
154
 
155
155
  raw_dict = FhirClientJsonHelpers.remove_empty_elements_from_ordered_dict(
156
156
  raw_dict
@@ -62,10 +62,10 @@ class CompressedDict[K, V](MutableMapping[K, V]):
62
62
  self._storage_mode: CompressedDictStorageMode = storage_mode
63
63
 
64
64
  # Working copy of the dictionary during context
65
- self._working_dict: Optional[OrderedDict[K, V]] = None
65
+ self._working_dict: Optional[OrderedDict[K, V]] | Dict[K, V] = None
66
66
 
67
67
  # Private storage options
68
- self._raw_dict: OrderedDict[K, V] = OrderedDict[K, V]()
68
+ self._raw_dict: OrderedDict[K, V] | Dict[K, V] = OrderedDict[K, V]()
69
69
  self._serialized_dict: Optional[bytes] = None
70
70
 
71
71
  self._properties_to_cache: List[K] | None = properties_to_cache
@@ -78,13 +78,16 @@ class CompressedDict[K, V](MutableMapping[K, V]):
78
78
 
79
79
  # Populate initial dictionary if provided
80
80
  if initial_dict:
81
- # Ensure we use an OrderedDict to maintain original order
82
- initial_dict_ordered = (
83
- initial_dict
84
- if isinstance(initial_dict, OrderedDict)
85
- else OrderedDict[K, V](initial_dict)
86
- )
87
- self.replace(value=initial_dict_ordered)
81
+ if self._storage_mode.storage_type != "raw":
82
+ # Ensure we use an OrderedDict to maintain original order
83
+ initial_dict_ordered = (
84
+ initial_dict
85
+ if isinstance(initial_dict, OrderedDict)
86
+ else OrderedDict[K, V](initial_dict)
87
+ )
88
+ self.replace(value=initial_dict_ordered)
89
+ else:
90
+ self._update_serialized_dict(current_dict=initial_dict)
88
91
 
89
92
  @contextmanager
90
93
  def transaction(self) -> Iterator["CompressedDict[K, V]"]:
@@ -142,8 +145,8 @@ class CompressedDict[K, V](MutableMapping[K, V]):
142
145
  if not self._working_dict:
143
146
  self._working_dict = self.create_working_dict()
144
147
 
145
- def create_working_dict(self) -> OrderedDict[K, V]:
146
- working_dict: OrderedDict[K, V]
148
+ def create_working_dict(self) -> OrderedDict[K, V] | Dict[K, V]:
149
+ working_dict: OrderedDict[K, V] | Dict[K, V]
147
150
  # Deserialize the dictionary before entering the context
148
151
  if self._storage_mode.storage_type == "raw":
149
152
  # For raw mode, create a deep copy of the existing dictionary
@@ -163,7 +166,9 @@ class CompressedDict[K, V](MutableMapping[K, V]):
163
166
 
164
167
  @staticmethod
165
168
  def _serialize_dict(
166
- *, dictionary: OrderedDict[K, V], storage_type: CompressedDictStorageType
169
+ *,
170
+ dictionary: OrderedDict[K, V] | Dict[K, V],
171
+ storage_type: CompressedDictStorageType,
167
172
  ) -> bytes:
168
173
  """
169
174
  Serialize entire dictionary using MessagePack
@@ -247,14 +252,15 @@ class CompressedDict[K, V](MutableMapping[K, V]):
247
252
  unpacked_dict,
248
253
  )
249
254
 
250
- def _get_dict(self) -> OrderedDict[K, V]:
255
+ def _get_dict(self) -> OrderedDict[K, V] | Dict[K, V]:
251
256
  """
252
257
  Get the dictionary, deserializing if necessary
253
258
 
254
259
  Returns:
255
260
  Current dictionary state
256
261
  """
257
-
262
+ if self._storage_mode.storage_type == "raw":
263
+ return self._raw_dict
258
264
  if self._working_dict is None:
259
265
  raise CompressedDictAccessError(
260
266
  "Dictionary access is only allowed within an transaction() block. "
@@ -262,9 +268,6 @@ class CompressedDict[K, V](MutableMapping[K, V]):
262
268
  f"You tried to access it with storage type {self._storage_mode.storage_type}."
263
269
  )
264
270
 
265
- if self._storage_mode.storage_type == "raw":
266
- return self._raw_dict
267
-
268
271
  # For non-raw modes, do not keep deserialized dict
269
272
  return self._working_dict
270
273
 
@@ -282,11 +285,6 @@ class CompressedDict[K, V](MutableMapping[K, V]):
282
285
  if self._properties_to_cache and key in self._properties_to_cache:
283
286
  return self._cached_properties[key]
284
287
 
285
- if self._working_dict is None:
286
- raise CompressedDictAccessError(
287
- "Dictionary access is only allowed within an transaction() block. "
288
- "Use 'with compressed_dict.transaction() as d:' to access the dictionary."
289
- )
290
288
  return self._get_dict()[key]
291
289
 
292
290
  def __setitem__(self, key: K, value: V) -> None:
@@ -310,7 +308,9 @@ class CompressedDict[K, V](MutableMapping[K, V]):
310
308
  # Update the cached properties if the key is in the list
311
309
  self._cached_properties[key] = value
312
310
 
313
- def _update_serialized_dict(self, current_dict: OrderedDict[K, V] | None) -> None:
311
+ def _update_serialized_dict(
312
+ self, current_dict: OrderedDict[K, V] | Dict[K, V] | None
313
+ ) -> None:
314
314
  if current_dict is None:
315
315
  self._cached_properties.clear()
316
316
  self._length = 0
@@ -425,7 +425,7 @@ class CompressedDict[K, V](MutableMapping[K, V]):
425
425
  """
426
426
  return self._get_dict().items()
427
427
 
428
- def raw_dict(self) -> OrderedDict[K, V]:
428
+ def raw_dict(self) -> OrderedDict[K, V] | Dict[K, V]:
429
429
  """
430
430
  Returns the raw dictionary. Deserializes if necessary.
431
431
  Note that this dictionary preserves the python types so it is not FHIR friendly.
@@ -442,7 +442,7 @@ class CompressedDict[K, V](MutableMapping[K, V]):
442
442
  # in the self._working_dict to keep memory low
443
443
  return self.create_working_dict()
444
444
 
445
- def dict(self) -> OrderedDict[K, V]:
445
+ def dict(self) -> OrderedDict[K, V] | Dict[K, V]:
446
446
  """
447
447
  Convert to a FHIR friendly dictionary where the python types like datetime are converted to string versions
448
448
  For example, datetime will be represented as a iso format string per FHIR instead of a python datetime object.
@@ -450,18 +450,22 @@ class CompressedDict[K, V](MutableMapping[K, V]):
450
450
  Returns:
451
451
  FHIR friendly dictionary
452
452
  """
453
- return cast(
454
- OrderedDict[K, V],
455
- json.loads(
456
- self.json(),
457
- object_pairs_hook=lambda pairs: OrderedDict(pairs),
458
- ),
453
+ return (
454
+ cast(
455
+ OrderedDict[K, V],
456
+ json.loads(
457
+ self.json(),
458
+ object_pairs_hook=lambda pairs: OrderedDict(pairs),
459
+ ),
460
+ )
461
+ if self._storage_mode != CompressedDictStorageMode.raw()
462
+ else self.raw_dict()
459
463
  )
460
464
 
461
465
  def json(self) -> str:
462
466
  """Convert the resource to a JSON string."""
463
467
 
464
- raw_dict: OrderedDict[K, V] = self.raw_dict()
468
+ raw_dict: OrderedDict[K, V] | Dict[K, V] = self.raw_dict()
465
469
 
466
470
  return json.dumps(obj=raw_dict, cls=FhirJSONEncoder)
467
471
 
@@ -663,7 +667,10 @@ class CompressedDict[K, V](MutableMapping[K, V]):
663
667
  Returns:
664
668
  Plain dictionary
665
669
  """
666
- return OrderedDictToDictConverter.convert(self.raw_dict())
670
+ if isinstance(self.raw_dict(), OrderedDict):
671
+ return OrderedDictToDictConverter.convert(self.raw_dict()) # type: ignore[arg-type]
672
+ else:
673
+ return self.raw_dict()
667
674
 
668
675
  @classmethod
669
676
  def from_json(cls, json_str: str) -> "CompressedDict[K, V]":
@@ -59,19 +59,25 @@ class FhirClientJsonHelpers:
59
59
  @staticmethod
60
60
  @overload
61
61
  def remove_empty_elements_from_ordered_dict(
62
- d: List[OrderedDict[str, Any]],
63
- ) -> List[OrderedDict[str, Any]]: ...
62
+ d: List[OrderedDict[str, Any] | Dict[str, Any]],
63
+ ) -> List[OrderedDict[str, Any] | Dict[str, Any]]: ...
64
64
 
65
65
  @staticmethod
66
66
  @overload
67
67
  def remove_empty_elements_from_ordered_dict(
68
- d: OrderedDict[str, Any],
69
- ) -> OrderedDict[str, Any]: ...
68
+ d: OrderedDict[str, Any] | Dict[str, Any],
69
+ ) -> OrderedDict[str, Any] | Dict[str, Any]: ...
70
70
 
71
71
  @staticmethod
72
72
  def remove_empty_elements_from_ordered_dict(
73
- d: List[OrderedDict[str, Any]] | OrderedDict[str, Any],
74
- ) -> List[OrderedDict[str, Any]] | OrderedDict[str, Any]:
73
+ d: List[OrderedDict[str, Any] | Dict[str, Any]]
74
+ | OrderedDict[str, Any]
75
+ | Dict[str, Any],
76
+ ) -> (
77
+ List[OrderedDict[str, Any] | Dict[str, Any]]
78
+ | OrderedDict[str, Any]
79
+ | Dict[str, Any]
80
+ ):
75
81
  """
76
82
  Recursively remove empty lists, empty dicts, or None elements from a dictionary
77
83
  or a list of dictionaries
@@ -42,18 +42,20 @@ class TestFhirClientJsonHelpers:
42
42
  [("a", 1), ("b", ""), ("c", None), ("d", []), ("e", {}), ("f", [1, 2, 3])]
43
43
  )
44
44
  expected_dict = OrderedDict([("a", 1), ("f", [1, 2, 3])])
45
- result: List[OrderedDict[str, Any]] | OrderedDict[str, Any] = (
46
- FhirClientJsonHelpers.remove_empty_elements_from_ordered_dict(input_dict)
47
- )
45
+ result: (
46
+ List[OrderedDict[str, Any] | Dict[str, Any]]
47
+ | OrderedDict[str, Any]
48
+ | Dict[str, Any]
49
+ ) = FhirClientJsonHelpers.remove_empty_elements_from_ordered_dict(input_dict)
48
50
  assert result == expected_dict
49
51
 
50
52
  # Test list of OrderedDicts
51
- input_list: List[OrderedDict[str, Any]] = [
53
+ input_list: List[OrderedDict[str, Any] | Dict[str, Any]] = [
52
54
  OrderedDict([("a", 1), ("b", None)]),
53
55
  OrderedDict([("c", []), ("d", "test")]),
54
56
  OrderedDict([("e", {})]),
55
57
  ]
56
- expected_list: List[OrderedDict[str, Any]] = [
58
+ expected_list: List[OrderedDict[str, Any] | Dict[str, Any]] = [
57
59
  OrderedDict([("a", 1)]),
58
60
  OrderedDict([("d", "test")]),
59
61
  ]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compressedfhir
3
- Version: 1.0.9
3
+ Version: 1.0.10
4
4
  Summary: Stores FHIR JSON resources in compressed form in memory
5
5
  Home-page: https://github.com/icanbwell/compressed-fhir
6
6
  Author: Imran Qureshi
@@ -1 +0,0 @@
1
- 1.0.9
File without changes
File without changes
File without changes