Commit graph

14 commits

Author SHA1 Message Date
0ee34076df
feat: optimize imports and streamline processing
Removed unused imports across various modules, streamlining the codebase by eliminating the `ast` and `tokenize` modules where not directly utilized. This clean-up not only simplifies the code making it more maintainable but also potentially improves runtime performance by reducing overhead. Additionally, redundant variables and comments that do not contribute to clarity or functionality, such as `script_dir` and detailed notes on module path construction, were pruned to further enhance code readability and efficiency.

This change underscores our commitment to maintaining a lean and efficient codebase, facilitating easier updates and modifications in the future.
2024-05-26 21:03:59 +02:00
88bd156316
feat(dictionary): streamline translation mappings
Removed the duplicate translation mapping for "from" in the Deuthon dictionary, consolidating under "aus" to avoid redundancy and enhance consistency. This change streamlines translation mappings, facilitating easier maintenance and clarity in code translation processes.
2024-05-26 21:01:50 +02:00
9f3e4f3d4a
feat(interpreter): enhance result representation
Improve the handling of expression evaluation results in the interpreter by attempting to use `__repr__`, falling back to `str`, and finally relying on a basic string conversion if necessary. This approach ensures more robust and informative output for various types of objects, addressing potential issues where the direct conversion to a string might fail or not provide sufficiently detailed information.

This enhancement makes the interpreter more user-friendly and resilient, delivering clearer feedback to users about the outcomes of their operations and making debugging more straightforward.
2024-05-23 14:52:26 +02:00
36f37c18b1
feat: Enhance German code execution and import logic
Introduced changes significantly improve how German code scripts are handled, ensuring a more robust and flexible execution environment. By wrapping the execution of transpiled code in a dedicated module, we facilitate a cleaner namespace management and mimic the natural Python script execution context more closely. This approach also allows for improved error handling and tracebacks that are more meaningful to the end-user.

The addition of "ausgenommen" as an alternative to "except" in the dictionary broadens the tool's understanding of German code, enhancing its flexibility and user-friendliness.

We've refined the module import mechanism to include a wider array of search paths, notably the script's directory and the current working directory, before falling back to the predefined wrappers directory. This enhancement makes the import process more intuitive and aligned with Python's standard behavior, ensuring that dependencies are resolved more reliably across diverse execution environments.

These improvements collectively bolster the tool's usability, making it more accommodating for users running and developing German-translated Python scripts.
2024-05-23 14:47:24 +02:00
5ff8f3856b
feat: streamline module imports in __main__.py
Removed redundant imports of `deuthon.base` from `__main__.py`, cleaning up the module's import statements to enhance readability and maintainability. Also, annotated an `except` block with `noqa: F821` to suppress a specific linter warning related to the use of an undefined name. This change clarifies the intentional use of dynamic features and exceptions handling within the codebase, ensuring linting tools can accommodate our dynamic execution context without compromising code quality checks.

This cleanup contributes to a leaner codebase, potentially improving load times and reducing memory footprint, aligning with our ongoing efforts to optimize the performance and clarity of the Deuthon project.
2024-05-23 14:40:21 +02:00
3933ce4736
feat: improve error handling in interpreter
Introduced better error handling in the Deuthon interpreter loop by wrapping the code execution in a try-except block to catch and print exceptions using `traceback`. This change also updates the interpreter to only print output when `eval` returns a non-None result, enhancing usability and feedback for the user. The addition of `traceback` provides users with more insightful error messages, helping to debug incorrect German code inputs more effectively.
2024-05-23 14:39:57 +02:00
3f9f941c7a
feat: introduce basic Deuthon type classes
Added a new module defining wrapper classes around Python's fundamental data types in the Deuthon programming language style. This setup paves the way for extending standard types with additional Deuthon-specific functionalities and characteristics in the future. It marks a foundational step in making Deuthon a more feature-rich, Python-compatible language.
2024-05-23 12:52:36 +02:00
31eef48ee4
feat: remove unused setuptools import
Removed an unnecessary import of `setuptools` from `__main__.py`. This cleanup reduces the module's dependencies and potentially decreases startup time, making the codebase more efficient and lightweight. No significant functionality is affected by this change, consistent with our ongoing efforts to streamline the code.
2024-05-23 12:52:16 +02:00
5a69bb0c91
feat: integrate JSON module for sys overrides
Prepares for built-in module overrides by explicitly importing the `json` module within the `prepare_builtin_overrides` function. This approach ensures that any modifications or custom logic applied to the system's version of JSON does not unintentionally conflict with the original module's functionality. The aliasing of the original JSON module under a new name allows for safe manipulation and extension of JSON handling capabilities without affecting the global namespace or existing dependencies that rely on the unmodified JSON module.

This strategic import and module aliasing facilitate future enhancements and potentially complex custom behaviors, ensuring that extensions or modifications are both isolated and reversible, safeguarding the integrity of the application's core functionalities.
2024-05-23 12:51:54 +02:00
fa8e744300
fix: correct default parameter in HTÜPVerbindung __init__
Resolved a minor but crucial bug where the `quelladdresse` parameter's default value in the `HTÜPVerbindung` constructor was mistakenly set to `Nicht`. It has been corrected to `Nichts` (None), ensuring consistency with other default parameter values and preventing potential runtime errors related to type mismatches or unexpected behavior in network operations where a source address is not specified. This fix enhances the robustness of HTTP connections established using our custom wrapper, contributing to more reliable network communication in our applications.
2024-05-23 12:51:22 +02:00
aec8564839
feat(tests): improve type handling in debug output
Updated the debug message in the test suite to use a more explicit type conversion method when displaying the current file name. This change ensures consistency and clarity in type handling within debug messages. By switching to `zeichenkette(__datei__)` for converting the file name to a string, the code becomes more readable and aligns with best practices for type conversion. This adjustment is particularly relevant for maintaining code quality and could help in future troubleshooting or enhancements by making the debug output more predictable and standardized.
2024-05-23 12:45:51 +02:00
e8dd82a6ba
Enhanced HTTP connection handling
Refactored the HTTP wrapper classes to introduce `HTÜPVerbindung`, a new class that supports configurable timeout, source address, and block size for HTTP connections, enhancing flexibility and control for HTTP requests in the Deuthon project. The `HTÜPAntwort` class now focuses solely on reading the response.
2024-01-14 22:06:32 +01:00
f61f72cb1b
Cleanup and standardize string delimiters
Removed unused imports in dictionary initialization and standardized quote usage for string literals in the transformer module. These changes promote code consistency and reduce clutter, making the codebase cleaner and more maintainable. Additionally, includes minor formatting improvements for readability.
2024-01-14 21:43:26 +01:00
6add03fe4e
Initial implementation of Deuthon interpreter
Introduced the Deuthon language interpreter for parsing and executing code written with German-like syntax in Python. Added infrastructure files, including a .gitignore, LICENSE, and pyproject.toml, defining the project setup and metadata. Implemented core modules to handle the language-specific logic, such as token transformations, custom import hooks, and wrappers for standard library modules with German names. This foundation enables the development and testing of Deuthon scripts, laying the groundwork for future enhancements and community contributions.
2024-01-14 19:44:16 +01:00