MCPcopy Create free account
hub / github.com/InternScience/SciReason / clean_string

Function clean_string

tests/dataset/test_local_datasets.py:118–126  ·  view source on GitHub ↗

Helper function to clean and normalize string data. It strips leading and trailing whitespace and replaces multiple whitespace characters with a single space.

(value)

Source from the content-addressed store, hash-verified

116
117
118def clean_string(value):
119 """Helper function to clean and normalize string data.
120
121 It strips leading and trailing whitespace and replaces multiple whitespace
122 characters with a single space.
123 """
124 if isinstance(value, str):
125 return ' '.join(value.split())
126 return value
127
128
129class TestingLocalDatasets(unittest.TestCase):

Callers 1

_check_dataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected