django-auth-recovery-codes 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

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 django-auth-recovery-codes might be problematic. Click here for more details.

@@ -1,9 +1,6 @@
1
1
  import logging
2
- from typing import Any
3
2
  from uuid import UUID
4
3
 
5
- from django.utils.timezone import localtime
6
- from datetime import date, datetime
7
4
 
8
5
  from django_auth_recovery_codes.models import RecoveryCodesBatch
9
6
  from django_auth_recovery_codes.utils.errors.enforcer import enforce_types
@@ -118,22 +115,6 @@ class PurgedStatsCollector:
118
115
  batch.user.id, batch.id, purged_count
119
116
  )
120
117
 
121
- def _format_datetime(self, value: Any) -> Any:
122
- """Return a timezone-aware ISO string for datetime, or None."""
123
-
124
- if isinstance(value, datetime):
125
- return localtime(value).isoformat()
126
- if isinstance(value, date):
127
- return value.isoformat()
128
- return None
129
-
130
- def _to_json_safe(self, value: Any) -> Any:
131
- """Convert datetimes and UUIDs into serialisable string forms."""
132
- if isinstance(value, datetime):
133
- return self._format_datetime(value)
134
- if isinstance(value, UUID):
135
- return str(value)
136
- return value
137
118
 
138
119
  def _generate_purged_batch_code_json_report(self, batch: RecoveryCodesBatch, purged_count: int, is_empty: bool, batch_id: UUID) -> dict:
139
120
  """
@@ -200,23 +181,23 @@ class PurgedStatsCollector:
200
181
  """
201
182
 
202
183
  purged_batch_info = {
203
- "id": self._to_json_safe(batch_id),
204
- "number_issued": batch.number_issued,
205
- "number_removed": purged_count,
206
- "is_batch_empty": bool(is_empty),
207
- "number_used": batch.number_used,
208
- "number_remaining_in_batch": batch.active_codes_remaining,
209
- "user_issued_to": getattr(batch.user, "username", str(batch.user) if batch.user else None),
210
- "batch_creation_date": self._to_json_safe(batch.created_at),
211
- "last_modified": self._to_json_safe(batch.modified_at),
212
- "expiry_date": self._to_json_safe(batch.expiry_date),
213
- "deleted_at": self._to_json_safe(batch.deleted_at),
214
- "deleted_by": getattr(batch.deleted_by, "username", str(batch.deleted_by) if batch.deleted_by else None),
215
- "was_codes_downloaded": bool(batch.downloaded),
216
- "was_codes_viewed": bool(batch.viewed),
217
- "was_codes_email": bool(batch.emailed),
218
- "was_code_generated": bool(batch.generated),
219
- }
184
+ "id": batch_id,
185
+ "number_issued": batch.number_issued,
186
+ "number_removed": purged_count,
187
+ "is_batch_empty": bool(is_empty),
188
+ "number_used": batch.number_used,
189
+ "number_remaining_in_batch": batch.active_codes_remaining,
190
+ "user_issued_to": getattr(batch.user, "username", str(batch.user) if batch.user else None),
191
+ "batch_creation_date": batch.created_at,
192
+ "last_modified": batch.modified_at,
193
+ "expiry_date": batch.expiry_date,
194
+ "deleted_at": batch.deleted_at,
195
+ "deleted_by": batch.deleted_by,
196
+ "was_codes_downloaded": bool(batch.downloaded),
197
+ "was_codes_viewed": bool(batch.viewed),
198
+ "was_codes_email": bool(batch.emailed),
199
+ "was_code_generated": bool(batch.generated),
200
+ }
220
201
 
221
202
  self.batches_report.append(purged_batch_info)
222
203
  return purged_batch_info
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-auth-recovery-codes
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: Django app for 2FA recovery codes
5
5
  Home-page: https://github.com/EgbieAndersonUku1/django_2fa_recovery_codes
6
6
  Author: Egbie Uku
@@ -24,6 +24,11 @@ Requires-Dist: soupsieve>=2.7
24
24
  Requires-Dist: sqlparse>=0.5
25
25
  Requires-Dist: typing_extensions>=4.14
26
26
  Requires-Dist: tzdata>=2025.2
27
+ Provides-Extra: dev
28
+ Requires-Dist: black; extra == "dev"
29
+ Requires-Dist: flake8; extra == "dev"
30
+ Requires-Dist: pytest; extra == "dev"
31
+ Requires-Dist: types-python-dateutil; extra == "dev"
27
32
  Dynamic: author
