Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions logos_transcode_engine.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@

import hashlib


class LogosEngine:
def harmonic_signature(self, text: str) -> str:
return hashlib.sha256(text.encode("utf-8")).hexdigest()



def graphemic_hash(self, text: str) -> str:
return hashlib.md5(text.encode("utf-8")).hexdigest()

def run_synthesis(self, directive: str) -> dict:
return {
"Input Directive": directive,
"Universal Graphemic Hash": self.graphemic_hash(directive),
"Harmonic Signature": self.harmonic_signature(directive),
"Transdimensional Frequency": f"{len(directive)}.{hash(directive) % 1000}THz",
"Synchronized Nanite Protocol": [self.graphemic_hash(directive), "active"]
}

6 changes: 6 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"stubPath": "typings",
"executionEnvironments": [
{ "root": "." }
]
}
59 changes: 59 additions & 0 deletions test_typing_stub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import pytest
import sys
from typing import TypeAlias


def test_typing_stub_file_exists():
"""Test that our custom typing stub file exists and is properly formatted."""
import os

# Check that the stub file exists in the right location
stub_path = os.path.join(os.path.dirname(__file__), 'typings', 'typing.pyi')
assert os.path.exists(stub_path), f"Typing stub file not found at {stub_path}"

# Check that the stub file contains our TypeAliasType definition
with open(stub_path, 'r') as f:
content = f.read()

assert 'class TypeAliasType:' in content
assert '__class_getitem__' in content
assert 'from typing import Any, TypeAlias' in content


def test_pyrightconfig_exists():
"""Test that pyrightconfig.json exists and has the right stub path."""
import os
import json

config_path = os.path.join(os.path.dirname(__file__), 'pyrightconfig.json')
assert os.path.exists(config_path), "pyrightconfig.json not found"

with open(config_path, 'r') as f:
config = json.load(f)

assert config.get('stubPath') == 'typings'
assert 'executionEnvironments' in config


def test_type_alias_basic_usage():
"""Test basic type alias functionality that would benefit from our stub."""
# Define a simple type alias - Python 3.12 syntax
MyStringAlias: TypeAlias = str

# This should work without issues
def process_text(text: MyStringAlias) -> MyStringAlias:
return text.upper()

result = process_text("hello")
assert result == "HELLO"
assert isinstance(result, str)


@pytest.mark.skipif(sys.version_info < (3, 12), reason="requires python3.12 or higher")
def test_new_type_syntax():
"""Test the new Python 3.12 type statement syntax."""
# This would use TypeAliasType internally in Python 3.12+
# Our stub ensures type checkers understand this pattern
exec("type StringAlias = str")
# If this executes without error, our setup is working
assert True
5 changes: 5 additions & 0 deletions typings/typing.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from typing import Any, TypeAlias

class TypeAliasType:
@classmethod
def __class_getitem__(cls, item: Any) -> "TypeAliasType": ...