leaf-common 1.3.2__tar.gz → 1.3.3__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.
Files changed (178) hide show
  1. {leaf_common-1.3.2 → leaf_common-1.3.3}/PKG-INFO +1 -1
  2. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/asyncio_executor.py +2 -2
  3. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/event_loop_lag_monitor.py +11 -10
  4. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/environment_defaults.py +7 -7
  5. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/local_file_persistence_mechanism.py +10 -8
  6. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/resolution/resolver.py +0 -1
  7. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/time/time_util.py +5 -5
  8. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common.egg-info/PKG-INFO +1 -1
  9. {leaf_common-1.3.2 → leaf_common-1.3.3}/.coveragerc +0 -0
  10. {leaf_common-1.3.2 → leaf_common-1.3.3}/.flake8 +0 -0
  11. {leaf_common-1.3.2 → leaf_common-1.3.3}/.github/workflows/checkmarx.yml +0 -0
  12. {leaf_common-1.3.2 → leaf_common-1.3.3}/.github/workflows/codeql.yml +0 -0
  13. {leaf_common-1.3.2 → leaf_common-1.3.3}/.github/workflows/publish.yml +0 -0
  14. {leaf_common-1.3.2 → leaf_common-1.3.3}/.github/workflows/tests.yml +0 -0
  15. {leaf_common-1.3.2 → leaf_common-1.3.3}/.gitignore +0 -0
  16. {leaf_common-1.3.2 → leaf_common-1.3.3}/.pylintrc +0 -0
  17. {leaf_common-1.3.2 → leaf_common-1.3.3}/CODE_OF_CONDUCT.md +0 -0
  18. {leaf_common-1.3.2 → leaf_common-1.3.3}/CONTRIBUTING.md +0 -0
  19. {leaf_common-1.3.2 → leaf_common-1.3.3}/LICENSE.txt +0 -0
  20. {leaf_common-1.3.2 → leaf_common-1.3.3}/Makefile +0 -0
  21. {leaf_common-1.3.2 → leaf_common-1.3.3}/NOTICE.txt +0 -0
  22. {leaf_common-1.3.2 → leaf_common-1.3.3}/README.md +0 -0
  23. {leaf_common-1.3.2 → leaf_common-1.3.3}/SECURITY.md +0 -0
  24. {leaf_common-1.3.2 → leaf_common-1.3.3}/SUPPORT.md +0 -0
  25. {leaf_common-1.3.2 → leaf_common-1.3.3}/build_scripts/copyright_config.json +0 -0
  26. {leaf_common-1.3.2 → leaf_common-1.3.3}/build_scripts/run_flake8.sh +0 -0
  27. {leaf_common-1.3.2 → leaf_common-1.3.3}/build_scripts/run_pylint.sh +0 -0
  28. {leaf_common-1.3.2 → leaf_common-1.3.3}/build_scripts/source_available_copyright.txt +0 -0
  29. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/__init__.py +0 -0
  30. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/__init__.py +0 -0
  31. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/async_to_sync_generator.py +0 -0
  32. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/asyncio_executor_pool.py +0 -0
  33. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/asyncio_threadpool_executor.py +0 -0
  34. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/event_loop_factory.py +0 -0
  35. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/asyncio/task_executor.py +0 -0
  36. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/__init__.py +0 -0
  37. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/config_filter.py +0 -0
  38. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/config_filter_chain.py +0 -0
  39. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/config_handler.py +0 -0
  40. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/config_util.py +0 -0
  41. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/dictionary_overlay.py +0 -0
  42. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/config/file_of_class.py +0 -0
  43. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/__init__.py +0 -0
  44. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/conditional_logger.py +0 -0
  45. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/example_logging_config.hocon +0 -0
  46. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/logging_setup.py +0 -0
  47. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/message_types.py +0 -0
  48. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/sensitive_logger.py +0 -0
  49. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/service_log_record.py +0 -0
  50. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/stream_to_logger.py +0 -0
  51. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/logging/structured_log_record.py +0 -0
  52. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/__init__.py +0 -0
  53. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/boolean_list_parser.py +0 -0
  54. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/boolean_parser.py +0 -0
  55. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/canonical_multi_config_parser.py +0 -0
  56. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/dictionary_extractor.py +0 -0
  57. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/field_extractor.py +0 -0
  58. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/list_parser.py +0 -0
  59. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/parser.py +0 -0
  60. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/parsers/string_parser.py +0 -0
  61. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/__init__.py +0 -0
  62. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/__init__.py +0 -0
  63. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/abstract_easy_persistence.py +0 -0
  64. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/composite_persistor.py +0 -0
  65. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/easy_hocon_persistence.py +0 -0
  66. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/easy_json_persistence.py +0 -0
  67. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/easy_txt_persistence.py +0 -0
  68. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/easy/easy_yaml_persistence.py +0 -0
  69. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/README.md +0 -0
  70. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/__init__.py +0 -0
  71. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/abstract_persistence.py +0 -0
  72. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/hocon_persistence.py +0 -0
  73. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/json_gzip_persistence.py +0 -0
  74. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/json_persistence.py +0 -0
  75. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/null_persistence.py +0 -0
  76. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/override_file_extension_provider.py +0 -0
  77. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/persistence_factory.py +0 -0
  78. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/raw_bytes_persistence.py +0 -0
  79. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/reference_helper.py +0 -0
  80. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/simple_file_persistence.py +0 -0
  81. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/text_persistence.py +0 -0
  82. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/factory/yaml_persistence.py +0 -0
  83. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/interface/__init__.py +0 -0
  84. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/interface/persistence.py +0 -0
  85. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/interface/persistence_mechanism.py +0 -0
  86. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/interface/persistor.py +0 -0
  87. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/interface/restorer.py +0 -0
  88. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/__init__.py +0 -0
  89. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/abstract_persistence_mechanism.py +0 -0
  90. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/persistence_mechanism_factory.py +0 -0
  91. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/persistence_mechanisms.py +0 -0
  92. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/persistence/mechanism/s3_file_persistence_mechanism.py +0 -0
  93. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/profiling/__init__.py +0 -0
  94. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/profiling/async_profiling_lock.py +0 -0
  95. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/profiling/memory_util.py +0 -0
  96. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/profiling/profiling_lock.py +0 -0
  97. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/resolution/__init__.py +0 -0
  98. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/resolution/deprecation_redirect.py +0 -0
  99. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/resolution/resolver_util.py +0 -0
  100. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/__init__.py +0 -0
  101. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/__init__.py +0 -0
  102. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/buffered_gzip_serialization_format.py +0 -0
  103. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/chained_serialization_format.py +0 -0
  104. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/conversion_policy.py +0 -0
  105. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/gzip_serialization_format.py +0 -0
  106. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/hocon_serialization_format.py +0 -0
  107. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/json_serialization_format.py +0 -0
  108. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/raw_bytes_serialization_format.py +0 -0
  109. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/serialization_formats.py +0 -0
  110. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/text_serialization_format.py +0 -0
  111. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/format/yaml_serialization_format.py +0 -0
  112. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/__init__.py +0 -0
  113. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/deserializer.py +0 -0
  114. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/dictionary_converter.py +0 -0
  115. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/file_extension_provider.py +0 -0
  116. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/reference_pruner.py +0 -0
  117. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/serialization_format.py +0 -0
  118. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/interface/serializer.py +0 -0
  119. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/prep/__init__.py +0 -0
  120. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/prep/empty_dictionary_converter.py +0 -0
  121. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/prep/pass_through_dictionary_converter.py +0 -0
  122. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/prep/pass_through_reference_pruner.py +0 -0
  123. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/prep/redactor_dictionary_converter.py +0 -0
  124. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/util/__init__.py +0 -0
  125. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/util/bytes_decoder.py +0 -0
  126. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/serialization/util/text_file_reader.py +0 -0
  127. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/time/__init__.py +0 -0
  128. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/time/timeout.py +0 -0
  129. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/time/timeout_reached_exception.py +0 -0
  130. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/utils/__init__.py +0 -0
  131. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/utils/async_atomic_counter.py +0 -0
  132. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/utils/atomic_counter.py +0 -0
  133. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/utils/exception_util.py +0 -0
  134. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/utils/startable.py +0 -0
  135. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/validation/__init__.py +0 -0
  136. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/validation/composite_dictionary_validator.py +0 -0
  137. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common/validation/dictionary_validator.py +0 -0
  138. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common.egg-info/SOURCES.txt +0 -0
  139. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common.egg-info/dependency_links.txt +0 -0
  140. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common.egg-info/requires.txt +0 -0
  141. {leaf_common-1.3.2 → leaf_common-1.3.3}/leaf_common.egg-info/top_level.txt +0 -0
  142. {leaf_common-1.3.2 → leaf_common-1.3.3}/pyproject.toml +0 -0
  143. {leaf_common-1.3.2 → leaf_common-1.3.3}/requirements-build.txt +0 -0
  144. {leaf_common-1.3.2 → leaf_common-1.3.3}/requirements.txt +0 -0
  145. {leaf_common-1.3.2 → leaf_common-1.3.3}/setup.cfg +0 -0
  146. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/__init__.py +0 -0
  147. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/__init__.py +0 -0
  148. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/async_test_helpers.py +0 -0
  149. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_metrics_test.py +0 -0
  150. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_not_started_test.py +0 -0
  151. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_pool_dump_tasks_test.py +0 -0
  152. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_pool_gc_test.py +0 -0
  153. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_pool_metrics_test.py +0 -0
  154. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_executor_started_test.py +0 -0
  155. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/asyncio_threadpool_executor_metrics_test.py +0 -0
  156. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/callable_class.py +0 -0
  157. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/event_loop_factory_test.py +0 -0
  158. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/asyncio/sync_test_helpers.py +0 -0
  159. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/config/__init__.py +0 -0
  160. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/config/dictionary_overlay_test.py +0 -0
  161. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/config/test_config_util.py +0 -0
  162. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/parsers/__init__.py +0 -0
  163. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/parsers/canonical_multi_config_parser_test.py +0 -0
  164. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/resolution/__init__.py +0 -0
  165. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/resolution/resolver_util_test.py +0 -0
  166. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/resolution/test_deprecation_redirect.py +0 -0
  167. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/__init__.py +0 -0
  168. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/encoding/__init__.py +0 -0
  169. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/encoding/decode_text_test.py +0 -0
  170. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/encoding/text_file_reader_test.py +0 -0
  171. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/format/__init__.py +0 -0
  172. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/format/hocon_serialization_format_test.py +0 -0
  173. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/prep/__init__.py +0 -0
  174. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/serialization/prep/redactor_dictionary_converter_test.py +0 -0
  175. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/time/__init__.py +0 -0
  176. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/time/timeout_test.py +0 -0
  177. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/utils/__init__.py +0 -0
  178. {leaf_common-1.3.2 → leaf_common-1.3.3}/tests/utils/test_exception_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leaf-common
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: LEAF team common code library
5
5
  Author-email: Dan Fink <Daniel.Fink@cognizant.com>
