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 22All notable changes to `dash` will be documented in this file.
33This project adheres to [Semantic Versioning](https://semver.org/).
44
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+
511## [3.0.0] - 2025-03-17
612
713## Added
Original file line number Diff line number Diff line change 1111import secrets
1212import string
1313import inspect
14+ import re
15+
1416from html import escape
1517from functools import wraps
1618from typing import Union
@@ -302,3 +304,14 @@ def get_caller_name():
302304 return s .frame .f_locals .get ("__name__" , "__main__" )
303305
304306 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 44import textwrap
55import importlib
66
7- import stringcase
7+ from .. _utils import pascal_case
88
99
1010shapes = {}
@@ -54,7 +54,7 @@ def generate_any(*_):
5454
5555def generate_shape (type_info , component_name : str , prop_name : str ):
5656 props = []
57- name = stringcase . pascalcase (prop_name )
57+ name = pascal_case (prop_name )
5858
5959 for prop_key , prop_type in type_info ["value" ].items ():
6060 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 77retrying
88nest-asyncio
99setuptools
10- stringcase>=1.2.0
Original file line number Diff line number Diff line change @@ -58,3 +58,19 @@ def test_ddut001_attribute_dict():
5858 a .x = 4
5959 assert err .value .args == ("Object is final: No new keys may be added." , "x" )
6060 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