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

Function clean_string

tests/dataset/test_ms_datasets.py:115–123  ·  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

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

Callers 1

_check_dataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected