diff --git a/.github/workflows/mega-linter.yml b/.github/workflows/mega-linter.yml index 3042624783..af88dcebbd 100644 --- a/.github/workflows/mega-linter.yml +++ b/.github/workflows/mega-linter.yml @@ -17,19 +17,16 @@ # More info at https://megalinter.io name: MegaLinter -on: - # Trigger mega-linter at every push. Action will also be visible from Pull Requests to main - # push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions) +on: # yamllint disable-line rule:truthy - false positive pull_request: permissions: contents: read -env: # Comment env block if you don't want to apply fixes - # Apply linter fixes configuration - APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool) - APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all) - APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request) +env: + APPLY_FIXES: all + APPLY_FIXES_EVENT: pull_request + APPLY_FIXES_MODE: commit concurrency: group: ${{ github.ref || github.run_id }}-${{ github.workflow }} @@ -40,8 +37,8 @@ jobs: name: MegaLinter runs-on: ubuntu-24.04 permissions: - # Give the default GITHUB_TOKEN write permission to commit and push, comment issues & post new PR - # Remove the ones you do not need + # Give the default GITHUB_TOKEN write permission to commit and push, comment + # issues & post new PR; remove the ones you do not need contents: write issues: write pull-requests: write @@ -51,19 +48,19 @@ jobs: uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # 5.0.0 with: token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }} + fetch-depth: 0 # Required for pushing commits to PRs # MegaLinter - name: MegaLinter id: ml - # You can override MegaLinter flavor used to have faster performances - # More info at https://megalinter.io/flavors/ - uses: oxsecurity/megalinter/flavors/python@e08c2b05e3dbc40af4c23f41172ef1e068a7d651 # 8.8.0 + uses: oxsecurity/megalinter/flavors/python@0dcbedd66ea456ba2d54fd350affaa15df8a0da3 # 9.0.1 env: # All available variables are described in documentation - # https://megalinter.io/configuration/ + # https://megalinter.io/latest/configuration/ VALIDATE_ALL_CODEBASE: "true" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY + # ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE + # .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY GITHUB_COMMENT_REPORTER: "true" PYTHON_RUFF_ARGUMENTS: --config pyproject.toml --config 'output-format="github"' PYTHON_RUFF_FORMAT_ARGUMENTS: --config pyproject.toml --config 'output-format="github"' @@ -74,19 +71,53 @@ jobs: uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # 4.6.2 with: name: MegaLinter reports + include-hidden-files: "true" path: | megalinter-reports mega-linter.log - # Push new commit if applicable (for now works only on PR from same repository, not from forks) + # Set APPLY_FIXES_IF var for use in future steps + - name: Set APPLY_FIXES_IF var + run: | + printf 'APPLY_FIXES_IF=%s\n' "${{ + steps.ml.outputs.has_updated_sources == 1 && + ( + env.APPLY_FIXES_EVENT == 'all' || + env.APPLY_FIXES_EVENT == github.event_name + ) && + ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) + }}" >> "${GITHUB_ENV}" + + # Set APPLY_FIXES_IF_* vars for use in future steps + - name: Set APPLY_FIXES_IF_* vars + run: | + printf 'APPLY_FIXES_IF_PR=%s\n' "${{ + env.APPLY_FIXES_IF == 'true' && + env.APPLY_FIXES_MODE == 'pull_request' + }}" >> "${GITHUB_ENV}" + printf 'APPLY_FIXES_IF_COMMIT=%s\n' "${{ + env.APPLY_FIXES_IF == 'true' && + env.APPLY_FIXES_MODE == 'commit' && + (!contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)) + }}" >> "${GITHUB_ENV}" + - name: Prepare commit - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') + if: env.APPLY_FIXES_IF_COMMIT == 'true' run: sudo chown -Rc $UID .git/ + - name: Commit and push applied linter fixes - if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix') uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # 6.0.1 + if: env.APPLY_FIXES_IF_COMMIT == 'true' with: - branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }} + branch: >- + ${{ + github.event.pull_request.head.ref || + github.head_ref || + github.ref + }} commit_message: "[MegaLinter] Apply linters fixes" commit_user_name: newrelic-python-agent-team commit_user_email: 137356142+newrelic-python-agent-team@users.noreply.github.com diff --git a/.mega-linter.yml b/.mega-linter.yml index 68027ec64a..ef6d98461c 100644 --- a/.mega-linter.yml +++ b/.mega-linter.yml @@ -20,6 +20,7 @@ DEFAULT_BRANCH: main # Usually master or main SHOW_ELAPSED_TIME: true FILEIO_REPORTER: false PRINT_ALPACA: false +FLAVOR_SUGGESTIONS: false CLEAR_REPORT_FOLDER: true VALIDATE_ALL_CODEBASE: true IGNORE_GITIGNORED_FILES: true diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53b3ac49ec..89c61da1be 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,7 +29,7 @@ default_install_hook_types: repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.12.5 + rev: v0.13.1 hooks: # Run the linter. - id: ruff-check @@ -40,7 +40,7 @@ repos: stages: [pre-push] - repo: https://github.com/google/addlicense - rev: 55a521bf81c24480094950caa3566548fa63875e + rev: v1.2.0 hooks: - id: addlicense args: diff --git a/newrelic/api/time_trace.py b/newrelic/api/time_trace.py index e9ee73936e..fd0f62fdef 100644 --- a/newrelic/api/time_trace.py +++ b/newrelic/api/time_trace.py @@ -252,7 +252,7 @@ def _observe_exception(self, exc_info=None, ignore=None, expected=None, status_c if getattr(value, "_nr_ignored", None): return - module, name, fullnames, message_raw = parse_exc_info((exc, value, tb)) + _module, name, fullnames, message_raw = parse_exc_info((exc, value, tb)) fullname = fullnames[0] # In case message is in JSON format for OpenAI models diff --git a/newrelic/console.py b/newrelic/console.py index 2ed64dead9..0add2f38e6 100644 --- a/newrelic/console.py +++ b/newrelic/console.py @@ -354,7 +354,7 @@ def do_transactions(self): """ """ for item in _trace_cache.active_threads(): - transaction, thread_id, thread_type, frame = item + transaction, _thread_id, _thread_type, _frame = item print("THREAD", item, file=self.stdout) if transaction is not None: transaction.dump(self.stdout) @@ -460,7 +460,7 @@ def __thread_run(self): listener.listen(5) while True: - client, addr = listener.accept() + client, _addr = listener.accept() if not self.__console_initialized: self.__console_initialized = True diff --git a/newrelic/core/attribute_filter.py b/newrelic/core/attribute_filter.py index 4eb67266bb..9c2be31373 100644 --- a/newrelic/core/attribute_filter.py +++ b/newrelic/core/attribute_filter.py @@ -209,6 +209,9 @@ def __ge__(self, other): def __repr__(self): return f"({self.name}, {bin(self.destinations)}, {self.is_wildcard}, {self.is_include})" + def __hash__(self): + return hash((self.name, self.destinations, self.is_include, self.is_wildcard)) + def name_match(self, name): if self.is_wildcard: return name.startswith(self.name) diff --git a/newrelic/core/stats_engine.py b/newrelic/core/stats_engine.py index 407a934158..5b566ac4cc 100644 --- a/newrelic/core/stats_engine.py +++ b/newrelic/core/stats_engine.py @@ -703,7 +703,7 @@ def notice_error(self, error=None, attributes=None, expected=None, ignore=None, if getattr(value, "_nr_ignored", None): return - module, name, fullnames, message_raw = parse_exc_info(error) + _module, name, fullnames, message_raw = parse_exc_info(error) fullname = fullnames[0] # In the case case of JSON formatting for OpenAI models diff --git a/newrelic/hooks/datastore_memcache.py b/newrelic/hooks/datastore_memcache.py index 94f42ec44f..ca06438684 100644 --- a/newrelic/hooks/datastore_memcache.py +++ b/newrelic/hooks/datastore_memcache.py @@ -69,7 +69,7 @@ def _nr_datastore_trace_wrapper_(wrapped, instance, args, kwargs): result = wrapped(*args, **kwargs) instance_info = transaction._nr_datastore_instance_info - (host, port_path_or_id, db) = instance_info + (host, port_path_or_id, _db) = instance_info dt.host = host dt.port_path_or_id = port_path_or_id diff --git a/newrelic/hooks/framework_tornado.py b/newrelic/hooks/framework_tornado.py index c80a45a585..636be31250 100644 --- a/newrelic/hooks/framework_tornado.py +++ b/newrelic/hooks/framework_tornado.py @@ -91,7 +91,7 @@ def _wrap_headers_received(wrapped, instance, args, kwargs): except: pass - path, sep, query = start_line.path.partition("?") + path, _sep, query = start_line.path.partition("?") transaction = WebTransaction( application=application_instance(), diff --git a/newrelic/hooks/mlmodel_sklearn.py b/newrelic/hooks/mlmodel_sklearn.py index 8e0207a2db..3fa2e7a1b7 100644 --- a/newrelic/hooks/mlmodel_sklearn.py +++ b/newrelic/hooks/mlmodel_sklearn.py @@ -284,7 +284,7 @@ def create_prediction_event(transaction, class_, instance, args, kwargs, return_ "modelName": model_name, }, ) - features, predictions = np_casted_data_set.shape + _features, _predictions = np_casted_data_set.shape for prediction_index, prediction in enumerate(np_casted_data_set): inference_id = uuid.uuid4() @@ -346,7 +346,7 @@ def wrap_metric_scorer(wrapped, instance, args, kwargs): score = wrapped(*args, **kwargs) - y_true, y_pred, args, kwargs = _bind_scorer(*args, **kwargs) + _y_true, y_pred, args, kwargs = _bind_scorer(*args, **kwargs) model_name = "Unknown" training_step = "Unknown" if hasattr(y_pred, "_nr_model_name"): diff --git a/tests/agent_features/test_serverless_mode.py b/tests/agent_features/test_serverless_mode.py index 9c705c5c24..048b96aa23 100644 --- a/tests/agent_features/test_serverless_mode.py +++ b/tests/agent_features/test_serverless_mode.py @@ -56,7 +56,7 @@ def _test(): _test() - out, err = capsys.readouterr() + out, _err = capsys.readouterr() # Validate that something is printed to stdout assert out diff --git a/tests/agent_unittests/test_http_client.py b/tests/agent_unittests/test_http_client.py index 7c13406330..67fa227971 100644 --- a/tests/agent_unittests/test_http_client.py +++ b/tests/agent_unittests/test_http_client.py @@ -314,7 +314,7 @@ def test_http_payload_compression(server, client_cls, method, threshold): def test_cert_path(server): with HttpClient("localhost", server.port, ca_bundle_path=CERT_PATH) as client: - status, data = client.send_request() + client.send_request() @pytest.mark.parametrize("system_certs_available", (True, False)) diff --git a/tests/component_graphqlserver/test_graphql.py b/tests/component_graphqlserver/test_graphql.py index 3e8391ed2a..41b28b9883 100644 --- a/tests/component_graphqlserver/test_graphql.py +++ b/tests/component_graphqlserver/test_graphql.py @@ -181,7 +181,7 @@ def _query(): @dt_enabled def test_middleware(target_application): - framework, version, target_application = target_application + framework, _version, target_application = target_application _test_middleware_metrics = [ ("GraphQL/operation/GraphQLServer/query//hello", 1), ("GraphQL/resolve/GraphQLServer/hello", 1), @@ -207,7 +207,7 @@ def _test(): @dt_enabled def test_exception_in_middleware(target_application): - framework, version, target_application = target_application + _framework, _version, target_application = target_application query = "query MyQuery { error_middleware }" field = "error_middleware" @@ -254,7 +254,7 @@ def _test(): @pytest.mark.parametrize("field", ("error", "error_non_null")) @dt_enabled def test_exception_in_resolver(target_application, field): - framework, version, target_application = target_application + _framework, _version, target_application = target_application query = f"query MyQuery {{ {field} }}" txn_name = "framework_graphql._target_schema_sync:resolve_error" @@ -308,7 +308,7 @@ def _test(): ], ) def test_exception_in_validation(target_application, is_graphql_2, query, exc_class): - framework, version, target_application = target_application + _framework, _version, target_application = target_application if "syntax" in query: txn_name = "graphql.language.parser:parse" else: @@ -354,7 +354,7 @@ def _test(): @dt_enabled def test_operation_metrics_and_attrs(target_application): - framework, version, target_application = target_application + framework, _version, target_application = target_application operation_metrics = [("GraphQL/operation/GraphQLServer/query/MyQuery/library", 1)] operation_attrs = {"graphql.operation.type": "query", "graphql.operation.name": "MyQuery"} @@ -380,7 +380,7 @@ def _test(): @dt_enabled def test_field_resolver_metrics_and_attrs(target_application): - framework, version, target_application = target_application + framework, _version, target_application = target_application field_resolver_metrics = [("GraphQL/resolve/GraphQLServer/hello", 1)] graphql_attrs = { "graphql.field.name": "hello", @@ -426,7 +426,7 @@ def _test(): @dt_enabled @pytest.mark.parametrize("query,obfuscated", _test_queries) def test_query_obfuscation(target_application, query, obfuscated): - framework, version, target_application = target_application + _framework, _version, target_application = target_application graphql_attrs = {"graphql.operation.query": obfuscated} if callable(query): @@ -471,7 +471,7 @@ def _test(): @dt_enabled @pytest.mark.parametrize("query,expected_path", _test_queries) def test_deepest_unique_path(target_application, query, expected_path): - framework, version, target_application = target_application + _framework, _version, target_application = target_application if expected_path == "/error": txn_name = "framework_graphql._target_schema_sync:resolve_error" else: @@ -486,5 +486,5 @@ def _test(): @validate_transaction_count(0) def test_ignored_introspection_transactions(target_application): - framework, version, target_application = target_application + _framework, _version, target_application = target_application response = target_application("{ __schema { types { name } } }") diff --git a/tests/external_httplib2/test_httplib2.py b/tests/external_httplib2/test_httplib2.py index 19edf44028..e2ffd9f46a 100644 --- a/tests/external_httplib2/test_httplib2.py +++ b/tests/external_httplib2/test_httplib2.py @@ -84,7 +84,7 @@ def test_httplib2_http_request(server, metrics): @background_task(name="test_httplib2:test_httplib2_http_request") def _test(): connection = httplib2.Http() - response, content = connection.request(f"http://localhost:{server.port}", "GET") + connection.request(f"http://localhost:{server.port}", "GET") _test() diff --git a/tests/framework_graphql/test_application.py b/tests/framework_graphql/test_application.py index e753bf7e9c..bedec18fab 100644 --- a/tests/framework_graphql/test_application.py +++ b/tests/framework_graphql/test_application.py @@ -61,7 +61,7 @@ def error_middleware(next, root, info, **args): # noqa: A002 def test_no_harm_no_transaction(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + _framework, _version, target_application, _is_bg, _schema_type, _extra_spans = target_application def _test(): response = target_application("{ __schema { types { name } } }") @@ -95,7 +95,7 @@ def _graphql_base_rollup_metrics(framework, version, background_task=True): def test_basic(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, _schema_type, _extra_spans = target_application @validate_transaction_metrics( "query//hello", @@ -112,7 +112,7 @@ def _test(): def test_transaction_empty_settings(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, _is_bg, _schema_type, _extra_spans = target_application @validate_transaction_metrics( "query//hello", @@ -136,7 +136,7 @@ def _test(): @dt_enabled def test_query_and_mutation(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, schema_type, _extra_spans = target_application mutation_path = "storage_add" if framework != "Graphene" else "storage_add.string" type_annotation = "!" if framework == "Strawberry" else "" @@ -245,7 +245,7 @@ def _test(): @pytest.mark.parametrize("middleware", error_middleware) @dt_enabled def test_exception_in_middleware(target_application, middleware): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, schema_type, _extra_spans = target_application query = "query MyQuery { error_middleware }" field = "error_middleware" @@ -300,7 +300,7 @@ def _test(): @pytest.mark.parametrize("field", ("error", "error_non_null")) @dt_enabled def test_exception_in_resolver(target_application, field): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, schema_type, _extra_spans = target_application query = f"query MyQuery {{ {field} }}" txn_name = f"framework_{framework.lower()}._target_schema_{schema_type}:resolve_error" @@ -356,7 +356,7 @@ def _test(): ], ) def test_exception_in_validation(target_application, query, exc_class): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, _schema_type, _extra_spans = target_application if "syntax" in query: txn_name = "graphql.language.parser:parse" else: @@ -401,7 +401,7 @@ def _test(): @dt_enabled def test_operation_metrics_and_attrs(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, _schema_type, extra_spans = target_application operation_metrics = [(f"GraphQL/operation/{framework}/query/MyQuery/library", 1)] operation_attrs = {"graphql.operation.type": "query", "graphql.operation.name": "MyQuery"} @@ -428,7 +428,7 @@ def _test(): @dt_enabled def test_field_resolver_metrics_and_attrs(target_application): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, version, target_application, is_bg, _schema_type, extra_spans = target_application field_resolver_metrics = [(f"GraphQL/resolve/{framework}/hello", 1)] type_annotation = "!" if framework == "Strawberry" else "" @@ -478,7 +478,7 @@ def _test(): @dt_enabled @pytest.mark.parametrize("query,obfuscated", _test_queries) def test_query_obfuscation(target_application, query, obfuscated): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, _version, target_application, is_bg, _schema_type, _extra_spans = target_application graphql_attrs = {"graphql.operation.query": obfuscated} if callable(query): @@ -526,7 +526,7 @@ def _test(): @dt_enabled @pytest.mark.parametrize("query,expected_path", _test_queries) def test_deepest_unique_path(target_application, query, expected_path): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + framework, _version, target_application, is_bg, schema_type, _extra_spans = target_application if expected_path == "/error": txn_name = f"framework_{framework.lower()}._target_schema_{schema_type}:resolve_error" else: @@ -542,7 +542,7 @@ def _test(): @pytest.mark.parametrize("capture_introspection_setting", (True, False)) def test_introspection_transactions(target_application, capture_introspection_setting): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + _framework, _version, target_application, _is_bg, _schema_type, _extra_spans = target_application txn_ct = 1 if capture_introspection_setting else 0 @override_application_settings( diff --git a/tests/framework_strawberry/test_application.py b/tests/framework_strawberry/test_application.py index 403491ab20..7a522e22ad 100644 --- a/tests/framework_strawberry/test_application.py +++ b/tests/framework_strawberry/test_application.py @@ -37,7 +37,7 @@ def target_application(request): @pytest.mark.parametrize("capture_introspection_setting", (True, False)) def test_introspection_transactions(target_application, capture_introspection_setting): - framework, version, target_application, is_bg, schema_type, extra_spans = target_application + _framework, _version, target_application, _is_bg, _schema_type, _extra_spans = target_application txn_ct = 1 if capture_introspection_setting else 0 diff --git a/tests/messagebroker_pika/test_pika_blocking_connection_consume_generator.py b/tests/messagebroker_pika/test_pika_blocking_connection_consume_generator.py index 465c1758a4..72a210ad79 100644 --- a/tests/messagebroker_pika/test_pika_blocking_connection_consume_generator.py +++ b/tests/messagebroker_pika/test_pika_blocking_connection_consume_generator.py @@ -93,7 +93,7 @@ def test_blocking_connection_consume_timeout(producer): for result in channel.consume(QUEUE, inactivity_timeout=0.01): # result is None if there is a timeout if result and any(result): - method_frame, properties, body = result + method_frame, _properties, body = result channel.basic_ack(method_frame.delivery_tag) assert hasattr(method_frame, "_nr_start_time") assert body == BODY @@ -202,7 +202,7 @@ def test_blocking_connection_consume_using_methods(producer): consumer = channel.consume(QUEUE, inactivity_timeout=0.01) - method, properties, body = next(consumer) + method, _properties, body = next(consumer) assert hasattr(method, "_nr_start_time") assert body == BODY @@ -256,9 +256,9 @@ def test_blocking_connection_consume_many_outside_txn(produce_five): @validate_tt_collector_json(message_broker_params=_message_broker_tt_params) def consume_it(consumer, up_next=None): if up_next is None: - method_frame, properties, body = next(consumer) + method_frame, _properties, body = next(consumer) else: - method_frame, properties, body = up_next + method_frame, _properties, body = up_next assert hasattr(method_frame, "_nr_start_time") assert body == BODY return next(consumer) @@ -291,7 +291,7 @@ def test_blocking_connection_consume_using_methods_outside_txn(producer): consumer = channel.consume(QUEUE, inactivity_timeout=0.01) - method, properties, body = next(consumer) + method, _properties, body = next(consumer) assert hasattr(method, "_nr_start_time") assert body == BODY diff --git a/tests/mlmodel_sklearn/test_calibration_models.py b/tests/mlmodel_sklearn/test_calibration_models.py index d7a06603bb..211b935adf 100644 --- a/tests/mlmodel_sklearn/test_calibration_models.py +++ b/tests/mlmodel_sklearn/test_calibration_models.py @@ -53,7 +53,7 @@ def _run(): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) clf = getattr(sklearn.calibration, calibration_model_name)() diff --git a/tests/mlmodel_sklearn/test_discriminant_analysis_models.py b/tests/mlmodel_sklearn/test_discriminant_analysis_models.py index 40d5be839b..f0b5a574f3 100644 --- a/tests/mlmodel_sklearn/test_discriminant_analysis_models.py +++ b/tests/mlmodel_sklearn/test_discriminant_analysis_models.py @@ -68,7 +68,7 @@ def _run(discriminant_analysis_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) kwargs = {} clf = getattr(sklearn.discriminant_analysis, discriminant_analysis_model_name)(**kwargs) diff --git a/tests/mlmodel_sklearn/test_gaussian_process_models.py b/tests/mlmodel_sklearn/test_gaussian_process_models.py index 761742fa47..49dd8fc7d3 100644 --- a/tests/mlmodel_sklearn/test_gaussian_process_models.py +++ b/tests/mlmodel_sklearn/test_gaussian_process_models.py @@ -53,7 +53,7 @@ def _run(gaussian_process_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) clf = getattr(sklearn.gaussian_process, gaussian_process_model_name)(random_state=0) diff --git a/tests/mlmodel_sklearn/test_multiclass_models.py b/tests/mlmodel_sklearn/test_multiclass_models.py index acc5e579f5..94b5c49ad5 100644 --- a/tests/mlmodel_sklearn/test_multiclass_models.py +++ b/tests/mlmodel_sklearn/test_multiclass_models.py @@ -58,7 +58,7 @@ def _run(multiclass_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) # This is an example of a model that has all the available attributes # We could have choosen any estimator that has predict, score, diff --git a/tests/mlmodel_sklearn/test_naive_bayes_models.py b/tests/mlmodel_sklearn/test_naive_bayes_models.py index 762d6db3a6..8e5f956c2c 100644 --- a/tests/mlmodel_sklearn/test_naive_bayes_models.py +++ b/tests/mlmodel_sklearn/test_naive_bayes_models.py @@ -97,7 +97,7 @@ def _run(naive_bayes_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) clf = getattr(sklearn.naive_bayes, naive_bayes_model_name)() diff --git a/tests/mlmodel_sklearn/test_neural_network_models.py b/tests/mlmodel_sklearn/test_neural_network_models.py index e0c61a3dde..e24cb34aa0 100644 --- a/tests/mlmodel_sklearn/test_neural_network_models.py +++ b/tests/mlmodel_sklearn/test_neural_network_models.py @@ -61,7 +61,7 @@ def _run(neural_network_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) clf = getattr(sklearn.neural_network, neural_network_model_name)() diff --git a/tests/mlmodel_sklearn/test_svm_models.py b/tests/mlmodel_sklearn/test_svm_models.py index 194cda6cba..b4382cb8a4 100644 --- a/tests/mlmodel_sklearn/test_svm_models.py +++ b/tests/mlmodel_sklearn/test_svm_models.py @@ -63,7 +63,7 @@ def _run(svm_model_name): from sklearn.model_selection import train_test_split X, y = load_iris(return_X_y=True) - x_train, x_test, y_train, y_test = train_test_split(X, y, stratify=y, random_state=0) + x_train, x_test, y_train, _y_test = train_test_split(X, y, stratify=y, random_state=0) kwargs = {"random_state": 0} if svm_model_name in ["SVR", "NuSVR", "OneClassSVM"]: diff --git a/tests/testing_support/validators/validate_database_trace_inputs.py b/tests/testing_support/validators/validate_database_trace_inputs.py index bf6c48f3c2..7aa624362f 100644 --- a/tests/testing_support/validators/validate_database_trace_inputs.py +++ b/tests/testing_support/validators/validate_database_trace_inputs.py @@ -35,7 +35,7 @@ def _bind_params( ): return (sql, dbapi2_module, connect_params, cursor_params, sql_parameters, execute_params, source) - (sql, dbapi2_module, connect_params, cursor_params, sql_parameters, execute_params, source) = _bind_params( + (_sql, dbapi2_module, connect_params, cursor_params, sql_parameters, execute_params, source) = _bind_params( *args, **kwargs ) diff --git a/tests/testing_support/validators/validate_datastore_trace_inputs.py b/tests/testing_support/validators/validate_datastore_trace_inputs.py index 0bf7228fad..3cb0bc81c6 100644 --- a/tests/testing_support/validators/validate_datastore_trace_inputs.py +++ b/tests/testing_support/validators/validate_datastore_trace_inputs.py @@ -30,13 +30,13 @@ def _bind_params(product, target, operation, host=None, port_path_or_id=None, da return (product, target, operation, host, port_path_or_id, database_name, kwargs) ( - captured_product, + _captured_product, captured_target, captured_operation, captured_host, captured_port_path_or_id, captured_database_name, - captured_kwargs, + _captured_kwargs, ) = _bind_params(*args, **kwargs) if target is not None: