From c2234009cf0770a37ccd10f63b97101b1b9bdda5 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Wed, 5 Jun 2024 00:13:12 -0400 Subject: [PATCH] x --- libs/core/langchain_core/_api/deprecation.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/libs/core/langchain_core/_api/deprecation.py b/libs/core/langchain_core/_api/deprecation.py index 6c0af2b8589..5f69d2b892e 100644 --- a/libs/core/langchain_core/_api/deprecation.py +++ b/libs/core/langchain_core/_api/deprecation.py @@ -100,10 +100,12 @@ def deprecated( pass """ - if ( - alternative_import - and "." not in alternative_import - or " " in alternative_import + if pending and removal: + raise ValueError("A pending deprecation cannot have a scheduled removal") + if alternative and alternative_import: + raise ValueError("Cannot specify both alternative and alternative_import") + if alternative_import and ( + "." not in alternative_import or " " in alternative_import ): raise ValueError( "alternative_import must be a fully qualified module path, e.g. " @@ -347,12 +349,6 @@ def warn_deprecated( since. Set to other Falsy values to not schedule a removal date. Cannot be used together with pending. """ - if pending and removal: - raise ValueError("A pending deprecation cannot have a scheduled removal") - if alternative and alternative_import: - raise ValueError("Cannot specify both alternative and alternative_import") - if alternative_import and "." not in alternative_import: - raise ValueError("alternative_import must be a fully qualified module path") if not pending: if not removal: