MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / extract_number

Function extract_number

botasaurus_server/botasaurus_server/check_node.py:8–18  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

6 import re
7
8 def extract_number(s):
9 if isinstance(s, str):
10 # Use regular expression to find all numbers in the text
11 numbers = re.findall(r"\b\d+(?:\.\d+)?\b", s)
12 # Convert the extracted strings to floats or integers
13 ls = [float(num) if "." in num else int(num) for num in numbers]
14
15 return ls[0] if ls else None
16
17 if isinstance(s, int) or isinstance(s, float):
18 return s
19
20 try:
21 NODE_BIN = os.environ.get("NODE_BIN") or (

Callers 1

check_nodeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected