mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-22 04:40:53 +00:00
changes to to_camel_case and to_snake_case
This commit is contained in:
parent
20851c3880
commit
13a0694190
@ -14,7 +14,7 @@ class Callback:
|
||||
def get(self) -> list:
|
||||
"""returns a list of registered events"""
|
||||
|
||||
return [to_camel_case(fn.__name__) for fn in self._callbacks]
|
||||
return [to_camel_case(fn.__name__[2:]) for fn in self._callbacks]
|
||||
|
||||
def trigger(self, event, data):
|
||||
"""trigger callback on update"""
|
||||
|
@ -3,13 +3,11 @@ from dataclasses import dataclass
|
||||
|
||||
|
||||
def to_camel_case(s):
|
||||
s = "".join(word.title() for word in s.split("_"))
|
||||
return s[2:]
|
||||
return "".join(word.title() for word in s.split("_"))
|
||||
|
||||
|
||||
def to_snake_case(s):
|
||||
s = re.sub(r"(?<!^)(?=[A-Z])", "_", s).lower()
|
||||
return f"{s}"
|
||||
return re.sub(r"(?<!^)(?=[A-Z])", "_", s).lower()
|
||||
|
||||
|
||||
def as_dataclass(identifier, data):
|
||||
|
Loading…
Reference in New Issue
Block a user