comb-utils 0.5.2__tar.gz → 0.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comb_utils
3
- Version: 0.5.2
3
+ Version: 0.6.3
4
4
  Summary: Handy utils for Python projects.
5
5
  Author: Kaleb Coberly
6
6
  Maintainer-email: kaleb.coberly@gmail.com
@@ -25,6 +25,7 @@ Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
25
25
  Provides-Extra: qc
26
26
  Requires-Dist: bandit; extra == "qc"
27
27
  Requires-Dist: black; extra == "qc"
28
+ Requires-Dist: comb_utils[test]; extra == "qc"
28
29
  Requires-Dist: flake8; extra == "qc"
29
30
  Requires-Dist: flake8-annotations; extra == "qc"
30
31
  Requires-Dist: flake8-bandit; extra == "qc"
@@ -33,10 +34,10 @@ Requires-Dist: flake8-bugbear; extra == "qc"
33
34
  Requires-Dist: flake8-docstrings; extra == "qc"
34
35
  Requires-Dist: flake8-isort; extra == "qc"
35
36
  Requires-Dist: isort; extra == "qc"
36
- Requires-Dist: jake; extra == "qc"
37
- Requires-Dist: pytype; extra == "qc"
38
- Requires-Dist: comb_utils[test]; extra == "qc"
37
+ Requires-Dist: mypy; extra == "qc"
38
+ Requires-Dist: pip-audit; extra == "qc"
39
39
  Requires-Dist: safety; extra == "qc"
40
+ Requires-Dist: types-requests; extra == "qc"
40
41
  Provides-Extra: test
41
42
  Requires-Dist: coverage[toml]; extra == "test"
42
43
  Requires-Dist: pytest; extra == "test"
@@ -136,6 +137,14 @@ When making smaller commits, you might just want to run some of the smaller comm
136
137
  $ make clean format full-qc full-test
137
138
  ```
138
139
 
140
+ #### Type checking
141
+
142
+ This project uses [mypy](https://mypy-lang.org) for type checking. Run it with:
143
+
144
+ ```bash
145
+ $ make typecheck
146
+ ```
147
+
139
148
  #### Using act
140
149
 
141
150
  As a final step, it's good practice to test run the workflow before opening a PR or pushing to an open PR. We don't want to waste GitHub runtime on a glitch that we could have caught before. You can use a make target for that:
@@ -91,6 +91,14 @@ When making smaller commits, you might just want to run some of the smaller comm
91
91
  $ make clean format full-qc full-test
92
92
  ```
93
93
 
94
+ #### Type checking
95
+
96
+ This project uses [mypy](https://mypy-lang.org) for type checking. Run it with:
97
+
98
+ ```bash
99
+ $ make typecheck
100
+ ```
101
+
94
102
  #### Using act
95
103
 
96
104
  As a final step, it's good practice to test run the workflow before opening a PR or pushing to an open PR. We don't want to waste GitHub runtime on a glitch that we could have caught before. You can use a make target for that:
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = comb_utils
3
- version = 0.5.2
3
+ version = 0.6.3
4
4
  description = Handy utils for Python projects.
5
5
  long_description = file: README.md
6
6
  long_description_content_type = text/markdown
@@ -20,6 +20,9 @@ install_requires =
20
20
  [options.packages.find]
21
21
  where = src
22
22
 
23
+ [options.package_data]
24
+ comb_utils = py.typed
25
+
23
26
  [options.extras_require]
24
27
  dev =
25
28
  comb_utils[build]
@@ -37,6 +40,7 @@ doc =
37
40
  qc =
38
41
  bandit
39
42
  black
43
+ comb_utils[test]
40
44
  flake8
41
45
  flake8-annotations
42
46
  flake8-bandit
@@ -45,10 +49,10 @@ qc =
45
49
  flake8-docstrings
46
50
  flake8-isort
47
51
  isort
48
- jake
49
- pytype
50
- comb_utils[test]
52
+ mypy
53
+ pip-audit
51
54
  safety
55
+ types-requests
52
56
  test =
53
57
  coverage[toml]
54
58
  pytest
@@ -1,8 +1,8 @@
1
1
  """Classes for making API calls."""
2
2
 
3
3
  import logging
4
- from abc import abstractmethod
5
- from collections.abc import Callable
4
+ from abc import ABC, abstractmethod
5
+ from collections.abc import Callable as _Callable
6
6
  from time import sleep
7
7
  from typing import Any
8
8
  from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
23
23
  # Why are we using _set_request_call instead of the _request_call property?
24
24
 
25
25
 
26
- class BaseCaller:
26
+ class BaseCaller(ABC):
27
27
  """An abstract class for making API calls.
28
28
 
29
29
  See :doc:`api_callers`.
@@ -82,7 +82,7 @@ class BaseCaller:
82
82
 
83
83
  # Must set in child class with _set*:
84
84
  #: The requests call method. (get, post, etc.)
85
- _request_call: Callable
85
+ _request_call: _Callable[..., requests.Response]
86
86
  #: The URL for the API call.
87
87
  _url: str
88
88
 
@@ -208,12 +208,12 @@ class BaseCaller:
208
208
  )
209
209
 
210
210
  @typechecked
211
- def _get_API_key(self) -> str | None:
211
+ def _get_API_key(self) -> str:
212
212
  """Get the API key.
213
213
 
214
214
  Defaults to None, but can be overridden in child class.
215
215
  """
216
- return None
216
+ return ""
217
217
 
218
218
  @typechecked
219
219
  def _handle_429(self) -> None:
@@ -394,8 +394,10 @@ class BasePagedResponseGetter(BaseGetCaller):
394
394
  f"Duplicate entries found in query string: {duplicate_entries}"
395
395
  )
396
396
 
397
- query_params = {key: val[0] for key, val in query_params.items()}
398
- updated_query = urlencode(query_params)
397
+ query_params_flat: dict[str, str] = {
398
+ key: val[0] for key, val in query_params.items()
399
+ }
400
+ updated_query = urlencode(query_params_flat)
399
401
  self._page_url = urlunparse(parsed_url._replace(query=updated_query))
400
402
 
401
403
  @typechecked
@@ -455,7 +457,7 @@ def get_responses(
455
457
  A list of dictionaries containing the responses from all pages.
456
458
  """
457
459
  # Calling the token salsa to trick bandit into ignoring what looks like a hardcoded token.
458
- next_page_salsa = ""
460
+ next_page_salsa: str | None = ""
459
461
  next_page_cookie = ""
460
462
  responses = []
461
463
 
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: comb_utils
3
- Version: 0.5.2
3
+ Version: 0.6.3
4
4
  Summary: Handy utils for Python projects.
5
5
  Author: Kaleb Coberly
6
6
  Maintainer-email: kaleb.coberly@gmail.com
@@ -25,6 +25,7 @@ Requires-Dist: sphinx-autodoc-typehints; extra == "doc"
25
25
  Provides-Extra: qc
26
26
  Requires-Dist: bandit; extra == "qc"
27
27
  Requires-Dist: black; extra == "qc"
28
+ Requires-Dist: comb_utils[test]; extra == "qc"
28
29
  Requires-Dist: flake8; extra == "qc"
29
30
  Requires-Dist: flake8-annotations; extra == "qc"
30
31
  Requires-Dist: flake8-bandit; extra == "qc"
@@ -33,10 +34,10 @@ Requires-Dist: flake8-bugbear; extra == "qc"
33
34
  Requires-Dist: flake8-docstrings; extra == "qc"
34
35
  Requires-Dist: flake8-isort; extra == "qc"
35
36
  Requires-Dist: isort; extra == "qc"
36
- Requires-Dist: jake; extra == "qc"
37
- Requires-Dist: pytype; extra == "qc"
38
- Requires-Dist: comb_utils[test]; extra == "qc"
37
+ Requires-Dist: mypy; extra == "qc"
38
+ Requires-Dist: pip-audit; extra == "qc"
39
39
  Requires-Dist: safety; extra == "qc"
40
+ Requires-Dist: types-requests; extra == "qc"
40
41
  Provides-Extra: test
41
42
  Requires-Dist: coverage[toml]; extra == "test"
42
43
  Requires-Dist: pytest; extra == "test"
@@ -136,6 +137,14 @@ When making smaller commits, you might just want to run some of the smaller comm
136
137
  $ make clean format full-qc full-test
137
138
  ```
138
139
 
140
+ #### Type checking
141
+
142
+ This project uses [mypy](https://mypy-lang.org) for type checking. Run it with:
143
+
144
+ ```bash
145
+ $ make typecheck
146
+ ```
147
+
139
148
  #### Using act
140
149
 
141
150
  As a final step, it's good practice to test run the workflow before opening a PR or pushing to an open PR. We don't want to waste GitHub runtime on a glitch that we could have caught before. You can use a make target for that:
@@ -3,6 +3,7 @@ README.md
3
3
  pyproject.toml
4
4
  setup.cfg
5
5
  src/comb_utils/__init__.py
6
+ src/comb_utils/py.typed
6
7
  src/comb_utils.egg-info/PKG-INFO
7
8
  src/comb_utils.egg-info/SOURCES.txt
8
9
  src/comb_utils.egg-info/dependency_links.txt
@@ -20,6 +20,7 @@ sphinx-autodoc-typehints
20
20
  [qc]
21
21
  bandit
22
22
  black
23
+ comb_utils[test]
23
24
  flake8
24
25
  flake8-annotations
25
26
  flake8-bandit
@@ -28,10 +29,10 @@ flake8-bugbear
28
29
  flake8-docstrings
29
30
  flake8-isort
30
31
  isort
31
- jake
32
- pytype
33
- comb_utils[test]
32
+ mypy
33
+ pip-audit
34
34
  safety
35
+ types-requests
35
36
 
36
37
  [test]
37
38
  coverage[toml]
File without changes
File without changes