code standards - zfifteen/unified-framework GitHub Wiki
This document outlines the coding standards and style guidelines for the Z Framework project.
- Follow PEP 8 style guidelines
- Use 4 spaces for indentation
- Maximum line length of 88 characters (Black compatible)
- Use descriptive variable and function names
- Use type hints for all function parameters and return values
- Import types from
typing
module when needed
- Use docstrings for all functions, classes, and modules
- Follow Google-style docstring format
- Use
mpmath
withdps=50
for high-precision calculations - Import
mpmath as mp
for consistency
- Place core mathematical functions in
src/core/
- Place validation code in
src/validation/
- Place visualization code in
src/visualization/
- Write unit tests for all core functions
- Place tests in
tests/
directory - Use descriptive test names
import mpmath as mp
from typing import List, Tuple
def golden_ratio_transform(n: int, k: float) -> float:
"""Apply golden ratio transformation to integer n.
Args:
n: Integer to transform
k: Curvature parameter
Returns:
Transformed value using golden ratio
"""
phi = (1 + mp.sqrt(5)) / 2
return phi * ((n % phi) / phi) ** k
import mpmath as mp
mp.mp.dps = 50 # Set precision to 50 decimal places