28
33
  Dynamic: author-email
29
34
  Dynamic: home-page
@@ -1617,6 +1622,12 @@ pip install django
1617
1622
  pip install django_auth_recovery_codes
1618
1623
  ```
1619
1624
 
1625
+ You can install the package with:
1626
+
1627
+ [`pip install django-auth-recovery-codes`](https://pypi.org/project/django-auth-recovery-codes/1.0.0/)
1628
+
1629
+
1630
+
1620
1631
  ### 6. Verify installation
1621
1632
 
1622
1633
  ```bash
@@ -7,7 +7,7 @@ django_auth_recovery_codes/checks.py,sha256=UD22TQtsbROiUzA62DrfnOi8iZ6UT-ghuk0b
7
7
  django_auth_recovery_codes/conf.py,sha256=P0g2atBlvoJJNiNzSj9RWZiKJjwJ2kaUwzHJ1G1oJpw,12482
8
8
  django_auth_recovery_codes/context_processors.py,sha256=auTpXfWw6AmJXHsKMvFbhUINWLqXLWmoDv27vOXV430,276
9
9
  django_auth_recovery_codes/enums.py,sha256=w8PyZk9P3sUStYGO77zW4PN6DYU6FHdI7dEAwZ9pI8g,1980
10
- django_auth_recovery_codes/helpers.py,sha256=f0YTa-tppUEU0t8bjgoxzXFwoy6_0rGQD_9uGcQGsRw,9914
10
+ django_auth_recovery_codes/helpers.py,sha256=BKyJwhTAGC_APfRg1anV_V-BnJQqAQrIdIwYRLGEZYg,9081
11
11
  django_auth_recovery_codes/models.py,sha256=0n4_ihskfxWX6Ev31KHYX04_l_ucNWzJfYKHlqq-b8o,96836
12
12
  django_auth_recovery_codes/models_choices.py,sha256=pyHb83-1tuCrWNoM1oIU7Owtpi9thKNVfv5kOwp-Qxw,291
13
13
  django_auth_recovery_codes/signals.py,sha256=AFAcSVu3kAGwrtV2l4F0FwBA7JELvsLv9RbnLDOEBW8,5710
@@ -5798,8 +5798,8 @@ django_auth_recovery_codes/utils/exporters/file_converters.py,sha256=TVRcLr-2Vgh
5798
5798
  django_auth_recovery_codes/utils/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5799
5799
  django_auth_recovery_codes/utils/security/generator.py,sha256=9kT40YddxioylQuOMwbif-RCM-BFrYBBCmZ4tLaP4Fc,4993
5800
5800
  django_auth_recovery_codes/utils/security/hash.py,sha256=EFYBdLsUgOHWbTe7MghGDrUxE7oafgDRY2IL4bjKn6Q,2680
5801
- django_auth_recovery_codes-1.0.0.dist-info/licenses/LICENSE,sha256=BvizeN100YXjms404P-KX6Glx35wY3Ak_guK1SCQQuw,1085
5802
- django_auth_recovery_codes-1.0.0.dist-info/METADATA,sha256=ahYNXnMN7RAlmOnDlLYl6whwztqyFvr73TyEKVAei_o,108002
5803
- django_auth_recovery_codes-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5804
- django_auth_recovery_codes-1.0.0.dist-info/top_level.txt,sha256=1a1TlG4RcYLPkmy5_Ver6LAuaq1ukelvyhft-KENVKA,27
5805
- django_auth_recovery_codes-1.0.0.dist-info/RECORD,,
5801
+ django_auth_recovery_codes-1.0.1.dist-info/licenses/LICENSE,sha256=BvizeN100YXjms404P-KX6Glx35wY3Ak_guK1SCQQuw,1085
5802
+ django_auth_recovery_codes-1.0.1.dist-info/METADATA,sha256=j6fdWI2NN4K-iUefbodTAfuDINYs0A7Wjx5NR7LxX2Q,108340
5803
+ django_auth_recovery_codes-1.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5804
+ django_auth_recovery_codes-1.0.1.dist-info/top_level.txt,sha256=1a1TlG4RcYLPkmy5_Ver6LAuaq1ukelvyhft-KENVKA,27
5805
+ django_auth_recovery_codes-1.0.1.dist-info/RECORD,,