MCPcopy Create free account
hub / github.com/apache/fory / scala_module_name

Function scala_module_name

compiler/fory_compiler/generators/scala.py:65–79  ·  view source on GitHub ↗

Return the generated Scala schema module name.

(schema: Schema)

Source from the content-addressed store, hash-verified

63
64
65def scala_module_name(schema: Schema) -> str:
66 """Return the generated Scala schema module name."""
67 package = scala_package_for_schema(schema)
68 if package:
69 return _to_pascal_case(package.split(".")[-1]) + "ForyModule"
70 if schema.source_file and not schema.source_file.startswith("<"):
71 cleaned = "".join(
72 char if char.isascii() and (char.isalnum() or char == "_") else "_"
73 for char in Path(schema.source_file).stem
74 )
75 prefix = _to_pascal_case(cleaned) if cleaned else "Schema"
76 if not prefix or not (prefix[0].isalpha() or prefix[0] == "_"):
77 prefix = f"Schema{prefix}"
78 return prefix + "ForyModule"
79 return "ForyModule"
80
81
82def scala_source_path(schema: Schema, type_name: str) -> str:

Callers 2

scala_module_file_pathFunction · 0.85
_module_nameMethod · 0.85

Calls 2

scala_package_for_schemaFunction · 0.85
_to_pascal_caseFunction · 0.70

Tested by

no test coverage detected