mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-13 20:56:54 +01:00
module 06
This commit is contained in:
@@ -9,6 +9,8 @@ def read_ancient_text() -> None:
|
|||||||
print("\nData recovery complete. Storage unit disconnected.")
|
print("\nData recovery complete. Storage unit disconnected.")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
print("ERROR: Storage vault not found.")
|
print("ERROR: Storage vault not found.")
|
||||||
|
except Exception as err:
|
||||||
|
print(err)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import sys
|
|||||||
|
|
||||||
|
|
||||||
def communication_system() -> None:
|
def communication_system() -> None:
|
||||||
print("=== CYBER ARCHIVES - COMMUNICATION SYSTEM ===")
|
print("=== CYBER ARCHIVES - COMMUNICATION SYSTEM ===\n")
|
||||||
sys.stdout.write("\nInput Stream active. Enter archivist ID: ")
|
sys.stdout.write("Input Stream active. Enter archivist ID: ")
|
||||||
archivist_id = input()
|
archivist_id = input()
|
||||||
sys.stdout.write("Input Stream active. Enter status report: ")
|
sys.stdout.write("Input Stream active. Enter status report: ")
|
||||||
status_report = input()
|
status_report = input()
|
||||||
|
|||||||
@@ -1,13 +1,43 @@
|
|||||||
def ingredients_validation() -> None:
|
def ingredients_validation() -> None:
|
||||||
import alchemy.grimoire
|
from alchemy.grimoire.validator import validate_ingredients
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f'validate_ingredients("fire air"): {validate_ingredients("fire air")}'
|
f'validate_ingredients("fire air"): {validate_ingredients("fire air")}'
|
||||||
)
|
)
|
||||||
|
print(
|
||||||
|
f'validate_ingredients("dragon scale"): {validate_ingredients("dragon scale")}'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def spell_recording_test() -> None:
|
||||||
|
from alchemy.grimoire.spellbook import record_spell
|
||||||
|
|
||||||
|
print(
|
||||||
|
f'record_spell("Fireball", "fire air"): {record_spell("Fireball", "fire air")}'
|
||||||
|
)
|
||||||
|
print(
|
||||||
|
f'record_spell("Dark Magic", "shadow"): {record_spell("Dark Magic", "shadow")}'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def late_import_test() -> None:
|
||||||
|
from alchemy.grimoire.spellbook import record_spell
|
||||||
|
|
||||||
|
print(
|
||||||
|
f'record_spell("Lightning", "air"): {record_spell("Lightning", "air")}'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
|
print("=== Circular Curse Breaking ===\n")
|
||||||
|
print("Testing ingredient validation:")
|
||||||
ingredients_validation()
|
ingredients_validation()
|
||||||
|
print("\nTesting spell recording with validation:")
|
||||||
|
spell_recording_test()
|
||||||
|
print("\nTesting late import technique:")
|
||||||
|
late_import_test()
|
||||||
|
print("\nCircular dependency curse avoided using late imports!")
|
||||||
|
print("All spells processed safely!")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Reference in New Issue
Block a user