Repository: meltano/sdk
Pull request #2188 (2024-01-26 23:56:19)

refactor: Remove unused `logger` parameter from private catalog helper functions


<!-- readthedocs-preview meltano-sdk start -->
----
📚 Documentation preview 📚: https://meltano-sdk--2188.org.readthedocs.build/en/2188/

<!-- readthedocs-preview meltano-sdk end -->

codspeed-hq[bot]: ## [CodSpeed Performance Report](https://codspeed.io/meltano/sdk/branches/edgarrmondragon/refactor/remove-unused-logger-param)

### Merging #2188 will **not alter performance**

<sub>Comparing <code>edgarrmondragon/refactor/remove-unused-logger-param</code> (79a23b7) with <code>main</code> (7a0478d)</sub>



### Summary

`✅ 6` untouched benchmarks





codecov[bot]: ## [Codecov](https://app.codecov.io/gh/meltano/sdk/pull/2188?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`7a0478d`)](https://app.codecov.io/gh/meltano/sdk/commit/7a0478d682d7257e9ec4d62604b3bf579af1cdd7?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) 88.50% compared to head [(`79a23b7`)](https://app.codecov.io/gh/meltano/sdk/pull/2188?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano) 88.50%.


<details><summary>Additional details and impacted files</summary>


```diff
@@           Coverage Diff           @@
##             main    #2188   +/-   ##
=======================================
  Coverage   88.50%   88.50%           
=======================================
  Files          54       54           
  Lines        4717     4717           
  Branches      962      962           
=======================================
  Hits         4175     4175           
  Misses        384      384           
  Partials      158      158           
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/meltano/sdk/pull/2188?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=meltano).


Patch:
diff --git a/singer_sdk/helpers/_catalog.py b/singer_sdk/helpers/_catalog.py
index 49ea2f1c..39df3f0f 100644
--- a/singer_sdk/helpers/_catalog.py
+++ b/singer_sdk/helpers/_catalog.py
@@ -10,8 +10,6 @@ from memoization import cached
 from singer_sdk.helpers._typing import is_object_type
 
 if t.TYPE_CHECKING:
-    from logging import Logger
-
     from singer_sdk._singerlib import Catalog, SelectionMask
 
 _MAX_LRU_CACHE = 500
@@ -22,11 +20,10 @@ def get_selected_schema(
     stream_name: str,
     schema: dict,
     mask: SelectionMask,
-    logger: Logger,
 ) -> dict:
     """Return a copy of the provided JSON schema, dropping any fields not selected."""
     new_schema = deepcopy(schema)
-    _pop_deselected_schema(new_schema, mask, stream_name, (), logger)
+    _pop_deselected_schema(new_schema, mask, stream_name, ())
     return new_schema
 
 
@@ -35,7 +32,6 @@ def _pop_deselected_schema(
     mask: SelectionMask,
     stream_name: str,
     breadcrumb: tuple[str, ...],
-    logger: Logger,
 ) -> None:
     """Remove anything from schema that is not selected.
 
@@ -75,7 +71,6 @@ def _pop_deselected_schema(
                 mask,
                 stream_name,
                 property_breadcrumb,
-                logger,
             )
 
 
@@ -83,7 +78,6 @@ def pop_deselected_record_properties(
     record: dict[str, t.Any],
     schema: dict,
     mask: SelectionMask,
-    logger: Logger,
     breadcrumb: tuple[str, ...] = (),
 ) -> None:
     """Remove anything from record properties that is not selected.
@@ -104,7 +98,6 @@ def pop_deselected_record_properties(
                 val,
                 schema,
                 mask,
-                logger,
                 property_breadcrumb,
             )
 
diff --git a/singer_sdk/mapper.py b/singer_sdk/mapper.py
index aeea4681..d3cd9400 100644
--- a/singer_sdk/mapper.py
+++ b/singer_sdk/mapper.py
@@ -657,7 +657,6 @@ class PluginMapper:
                     catalog_entry.stream or catalog_entry.tap_stream_id,
                     catalog_entry.schema.to_dict(),
                     catalog_entry.metadata.resolve_selection(),
-                    self.logger,
                 ),
                 catalog_entry.key_properties,
             )
diff --git a/singer_sdk/streams/core.py b/singer_sdk/streams/core.py
index 36af0c12..064b7836 100644
--- a/singer_sdk/streams/core.py
+++ b/singer_sdk/streams/core.py
@@ -827,7 +827,7 @@ class Stream(metaclass=abc.ABCMeta):
         Yields:
             Record message objects.
         """
-        pop_deselected_record_properties(record, self.schema, self.mask, self.logger)
+        pop_deselected_record_properties(record, self.schema, self.mask)
         record = conform_record_data_types(
             stream_name=self.name,
             record=record,
diff --git a/singer_sdk/streams/sql.py b/singer_sdk/streams/sql.py
index 29946e78..47d015f9 100644
--- a/singer_sdk/streams/sql.py
+++ b/singer_sdk/streams/sql.py
@@ -154,7 +154,6 @@ class SQLStream(Stream, metaclass=abc.ABCMeta):
             stream_name=self.name,
             schema=self.schema,
             mask=self.mask,
-            logger=self.logger,
         )
 
     # Get records from stream


Test patch:
diff --git a/tests/core/test_catalog_selection.py b/tests/core/test_catalog_selection.py
index f6653c25..d4b30cec 100644
--- a/tests/core/test_catalog_selection.py
+++ b/tests/core/test_catalog_selection.py
@@ -197,12 +197,7 @@ def test_schema_selection(
     stream_name: str,
 ):
     """Test that schema selection rules are correctly applied to SCHEMA messages."""
-    selected_schema = get_selected_schema(
-        stream_name,
-        schema,
-        mask,
-        logging.getLogger(),
-    )
+    selected_schema = get_selected_schema(stream_name, schema, mask)
     assert (
         selected_schema["properties"]
         == PropertiesList(
@@ -247,7 +242,6 @@ def test_record_property_pop(
         record=record_pop,
         schema=schema,
         mask=mask,
-        logger=logging.getLogger(),
         breadcrumb=(),
     )
 
diff --git a/tests/samples/test_tap_countries.py b/tests/samples/test_tap_countries.py
index 31e0b866..a302e646 100644
--- a/tests/samples/test_tap_countries.py
+++ b/tests/samples/test_tap_countries.py
@@ -5,7 +5,6 @@ from __future__ import annotations
 import copy
 import io
 import json
-import logging
 import typing as t
 from contextlib import redirect_stdout
 
@@ -89,7 +88,6 @@ def test_with_catalog_entry():
         record=copied_record,
         schema=stream.schema,
         mask=stream.mask,
-        logger=logging.getLogger(),
     )
     assert copied_record == record
 
@@ -97,7 +95,6 @@ def test_with_catalog_entry():
         stream_name=stream.name,
         schema=stream.schema,
         mask=stream.metadata.resolve_selection(),
-        logger=logging.getLogger(),
     )
     assert new_schema == stream.schema