Skip to content

Commit

Permalink
impl
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Jul 3, 2024
1 parent b5d22f9 commit 8abd7fd
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions serializable/_xml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# encoding: utf-8

# This file is part of py-serializable
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Paul Horton. All Rights Reserved.

from re import compile as re_compile

# region normalizedString

_normalized_string_forbitten_search = re_compile(r'\r\n|\t|\n|\r')
_normalized_string_forbitten_replace = ' '

def normalizedString(s: str) -> str:
return _normalized_string_forbitten.sub(
_normalized_string_replace,
s)

# endregion

# region token

_token_multistring_search = re_compile(r' {2,}')
_token_multistring_replace = ' '

def token(s: str) -> str:
return _token_multistring_search.sub(
_token_multistring_replace,
normalizedString(s).strip())

# endregion

0 comments on commit 8abd7fd

Please sign in to comment.