File tree Expand file tree Collapse file tree 6 files changed +38
-3
lines changed Expand file tree Collapse file tree 6 files changed +38
-3
lines changed Original file line number Diff line number Diff line change 2
2
All notable changes to `dash` will be documented in this file.
3
3
This project adheres to [Semantic Versioning](https://semver.org/).
4
4
5
+ ## [UNRELEASED]
6
+
7
+ ## Fixed
8
+
9
+ - [#3239](https://github.com/plotly/dash/pull/3239) Remove stringcase dependency, fix [#3238](https://github.com/plotly/dash/issues/3238)
10
+
5
11
## [3.0.0] - 2025-03-17
6
12
7
13
## Added
Original file line number Diff line number Diff line change 11
11
import secrets
12
12
import string
13
13
import inspect
14
+ import re
15
+
14
16
from html import escape
15
17
from functools import wraps
16
18
from typing import Union
@@ -302,3 +304,14 @@ def get_caller_name():
302
304
return s .frame .f_locals .get ("__name__" , "__main__" )
303
305
304
306
return "__main__"
307
+
308
+
309
+ def pascal_case (name : Union [str , None ]):
310
+ s = re .sub (r"\s" , "_" , str (name ))
311
+ # Replace leading `_`
312
+ s = re .sub ("^[_]+" , "" , s )
313
+ if not s :
314
+ return s
315
+ return s [0 ].upper () + re .sub (
316
+ r"[\-_\.]+([a-z])" , lambda match : match .group (1 ).upper (), s [1 :]
317
+ )
Original file line number Diff line number Diff line change 4
4
import textwrap
5
5
import importlib
6
6
7
- import stringcase
7
+ from .. _utils import pascal_case
8
8
9
9
10
10
shapes = {}
@@ -54,7 +54,7 @@ def generate_any(*_):
54
54
55
55
def generate_shape (type_info , component_name : str , prop_name : str ):
56
56
props = []
57
- name = stringcase . pascalcase (prop_name )
57
+ name = pascal_case (prop_name )
58
58
59
59
for prop_key , prop_type in type_info ["value" ].items ():
60
60
typed = get_prop_typing (
Original file line number Diff line number Diff line change
1
+ partial
Original file line number Diff line number Diff line change 7
7
retrying
8
8
nest-asyncio
9
9
setuptools
10
- stringcase>=1.2.0
Original file line number Diff line number Diff line change @@ -58,3 +58,19 @@ def test_ddut001_attribute_dict():
58
58
a .x = 4
59
59
assert err .value .args == ("Object is final: No new keys may be added." , "x" )
60
60
assert "x" not in a
61
+
62
+
63
+ @pytest .mark .parametrize (
64
+ "value,expected" ,
65
+ [
66
+ ("foo_bar" , "FooBar" ),
67
+ ("" , "" ),
68
+ ("fooBarFoo" , "FooBarFoo" ),
69
+ ("foo bar" , "FooBar" ),
70
+ ("foo-bar" , "FooBar" ),
71
+ ("__private_prop" , "PrivateProp" ),
72
+ ("double__middle___triple" , "DoubleMiddleTriple" ),
73
+ ],
74
+ )
75
+ def test_ddut002_pascal_case (value , expected ):
76
+ assert utils .pascal_case (value ) == expected
You can’t perform that action at this time.
0 commit comments