etlplus 0.10.1__py3-none-any.whl → 0.10.2__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.
etlplus/enums.py CHANGED
@@ -524,6 +524,7 @@ def coerce_http_method(
524
524
 
525
525
  def infer_file_format_and_compression(
526
526
  value: object,
527
+ filename: object | None = None,
527
528
  ) -> tuple[FileFormat | None, CompressionFormat | None]:
528
529
  """
529
530
  Infer data format and compression from a filename, extension, or MIME type.
@@ -532,6 +533,9 @@ def infer_file_format_and_compression(
532
533
  ----------
533
534
  value : object
534
535
  A filename, extension, MIME type, or existing enum member.
536
+ filename : object | None, optional
537
+ A filename to consult for extension-based inference (e.g. when
538
+ ``value`` is ``application/octet-stream``).
535
539
 
536
540
  Returns
537
541
  -------
@@ -555,7 +559,25 @@ def infer_file_format_and_compression(
555
559
  compression = CompressionFormat.try_coerce(mime)
556
560
  fmt = FileFormat.try_coerce(mime)
557
561
 
558
- suffixes = PurePath(text).suffixes
562
+ is_mime = mime.startswith(
563
+ (
564
+ 'application/',
565
+ 'text/',
566
+ 'audio/',
567
+ 'image/',
568
+ 'video/',
569
+ 'multipart/',
570
+ ),
571
+ )
572
+ suffix_source: object | None = filename if filename is not None else text
573
+ if is_mime and filename is None:
574
+ suffix_source = None
575
+
576
+ suffixes = (
577
+ PurePath(str(suffix_source)).suffixes
578
+ if suffix_source is not None
579
+ else []
580
+ )
559
581
  if suffixes:
560
582
  normalized_suffixes = [suffix.casefold() for suffix in suffixes]
561
583
  compression = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: etlplus
3
- Version: 0.10.1
3
+ Version: 0.10.2
4
4
  Summary: A Swiss Army knife for simple ETL operations
5
5
  Home-page: https://github.com/Dagitali/ETLPlus
6
6
  Author: ETLPlus Team
@@ -1,7 +1,7 @@
1
1
  etlplus/__init__.py,sha256=M2gScnyir6WOMAh_EuoQIiAzdcTls0_5hbd_Q6of8I0,1021
2
2
  etlplus/__main__.py,sha256=btoROneNiigyfBU7BSzPKZ1R9gzBMpxcpsbPwmuHwTM,479
3
3
  etlplus/__version__.py,sha256=1E0GMK_yUWCMQFKxXjTvyMwofi0qT2k4CDNiHWiymWE,327
4
- etlplus/enums.py,sha256=yW-Um1fDQbW9p70ooM8dDTH7D0XBgmT-l3bF66N0AQc,14801
4
+ etlplus/enums.py,sha256=JvXdX_x_U3LNnGZdX3Uo9dqipoDdqnLtZBmZE4DSei8,15426
5
5
  etlplus/extract.py,sha256=f44JdHhNTACxgn44USx05paKTwq7LQY-V4wANCW9hVM,6173
6
6
  etlplus/file.py,sha256=B-zebTrIFDKaaKzA9Fq5-L0JwDNYa2T--_6veR3N03s,17939
7
7
  etlplus/load.py,sha256=R_y0_vtsEo1bwxWVQu2bfhB5ZIJoIoWu2ycCdvY4RnE,8737
@@ -57,9 +57,9 @@ etlplus/templates/ddl.sql.j2,sha256=s8fMWvcb4eaJVXkifuib1aQPljtZ8buuyB_uA-ZdU3Q,
57
57
  etlplus/templates/view.sql.j2,sha256=Iy8DHfhq5yyvrUKDxqp_aHIEXY4Tm6j4wT7YDEFWAhk,2180
58
58
  etlplus/validation/__init__.py,sha256=Pe5Xg1_EA4uiNZGYu5WTF3j7odjmyxnAJ8rcioaplSQ,1254
59
59
  etlplus/validation/utils.py,sha256=Mtqg449VIke0ziy_wd2r6yrwJzQkA1iulZC87FzXMjo,10201
60
- etlplus-0.10.1.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
61
- etlplus-0.10.1.dist-info/METADATA,sha256=vjSqzhO6_KFW2lXvQgHGFOJDxOx-r4dSVef664jr1mU,21036
62
- etlplus-0.10.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
- etlplus-0.10.1.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
64
- etlplus-0.10.1.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
65
- etlplus-0.10.1.dist-info/RECORD,,
60
+ etlplus-0.10.2.dist-info/licenses/LICENSE,sha256=MuNO63i6kWmgnV2pbP2SLqP54mk1BGmu7CmbtxMmT-U,1069
61
+ etlplus-0.10.2.dist-info/METADATA,sha256=rz0pmbVOfFoJ4HWJuSiNm-oMVbZ8Uf44bcgFRlXxBxU,21036
62
+ etlplus-0.10.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
63
+ etlplus-0.10.2.dist-info/entry_points.txt,sha256=6w-2-jzuPa55spzK34h-UKh2JTEShh38adFRONNP9QE,45
64
+ etlplus-0.10.2.dist-info/top_level.txt,sha256=aWWF-udn_sLGuHTM6W6MLh99ArS9ROkUWO8Mi8y1_2U,8
65
+ etlplus-0.10.2.dist-info/RECORD,,