hdx-python-utilities 3.6.4__tar.gz → 3.6.5__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 (123) hide show
  1. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.config/pre-commit-config.yaml +11 -11
  2. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.config/ruff.toml +8 -5
  3. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.gitignore +2 -0
  4. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/CONTRIBUTING.md +2 -3
  5. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/PKG-INFO +2 -2
  6. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/pyproject.toml +4 -12
  7. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/requirements.txt +26 -23
  8. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/_version.py +2 -2
  9. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/compare.py +7 -4
  10. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/email.py +1 -1
  11. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/loader.py +18 -4
  12. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/compare/test_csv_processing.csv +1 -1
  13. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/compare/test_csv_processing2.csv +1 -1
  14. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_compare.py +1 -1
  15. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_dateparse.py +18 -12
  16. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_downloader.py +2 -2
  17. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_loader.py +1 -1
  18. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_path.py +5 -5
  19. hdx_python_utilities-3.6.4/.config/black.toml +0 -2
  20. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.config/coveragerc +0 -0
  21. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.config/pytest.ini +0 -0
  22. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.github/workflows/publish.yaml +0 -0
  23. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/.github/workflows/run-python-tests.yaml +0 -0
  24. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/LICENSE +0 -0
  25. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/README.md +0 -0
  26. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/documentation/.readthedocs.yaml +0 -0
  27. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/documentation/main.md +0 -0
  28. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/documentation/pydoc-markdown.yaml +0 -0
  29. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/__init__.py +0 -0
  30. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/base_downloader.py +0 -0
  31. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/dateparse.py +0 -0
  32. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/dictandlist.py +0 -0
  33. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/downloader.py +0 -0
  34. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/easy_logging.py +0 -0
  35. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/encoding.py +0 -0
  36. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/errors_onexit.py +0 -0
  37. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/frictionless_wrapper.py +0 -0
  38. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/html.py +0 -0
  39. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/path.py +0 -0
  40. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/retriever.py +0 -0
  41. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/saver.py +0 -0
  42. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/session.py +0 -0
  43. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/state.py +0 -0
  44. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/text.py +0 -0
  45. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/typehint.py +0 -0
  46. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/useragent.py +0 -0
  47. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/src/hdx/utilities/uuid.py +0 -0
  48. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/empty.yaml +0 -0
  49. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/hdx_config.json +0 -0
  50. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/hdx_config.yaml +0 -0
  51. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/hdx_email_configuration.json +0 -0
  52. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/hdx_email_configuration.yaml +0 -0
  53. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/json_csv.yaml +0 -0
  54. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/logging_config.json +0 -0
  55. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/logging_config.yaml +0 -0
  56. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/project_configuration.json +0 -0
  57. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/project_configuration.yaml +0 -0
  58. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/smtp_config.json +0 -0
  59. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/smtp_config.yaml +0 -0
  60. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/user_agent_config.yaml +0 -0
  61. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/user_agent_config2.yaml +0 -0
  62. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/user_agent_config3.yaml +0 -0
  63. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/config/user_agent_config_wrong.yaml +0 -0
  64. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/basicauth.txt +0 -0
  65. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/extra_params.json +0 -0
  66. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/extra_params.yaml +0 -0
  67. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/extra_params_tree.yaml +0 -0
  68. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_csv_processing.csv +0 -0
  69. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_csv_processing_blanks.csv +0 -0
  70. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_data.csv +0 -0
  71. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_data.xlsx +0 -0
  72. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_data1.csv/empty.txt +0 -0
  73. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_data2.csv +0 -0
  74. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_json_processing.json +0 -0
  75. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_xls_processing.xls +0 -0
  76. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/downloader/test_xlsx_processing.xlsx +0 -0
  77. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/html/response.html +0 -0
  78. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/loader/empty.json +0 -0
  79. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/loader/empty.yaml +0 -0
  80. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/fallbacks/test.csv +0 -0
  81. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/fallbacks/test.json +0 -0
  82. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/fallbacks/test.txt +0 -0
  83. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/fallbacks/test.yaml +0 -0
  84. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/retriever-test.csv +0 -0
  85. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/test.csv +0 -0
  86. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/test.json +0 -0
  87. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/test.txt +0 -0
  88. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/test.yaml +0 -0
  89. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/retriever/test_hxl.csv +0 -0
  90. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out.csv +0 -0
  91. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out.json +0 -0
  92. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out2.csv +0 -0
  93. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out2.json +0 -0
  94. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out5.json +0 -0
  95. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out6.json +0 -0
  96. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out7.json +0 -0
  97. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out8.csv +0 -0
  98. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/out8.json +0 -0
  99. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-false_sortkeys-false.json +0 -0
  100. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-false_sortkeys-false.yaml +0 -0
  101. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-false_sortkeys-true.json +0 -0
  102. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-false_sortkeys-true.yaml +0 -0
  103. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-true_sortkeys-false.json +0 -0
  104. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-true_sortkeys-false.yaml +0 -0
  105. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-true_sortkeys-true.json +0 -0
  106. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/saver/pretty-true_sortkeys-true.yaml +0 -0
  107. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/state/analysis_dates.txt +0 -0
  108. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/state/last_build_date.txt +0 -0
  109. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/fixtures/test_data.csv +0 -0
  110. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/conftest.py +0 -0
  111. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_dictandlist.py +0 -0
  112. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_easy_logging.py +0 -0
  113. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_email.py +0 -0
  114. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_encoding.py +0 -0
  115. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_errors_onexit.py +0 -0
  116. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_html.py +0 -0
  117. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_retriever.py +0 -0
  118. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_saver.py +0 -0
  119. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_state.py +0 -0
  120. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_text.py +0 -0
  121. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_useragent.py +0 -0
  122. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/test_uuid.py +0 -0
  123. {hdx_python_utilities-3.6.4 → hdx_python_utilities-3.6.5}/tests/hdx/utilities/utils.py +0 -0
