summaryrefslogtreecommitdiffstats
path: root/src/aristaproto/compile/naming.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/aristaproto/compile/naming.py')
-rw-r--r--src/aristaproto/compile/naming.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/aristaproto/compile/naming.py b/src/aristaproto/compile/naming.py
new file mode 100644
index 0000000..0c45dde
--- /dev/null
+++ b/src/aristaproto/compile/naming.py
@@ -0,0 +1,21 @@
+from aristaproto import casing
+
+
+def pythonize_class_name(name: str) -> str:
+ return casing.pascal_case(name)
+
+
+def pythonize_field_name(name: str) -> str:
+ return casing.safe_snake_case(name)
+
+
+def pythonize_method_name(name: str) -> str:
+ return casing.safe_snake_case(name)
+
+
+def pythonize_enum_member_name(name: str, enum_name: str) -> str:
+ enum_name = casing.snake_case(enum_name).upper()
+ find = name.find(enum_name)
+ if find != -1:
+ name = name[find + len(enum_name) :].strip("_")
+ return casing.sanitize_name(name)