Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit db23985

Browse files
committed
chore: Move _split_camel_case to util
1 parent 1930343 commit db23985

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

ocdskit/hierarchy.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
import re
21
from collections import Counter
32
from itertools import chain
43

54
from concepts import Context
65

7-
from ocdskit.util import _dedupe_with_counter, _get_prop_name, longest_common_subsequence
8-
9-
WORD_BOUNDARIES = re.compile(r"[ ._-]+|(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])")
10-
11-
12-
def _split_camel_case(name):
13-
"""Split into capitalized words at space, dot, underscore, dash and camelCase boundaries."""
14-
return [word.capitalize() for word in WORD_BOUNDARIES.split(name)]
6+
from ocdskit.util import _dedupe_with_counter, _get_prop_name, _split_camel_case, longest_common_subsequence
157

168

179
def get_base_class_name(class_names, prefix=""):

ocdskit/util.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import itertools
22
import json
3+
import re
34
from decimal import Decimal
45

56
import ijson
@@ -369,6 +370,14 @@ def _get_prop_name(pair):
369370
return pair.partition(":")[0]
370371

371372

373+
WORD_BOUNDARIES = re.compile(r"[ ._-]+|(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])")
374+
375+
376+
def _split_camel_case(name):
377+
"""Split into capitalized words at space, dot, underscore, dash and camelCase boundaries."""
378+
return [word.capitalize() for word in WORD_BOUNDARIES.split(name)]
379+
380+
372381
def _dedupe_with_counter(name, names):
373382
if name in names:
374383
root = name

0 commit comments

Comments
 (0)