@@ -2,24 +2,24 @@ default_language_version:
2
2
  python: python3.11
3
3
  repos:
4
4
  - repo: https://github.com/pre-commit/pre-commit-hooks
5
- rev: v4.4.0
5
+ rev: v4.5.0
6
6
  hooks:
7
7
  - id: trailing-whitespace
8
+ exclude: test_loader.py
8
9
  - id: end-of-file-fixer
9
- exclude: test_csv_processing_blanks.csv
10
+ exclude: (test_csv_processing_blanks.csv|test.txt)
10
11
  - id: check-ast
11
- - repo: https://github.com/psf/black
12
- rev: 23.3.0
13
- hooks:
14
- - id: black
15
- args: [--config, .config/black.toml]
16
- - repo: https://github.com/charliermarsh/ruff-pre-commit
17
- rev: v0.0.267
12
+ - repo: https://github.com/astral-sh/ruff-pre-commit
13
+ rev: v0.1.14
18
14
  hooks:
15
+ # Run the linter.
19
16
  - id: ruff
20
- args: [--config, .config/ruff.toml, --fix, --exit-non-zero-on-fix]
17
+ args: [--config, .config/ruff.toml, --fix]
18
+ # Run the formatter.
19
+ - id: ruff-format
20
+ args: [--config, .config/ruff.toml]
21
21
  - repo: https://github.com/jazzband/pip-tools
22
- rev: 6.13.0
22
+ rev: 7.3.0
23
23
  hooks:
24
24
  - id: pip-compile
25
25
  name: pip-compile requirements.txt
@@ -1,14 +1,17 @@
1
1
  line-length = 79
2
2
  exclude = ["_version.py"]
3
- ignore = [
4
- "E501" # Line too long
5
- ]
6
- # List of rules: https://beta.ruff.rs/docs/rules/
3
+
4
+ [lint]
5
+ # List of rules: https://docs.astral.sh/ruff/rules/
7
6
  select = [
8
7
  "E", # pycodestyle - default
9
8
  "F", # pyflakes - default
10
9
  "I" # isort
11
10
  ]
11
+ ignore = [
12
+ "E501" # Line too long
13
+ ]
14
+
12
15
 
13
- [isort]
16
+ [lint.isort]
14
17
  known-local-folder = ["hdx"]
@@ -96,3 +96,5 @@ ENV/
96
96
 
97
97
  # hatch-vcs
98
98
  _version.py
99
+
100
+ .vscode/settings.json
@@ -21,14 +21,13 @@ you make a git commit:
21
21
  pre-commit install
22
22
 
23
23
  The configuration file for this project is in a
24
- non-start location. Thus, you will need to edit your
24
+ non-standard location. Thus, you will need to edit your
25
25
  `.git/hooks/pre-commit` file to reflect this. Change
26
26
  the line that begins with `ARGS` to:
27
27
 
28
28
  ARGS=(hook-impl --config=.config/pre-commit-config.yaml --hook-type=pre-commit)
29
29
 
30
30
  With pre-commit, all code is formatted according to
31
- [black]("https://github.com/psf/black") and
32
31
  [ruff]("https://github.com/charliermarsh/ruff") guidelines.
33
32
 
34
33
  To check if your changes pass pre-commit without committing, run:
@@ -41,7 +40,7 @@ To run the tests and view coverage, execute:
41
40
 
42
41
  pytest -c .config/pytest.ini --cov hdx --cov-config .config/coveragerc
43
42
 
44
- Follow the example set out already in ``api.rst`` as you write the documentation.
43
+ Follow the example set out already in ``documentation/main.md`` as you write the documentation.
45
44
 
46
45
  ## Packages
47
46
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hdx-python-utilities
3
- Version: 3.6.4
3
+ Version: 3.6.5
4
4
  Summary: HDX Python Utilities for streaming tabular data, date and time handling and other helpful functions
5
5
  Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-utilities
6
6
  Author-email: Michael Rans <rans@email.com>
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.11
25
25
  Classifier: Programming Language :: Python :: 3.12
26
26
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
27
27
  Requires-Python: >=3.8
28
- Requires-Dist: frictionless>=5.16.0
28
+ Requires-Dist: frictionless>=5.16.1
29
29
  Requires-Dist: ijson>=3.2.3
30
30
  Requires-Dist: jsonlines>=4.0.0
31
31
  Requires-Dist: loguru
@@ -36,7 +36,7 @@ requires-python = ">=3.8"
36
36
  # Extras for frictionless[excel,json] added explicitly
37
37
  # for conda-forge compatibility
38
38
  dependencies = [
39
- "frictionless>=5.16.0",
39
+ "frictionless>=5.16.1",
40
40
  # frictionless[excel]
41
41
  "openpyxl>=3.1.2",
42
42
  "tableschema-to-template>=0.0.13",
@@ -106,18 +106,10 @@ python = ["3.11"]
106
106
 
107
107
  [tool.hatch.envs.lint]
108
108
  detached = true
109
- dependencies = [
110
- "black",
111
- "ruff",
112
- ]
109
+ dependencies = ["ruff"]
113
110
 
114
111
  [tool.hatch.envs.lint.scripts]
115
112
  style = [
116
- "ruff --config .config/ruff.toml {args:.}",
117
- "black --config .config/black.toml --check --diff {args:.}",
118
- ]
119
- # Not used for anything at the moment
120
- fmt = [
121
- "black --config .config/black.toml {args:.}",
122
- "ruff --config .config/ruff.toml --fix {args:.}",
113
+ "ruff check --config .config/ruff.toml --diff {args:.}",
114
+ "ruff format --config .config/ruff.toml --diff {args:.}",
123
115
  ]
@@ -2,18 +2,18 @@
2
2
  # This file is autogenerated by pip-compile with Python 3.11
3
3
  # by the following command:
4
4
  #
5
- # pip-compile --all-extras --output-file=requirements.txt --resolver=backtracking pyproject.toml
5
+ # pip-compile --all-extras --output-file=requirements.txt pyproject.toml
6
6
  #
7
7
  annotated-types==0.6.0
8
8
  # via pydantic
9
- attrs==23.1.0
9
+ attrs==23.2.0
10
10
  # via
11
11
  # frictionless
12
12
  # jsonlines
13
13
  # jsonschema
14
- beautifulsoup4==4.12.2
14
+ beautifulsoup4==4.12.3
15
15
  # via hdx-python-utilities (pyproject.toml)
16
- certifi==2023.11.17
16
+ certifi==2024.2.2
17
17
  # via requests
18
18
  cfgv==3.4.0
19
19
  # via pre-commit
@@ -25,11 +25,13 @@ click==8.1.7
25
25
  # via typer
26
26
  colorama==0.4.6
27
27
  # via typer
28
- coverage[toml]==7.3.2
29
- # via pytest-cov
28
+ coverage[toml]==7.4.1
29
+ # via
30
+ # coverage
31
+ # pytest-cov
30
32
  distlib==0.3.8
31
33
  # via virtualenv
32
- dnspython==2.4.2
34
+ dnspython==2.5.0
33
35
  # via email-validator
34
36
  email-validator==2.1.0.post1
35
37
  # via hdx-python-utilities (pyproject.toml)
@@ -37,13 +39,13 @@ et-xmlfile==1.1.0
37
39
  # via openpyxl
38
40
  filelock==3.13.1
39
41
  # via virtualenv
40
- frictionless==5.16.0
42
+ frictionless==5.16.1
41
43
  # via hdx-python-utilities (pyproject.toml)
42
44
  html5lib==1.1
43
45
  # via hdx-python-utilities (pyproject.toml)
44
46
  humanize==4.9.0
45
47
  # via frictionless
46
- identify==2.5.33
48
+ identify==2.5.34
47
49
  # via pre-commit
48
50
  idna==3.6
49
51
  # via
@@ -55,7 +57,7 @@ iniconfig==2.0.0
55
57
  # via pytest
56
58
  isodate==0.6.1
57
59
  # via frictionless
58
- jinja2==3.1.2
60
+ jinja2==3.1.3
59
61
  # via frictionless
60
62
  jsonlines==4.0.0
61
63
  # via hdx-python-utilities (pyproject.toml)
@@ -71,7 +73,7 @@ markdown-it-py==3.0.0
71
73
  # via rich
72
74
  marko==2.0.2
73
75
  # via frictionless
74
- markupsafe==2.1.3
76
+ markupsafe==2.1.5
75
77
  # via jinja2
76
78
  mdurl==0.1.2
77
79
  # via markdown-it-py
@@ -83,21 +85,21 @@ packaging==23.2
83
85
  # via pytest
84
86
  petl==1.7.14
85
87
  # via frictionless
86
- platformdirs==4.1.0
88
+ platformdirs==4.2.0
87
89
  # via virtualenv
88
- pluggy==1.3.0
90
+ pluggy==1.4.0
89
91
  # via pytest
90
- pre-commit==3.6.0
92
+ pre-commit==3.6.1
91
93
  # via hdx-python-utilities (pyproject.toml)
92
- pydantic==2.5.2
94
+ pydantic==2.6.1
93
95
  # via frictionless
94
- pydantic-core==2.14.5
96
+ pydantic-core==2.16.2
95
97
  # via pydantic
96
98
  pygments==2.17.2
97
99
  # via rich
98
100
  pyrsistent==0.20.0
99
101
  # via jsonschema
100
- pytest==7.4.3
102
+ pytest==8.0.0
101
103
  # via
102
104
  # hdx-python-utilities (pyproject.toml)
103
105
  # pytest-cov
@@ -110,7 +112,7 @@ python-dateutil==2.8.2
110
112
  # via
111
113
  # frictionless
112
114
  # hdx-python-utilities (pyproject.toml)
113
- python-slugify==8.0.1
115
+ python-slugify==8.0.4
114
116
  # via frictionless
115
117
  pyyaml==6.0.1
116
118
  # via
@@ -123,13 +125,13 @@ requests==2.31.0
123
125
  # via
124
126
  # frictionless
125
127
  # requests-file
126
- requests-file==1.5.1
128
+ requests-file==2.0.0
127
129
  # via hdx-python-utilities (pyproject.toml)
128
130
  rfc3986==2.0.0
129
131
  # via frictionless
130
132
  rich==13.7.0
131
133
  # via typer
132
- ruamel-yaml==0.18.5
134
+ ruamel-yaml==0.18.6
133
135
  # via hdx-python-utilities (pyproject.toml)
134
136
  ruamel-yaml-clib==0.2.8
135
137
  # via ruamel-yaml
@@ -142,7 +144,6 @@ six==1.16.0
142
144
  # html5lib
143
145
  # isodate
144
146
  # python-dateutil
145
- # requests-file
146
147
  soupsieve==2.5
147
148
  # via beautifulsoup4
148
149
  stringcase==1.2.0
@@ -154,14 +155,16 @@ tabulate==0.9.0
154
155
  text-unidecode==1.3
155
156
  # via python-slugify
156
157
  typer[all]==0.9.0
157
- # via frictionless
158
+ # via
159
+ # frictionless
160
+ # typer
158
161
  typing-extensions==4.9.0
159
162
  # via
160
163
  # frictionless
161
164
  # pydantic
162
165
  # pydantic-core
163
166
  # typer
164
- urllib3==2.1.0
167
+ urllib3==2.2.0
165
168
  # via requests
166
169
  validators==0.22.0
167
170
  # via frictionless
@@ -12,5 +12,5 @@ __version__: str
12
12
  __version_tuple__: VERSION_TUPLE
13
13
  version_tuple: VERSION_TUPLE
14
14
 
15
- __version__ = version = '3.6.4'
16
- __version_tuple__ = version_tuple = (3, 6, 4)
15
+ __version__ = version = '3.6.5'
16
+ __version_tuple__ = version_tuple = (3, 6, 5)
@@ -4,7 +4,9 @@ from os import linesep
4
4
  from typing import List
5
5
 
6
6
 
7
- def compare_files(path1: str, path2: str) -> List[str]:
7
+ def compare_files(
8
+ path1: str, path2: str, encoding: str = "utf-8"
9
+ ) -> List[str]:
8
10
  """Returns the delta between two files using -, ?, + format excluding lines
9
11
  that are the same.
10
12
 
@@ -16,12 +18,13 @@ def compare_files(path1: str, path2: str) -> List[str]:
16
18
  List[str]: Delta between the two files
17
19
  """
18
20
  diff = difflib.ndiff(
19
- open(path1).read().splitlines(), open(path2).read().splitlines()
21
+ open(path1, encoding=encoding).read().splitlines(),
22
+ open(path2, encoding=encoding).read().splitlines(),
20
23
  )
21
24
  return [x for x in diff if x[0] in ["-", "+", "?"]]
22
25
 
23
26
 
24
- def assert_files_same(path1: str, path2: str) -> None:
27
+ def assert_files_same(path1: str, path2: str, encoding: str = "utf-8") -> None:
25
28
  """Asserts that two files are the same and returns delta using.
26
29
 
27
30
  -, ?, + format if not
@@ -33,5 +36,5 @@ def assert_files_same(path1: str, path2: str) -> None:
33
36
  Returns:
34
37
  None
35
38
  """
36
- difflines = compare_files(path1, path2)
39
+ difflines = compare_files(path1, path2, encoding)
37
40
  assert len(difflines) == 0, linesep.join([linesep] + difflines)
@@ -151,7 +151,7 @@ class Email:
151
151
 
152
152
  @staticmethod
153
153
  def get_normalised_emails(
154
- recipients: Union[str, ListTuple[str]]
154
+ recipients: Union[str, ListTuple[str]],
155
155
  ) -> List[str]:
156
156
  """Get list of normalised emails.
157
157
 
@@ -1,8 +1,8 @@
1
1
  """Loading utilities for YAML, JSON etc."""
2
2
 
3
3
  import json
4
- from os import linesep
5
4
  from typing import Any, Dict, Optional
5
+ from warnings import warn
6
6
 
7
7
  from ruamel.yaml import YAML
8
8
 
@@ -19,7 +19,9 @@ def load_text(
19
19
  encoding: str = "utf-8",
20
20
  strip: bool = False,
21
21
  replace_newlines: Optional[str] = None,
22
+ replace_line_separators: Optional[str] = None,
22
23
  loaderror_if_empty: bool = True,
24
+ default_line_separator: str = "\n",
23
25
  ) -> str:
24
26
  """Load file into a string removing newlines.
25
27
 
@@ -27,16 +29,28 @@ def load_text(
27
29
  path (str): Path to file
28
30
  encoding (str): Encoding of file. Defaults to utf-8.
29
31
  strip (bool): Whether to strip whitespace from start and end. Defaults to False.
30
- replace_newlines (Optional[str]): String with which tp replace newlines. Defaults to None (don't replace).
32
+ replace_newlines (Optional[str]): String with which to replace newlines. Defaults to None (don't replace). (deprecated 2024-02-07)
33
+ replace_line_separators (Optional[str]): String with which to replace newlines. Defaults to None (don't replace).
31
34
  loaderror_if_empty (bool): Whether to raise LoadError if file is empty. Default to True.
35
+ default_line_separator (str): line separator to be replaced if replace_line_separators is not None
32
36
 
33
37
  Returns:
34
38
  str: String contents of file
35
39
  """
40
+ if replace_newlines is not None:
41
+ warn(
42
+ "Keyword argument 'replace_newlines' to 'load_text' is deprecated on 2024-02-08 "
43
+ "in favour of 'replace_line_separators'",
44
+ DeprecationWarning,
45
+ stacklevel=2,
46
+ )
47
+ replace_line_separators = replace_newlines
36
48
  with open(path, encoding=encoding) as f:
37
49
  string = f.read()
38
- if replace_newlines is not None:
39
- string = string.replace(linesep, replace_newlines)
50
+ if replace_line_separators is not None:
51
+ string = string.replace(
52
+ default_line_separator, replace_line_separators
53
+ )
40
54
  if strip:
41
55
  string = string.strip()
42
56
  if not string:
@@ -1,4 +1,4 @@
1
- la1 ,ha1 ,ba1 ,ma1
1
+ la1 ,hä1 ,ba1 ,ma1
2
2
  header1,header2,header3,header4
3
3
  coal ,3 ,7.4 ,'needed'
4
4
  gas ,2 ,6.5 ,'n/a'
@@ -1,4 +1,4 @@
1
- la1 ,ha1 ,ba1 ,ma1
1
+ la1 ,hä1 ,ba1 ,ma1
2
2
  header1,header2,header3,header4
3
3
  coal ,1 ,7.4 ,'notneeded'
4
4
  gas ,2 ,6.5 ,'n/a'
@@ -16,7 +16,7 @@ class TestCompare:
16
16
  return join(fixturesfolder, "compare", "test_csv_processing2.csv")
17
17
 
18
18
  def test_compare_files(self, testfile1, testfile2):
19
- result = compare_files(testfile1, testfile2)
19
+ result = compare_files(testfile1, testfile2, encoding="utf-8")
20
20
  assert result == [
21
21
  "- coal ,3 ,7.4 ,'needed'",
22
22
  "? ^\n",
@@ -23,28 +23,32 @@ class TestDateParse:
23
23
  )
24
24
 
25
25
  def test_parse_date_range(self):
26
- result = datetime(2013, 2, 10, 0, 0, tzinfo=timezone.utc), datetime(
27
- 2013, 2, 10, 0, 0, tzinfo=timezone.utc
26
+ result = (
27
+ datetime(2013, 2, 10, 0, 0, tzinfo=timezone.utc),
28
+ datetime(2013, 2, 10, 0, 0, tzinfo=timezone.utc),
28
29
  )
29
30
  assert parse_date_range("10/02/2013") == result
30
31
  assert parse_date_range("2013/02/10") == result
31
- result = datetime(2013, 2, 20, 10, 0, tzinfo=timezone.utc), datetime(
32
- 2013, 2, 20, 10, 0, tzinfo=timezone.utc
32
+ result = (
33
+ datetime(2013, 2, 20, 10, 0, tzinfo=timezone.utc),
34
+ datetime(2013, 2, 20, 10, 0, tzinfo=timezone.utc),
33
35
  )
34
36
  assert parse_date_range("20/02/2013 10:00:00") == result
35
37
  assert (
36
38
  parse_date_range("20/02/2013 10:00:00", "%d/%m/%Y %H:%M:%S")
37
39
  == result
38
40
  )
39
- result = datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc), datetime(
40
- 2013, 2, 20, 0, 0, tzinfo=timezone.utc
41
+ result = (
42
+ datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc),
43
+ datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc),
41
44
  )
42
45
  assert parse_date_range("20/02/2013") == result
43
46
  assert (
44
47
  parse_date_range("20/02/2013 10:00:00", zero_time=True) == result
45
48
  )
46
- result2 = datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc), datetime(
47
- 2013, 2, 20, 23, 59, 59, tzinfo=timezone.utc
49
+ result2 = (
50
+ datetime(2013, 2, 20, 0, 0, tzinfo=timezone.utc),
51
+ datetime(2013, 2, 20, 23, 59, 59, tzinfo=timezone.utc),
48
52
  )
49
53
  assert (
50
54
  parse_date_range(
@@ -103,8 +107,9 @@ class TestDateParse:
103
107
  )
104
108
  fuzzyresult["nondate"] = None
105
109
  assert fuzzy == fuzzyresult
106
- result = datetime(2013, 2, 1, 0, 0, tzinfo=timezone.utc), datetime(
107
- 2013, 2, 28, 0, 0, tzinfo=timezone.utc
110
+ result = (
111
+ datetime(2013, 2, 1, 0, 0, tzinfo=timezone.utc),
112
+ datetime(2013, 2, 28, 0, 0, tzinfo=timezone.utc),
108
113
  )
109
114
  assert parse_date_range("02/2013") == result
110
115
  assert parse_date_range("02/2013", "%m/%Y") == result
@@ -119,8 +124,9 @@ class TestDateParse:
119
124
  "nondate": ("date is ", " for this test"),
120
125
  "date": ("02/2013",),
121
126
  }
122
- result = datetime(2013, 1, 1, 0, 0, tzinfo=timezone.utc), datetime(
123
- 2013, 12, 31, 0, 0, tzinfo=timezone.utc
127
+ result = (
128
+ datetime(2013, 1, 1, 0, 0, tzinfo=timezone.utc),
129
+ datetime(2013, 12, 31, 0, 0, tzinfo=timezone.utc),
124
130
  )
125
131
  assert parse_date_range("2013") == result
126
132
  assert parse_date_range("2013", "%Y") == result
@@ -403,7 +403,7 @@ class TestDownloader:
403
403
  filename=filename,
404
404
  )
405
405
  fpath = abspath(f)
406
- with open(fpath) as fi:
406
+ with open(fpath, encoding="utf-8") as fi:
407
407
  text = fi.read()
408
408
  assert '"id": "10"' in text
409
409
  assert '"lala": "a"' in text
@@ -419,7 +419,7 @@ class TestDownloader:
419
419
  filename=filename,
420
420
  )
421
421
  fpath = abspath(f)
422
- with open(fpath) as fi:
422
+ with open(fpath, encoding="utf-8") as fi:
423
423
  text = fi.read()
424
424
  assert '"id": "3"' in text
425
425
  assert '"lala": "b"' in text
@@ -172,7 +172,7 @@ test"""
172
172
  assert result == TestLoader.text
173
173
  result = load_text(text_file, strip=True)
174
174
  assert result == TestLoader.expected_text_strip
175
- result = load_text(text_file, replace_newlines=" ")
175
+ result = load_text(text_file, replace_line_separators=" ")
176
176
  assert result == TestLoader.expected_text_newlines_to_spaces
177
177
  with pytest.raises(IOError):
178
178
  load_text(join(tmpdir, "NOTEXIST.txt"))
@@ -272,7 +272,7 @@ class TestPath:
272
272
  (
273
273
  0,
274
274
  {
275
- "folder": "/tmp/gaga/0",
275
+ "folder": join(expected_dir, "0"),
276
276
  "batch": "1234",
277
277
  "progress": "emergency_id=911",
278
278
  },
@@ -281,7 +281,7 @@ class TestPath:
281
281
  (
282
282
  1,
283
283
  {
284
- "folder": "/tmp/gaga/1",
284
+ "folder": join(expected_dir, "1"),
285
285
  "batch": "1234",
286
286
  "progress": "iso3=AFG",
287
287
  },
@@ -290,7 +290,7 @@ class TestPath:
290
290
  (
291
291
  1,
292
292
  {
293
- "folder": "/tmp/gaga/1",
293
+ "folder": join(expected_dir, "1"),
294
294
  "batch": "1234",
295
295
  "progress": "iso3=SDN",
296
296
  },
@@ -299,7 +299,7 @@ class TestPath:
299
299
  (
300
300
  1,
301
301
  {
302
- "folder": "/tmp/gaga/1",
302
+ "folder": join(expected_dir, "1"),
303
303
  "batch": "1234",
304
304
  "progress": "iso3=YEM",
305
305
  },
@@ -308,7 +308,7 @@ class TestPath:
308
308
  (
309
309
  1,
310
310
  {
311
- "folder": "/tmp/gaga/1",
311
+ "folder": join(expected_dir, "1"),
312
312
  "batch": "1234",
313
313
  "progress": "iso3=ZAM",
314
314
  },
@@ -1,2 +0,0 @@
1
- [tool.black]
2
- line-length = 79