From 36b308e70a9d9e7c8f8fd6f53d3062bfccf4217b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kotori=E3=81=AE=E3=81=AD=E3=81=93?= Date: Tue, 7 Nov 2023 10:11:07 -0600 Subject: [PATCH] :bug: Make `__dict__` a readonly property --- src/applications/input/artifact.rs | 1 + src/applications/input/buff.rs | 1 + src/applications/input/character.rs | 2 +- src/applications/input/enemy.rs | 1 + src/applications/input/skill.rs | 1 + src/applications/input/weapon.rs | 1 + 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/applications/input/artifact.rs b/src/applications/input/artifact.rs index 89de39e..7b1df2e 100644 --- a/src/applications/input/artifact.rs +++ b/src/applications/input/artifact.rs @@ -58,6 +58,7 @@ impl PyArtifact { )) } + #[getter] pub fn __dict__(&self, py: Python) -> PyResult { let dict = PyDict::new(py); dict.set_item("set_name", self.set_name.as_ref(py))?; diff --git a/src/applications/input/buff.rs b/src/applications/input/buff.rs index 1ed2b1a..61144a6 100644 --- a/src/applications/input/buff.rs +++ b/src/applications/input/buff.rs @@ -33,6 +33,7 @@ impl PyBuffInterface { Ok(format!("BuffInterface(name={}, config={})", name, config_repr)) } + #[getter] pub fn __dict__(&self, py: Python) -> PyResult { let dict = PyDict::new(py); let name_str = self.name.as_ref(py).to_str()?; diff --git a/src/applications/input/character.rs b/src/applications/input/character.rs index 0dcb1b7..fe222e0 100644 --- a/src/applications/input/character.rs +++ b/src/applications/input/character.rs @@ -1,7 +1,7 @@ use anyhow::Context; use pyo3::prelude::*; use pyo3::types::PyDict; -use pythonize::{depythonize ,pythonize}; +use pythonize::depythonize; use std::str::FromStr; use mona::character::{CharacterConfig, CharacterName}; diff --git a/src/applications/input/enemy.rs b/src/applications/input/enemy.rs index 9a7dd4f..3267b71 100644 --- a/src/applications/input/enemy.rs +++ b/src/applications/input/enemy.rs @@ -68,6 +68,7 @@ impl PyEnemyInterface { )) } + #[getter] pub fn __dict__(&self, py: Python) -> PyResult { let dict = PyDict::new(py); dict.set_item("level", self.level)?; diff --git a/src/applications/input/skill.rs b/src/applications/input/skill.rs index f3e0bdc..acad3f6 100644 --- a/src/applications/input/skill.rs +++ b/src/applications/input/skill.rs @@ -25,6 +25,7 @@ impl PySkillInterface { Ok(format!("SkillInterface(index: {}, config: {:?})", self.index, self.config)) } + #[getter] pub fn __dict__(&self, py: Python) -> PyResult { let dict = PyDict::new(py); dict.set_item("index", self.index)?; diff --git a/src/applications/input/weapon.rs b/src/applications/input/weapon.rs index 127abf7..2b35a79 100644 --- a/src/applications/input/weapon.rs +++ b/src/applications/input/weapon.rs @@ -52,6 +52,7 @@ impl PyWeaponInterface { )) } + #[getter] pub fn __dict__(&self, py: Python) -> PyResult { let dict = PyDict::new(py); dict.set_item("name", self.name.as_ref(py))?;