zhichyu commited on
Commit
7605a07
·
1 Parent(s): 1800b7d

Warning instead of exception on type mismatch (#3523)

Browse files

### What problem does this PR solve?

Warning instead of exception on type mismatch.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

api/ragflow_server.py CHANGED
@@ -14,8 +14,9 @@
14
  # limitations under the License.
15
  #
16
 
17
- from beartype.claw import beartype_packages
18
- beartype_packages(["agent", "api", "deepdoc", "plugins", "rag", "ragflow_sdk"]) # <-- raise exceptions in your code
 
19
 
20
  import logging
21
  from api.utils.log_utils import initRootLogger
 
14
  # limitations under the License.
15
  #
16
 
17
+ from beartype import BeartypeConf
18
+ from beartype.claw import beartype_all # <-- you didn't sign up for this
19
+ beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code
20
 
21
  import logging
22
  from api.utils.log_utils import initRootLogger
rag/svr/task_executor.py CHANGED
@@ -13,8 +13,9 @@
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
  #
16
- from beartype.claw import beartype_packages
17
- beartype_packages(["agent", "api", "deepdoc", "plugins", "rag", "ragflow_sdk"]) # <-- raise exceptions in your code
 
18
 
19
  import logging
20
  import sys
 
13
  # See the License for the specific language governing permissions and
14
  # limitations under the License.
15
  #
16
+ from beartype import BeartypeConf
17
+ from beartype.claw import beartype_all # <-- you didn't sign up for this
18
+ beartype_all(conf=BeartypeConf(violation_type=UserWarning)) # <-- emit warnings from all code
19
 
20
  import logging
21
  import sys