6
6
  License-Expression: Apache-2.0
@@ -418,8 +418,8 @@ class AsyncioExecutor(TaskExecutor):
418
418
 
419
419
  # Get a dictionary entry describing some metadata about the future itself.
420
420
  task_id: int = id(task)
421
- task_info: Dict[str, Any] = {}
422
- task_info = self._background_tasks.get(task_id, task_info)
421
+ empty: Dict[str, Any] = {}
422
+ task_info: Dict[str, Any] = self._background_tasks.get(task_id, empty)
423
423
 
424
424
  self._check_task(task)
425
425
  origination: str = task.get_name()
@@ -18,9 +18,10 @@
18
18
  See class comment for details
19
19
  """
20
20
 
21
- import asyncio
22
- import statistics
23
- import time
21
+ from asyncio import create_task
22
+ from asyncio import sleep as async_sleep
23
+ from statistics import fmean
24
+ from time import monotonic
24
25
  from typing import Any
25
26
  from typing import Dict
26
27
  from typing import List
@@ -68,10 +69,10 @@ class EventLoopLagMonitor:
68
69
  """
69
70
  Sampling loop. Cancel the surrounding task to stop.
70
71
  """
71
- expected = time.monotonic() + self.interval
72
+ expected = monotonic() + self.interval
72
73
  while True:
73
- await asyncio.sleep(self.interval)
74
- now = time.monotonic()
74
+ await async_sleep(self.interval)
75
+ now = monotonic()
75
76
  lag = max(0.0, now - expected)
76
77
  self._samples.append(lag)
77
78
 
@@ -80,16 +81,16 @@ class EventLoopLagMonitor:
80
81
  # Clear the samples after reporting.
81
82
  self._samples.clear()
82
83
  if self.break_between_reports > 0:
83
- await asyncio.sleep(self.break_between_reports)
84
+ await async_sleep(self.break_between_reports)
84
85
 
85
- now = time.monotonic()
86
+ now = monotonic()
86
87
  expected = now + self.interval # resync so one big spike doesn't bias the rest
87
88
 
88
89
  def start(self) -> None:
89
90
  """
90
91
  Start the monitoring loop in a background task.
91
92
  """
92
- self.task = asyncio.create_task(self.run())
93
+ self.task = create_task(self.run())
93
94
 
94
95
  def stop(self) -> None:
95
96
  """
@@ -119,7 +120,7 @@ class EventLoopLagMonitor:
119
120
  p99 = samples_ms_sorted[min(int(n * 0.99), n - 1)]
120
121
  self.max_p50_ms = max(self.max_p50_ms, p50)
121
122
  self.max_p95_ms = max(self.max_p95_ms, p95)
122
- mean_ms = statistics.fmean(samples_ms)
123
+ mean_ms = fmean(samples_ms)
123
124
  max_samples_ms = max(samples_ms)
124
125
  self.max_mean_ms = max(self.max_mean_ms, mean_ms)
125
126
  self.max_max_ms = max(self.max_max_ms, max_samples_ms)
@@ -18,7 +18,7 @@
18
18
  See class comment for details.
19
19
  """
20
20
 
21
- import os
21
+ from os import environ
22
22
 
23
23
 
24
24
  class EnvironmentDefaults():
@@ -32,9 +32,9 @@ class EnvironmentDefaults():
32
32
  def set_environment_defaults(cls, default_dict):
33
33
  """
34
34
  :param default_dict: For each key in this dictionary, if there is
35
- not a corresponding key in the os.environ dictionary, then the
36
- value in default_dict is added to the os.environ dictionary.
37
- Keys that are already in the os.environ dictionary are not
35
+ not a corresponding key in the environ dictionary, then the
36
+ value in default_dict is added to the environ dictionary.
37
+ Keys that are already in the environ dictionary are not
38
38
  added.
39
39
  :return: a dictionary of values that were added. This dictionary
40
40
  could be empty if nothing was added, or None if default_dict
@@ -49,13 +49,13 @@ class EnvironmentDefaults():
49
49
  for key in default_dict.keys():
50
50
 
51
51
  # See if the key exists
52
- existing_value = os.environ.get(key, None)
52
+ existing_value = environ.get(key, None)
53
53
  if existing_value is None:
54
54
 
55
55
  # Key does not exist, add from defaults
56
- # os.environ values must be strings
56
+ # environ values must be strings
57
57
  new_value = str(default_dict.get(key))
58
- os.environ[key] = new_value
58
+ environ[key] = new_value
59
59
  added[key] = new_value
60
60
 
61
61
  return added
@@ -17,9 +17,11 @@
17
17
  """
18
18
  See class comment for details.
19
19
  """
20
- import io
21
- import logging
22
- import os
20
+ from io import StringIO
21
+ from logging import getLogger
22
+ from logging import Logger
23
+ from os import makedirs
24
+ from os.path import dirname
23
25
 
24
26
  from leaf_common.persistence.mechanism.abstract_persistence_mechanism \
25
27
  import AbstractPersistenceMechanism
@@ -55,7 +57,7 @@ class LocalFilePersistenceMechanism(AbstractPersistenceMechanism):
55
57
  this call.
56
58
  """
57
59
  path = self.get_path(file_extension_provider, file_reference)
58
- logger = logging.getLogger(__name__)
60
+ logger: Logger = getLogger(__name__)
59
61
  logger.info("Reading %s", str(path))
60
62
 
61
63
  fileobj = None
@@ -89,15 +91,15 @@ class LocalFilePersistenceMechanism(AbstractPersistenceMechanism):
89
91
  with data by this call.
90
92
  """
91
93
  path = self.get_path(file_extension_provider, file_reference)
92
- logger = logging.getLogger(__name__)
94
+ logger: Logger = getLogger(__name__)
93
95
  logger.info("Writing %s", str(path))
94
96
 
95
- dirs = os.path.dirname(path)
96
- os.makedirs(dirs, exist_ok=True)
97
+ dirs = dirname(path)
98
+ makedirs(dirs, exist_ok=True)
97
99
 
98
100
  # Allow for string or bytes as input
99
101
  writestyle = "wb"
100
- if isinstance(send_from_fileobj, io.StringIO):
102
+ if isinstance(send_from_fileobj, StringIO):
101
103
  writestyle = "w"
102
104
 
103
105
  return open(path, writestyle)
@@ -74,7 +74,6 @@ class Resolver():
74
74
 
75
75
  logger: Logger = getLogger(self.__class__.__name__)
76
76
  messages: List[str] = []
77
- found_module: bool = None
78
77
  if verbose:
79
78
  logger.info("Attempting to resolve module %s", use_module_name)
80
79
 
@@ -18,7 +18,7 @@
18
18
  See class comment for details
19
19
  """
20
20
 
21
- import datetime
21
+ from datetime import datetime
22
22
 
23
23
  from pytz import timezone
24
24
 
@@ -33,9 +33,9 @@ class TimeUtil:
33
33
  """
34
34
  Creates a nicely formated timestamp
35
35
  """
36
- now = datetime.datetime.now()
36
+ now_for_local = datetime.now()
37
37
 
38
- local_now = now.astimezone()
38
+ local_now = now_for_local.astimezone()
39
39
  use_tz = local_now.tzinfo
40
40
 
41
41
  # If the user's machine doesn't care about the time zone,
@@ -44,7 +44,7 @@ class TimeUtil:
44
44
  if local_tzname == "UTC":
45
45
  use_tz = timezone('US/Pacific')
46
46
 
47
- now = datetime.datetime.now(use_tz)
48
- formatted_time = now.strftime("%Y-%m-%d %H:%M:%S %Z%z")
47
+ now_with_tz = datetime.now(use_tz)
48
+ formatted_time = now_with_tz.strftime("%Y-%m-%d %H:%M:%S %Z%z")
49
49
 
50
50
  return formatted_time
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: leaf-common
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: LEAF team common code library
5
5
  Author-email: Dan Fink <Daniel.Fink@cognizant.com>
6
6
  License-Expression: Apache-2.0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes