Skip to content

Commit

Permalink
🐛 Make __dict__ a readonly property
Browse files Browse the repository at this point in the history
  • Loading branch information
Billyzou0741326 committed Nov 7, 2023
1 parent 146241a commit 36b308e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/applications/input/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl PyArtifact {
))
}

#[getter]
pub fn __dict__(&self, py: Python) -> PyResult<PyObject> {
let dict = PyDict::new(py);
dict.set_item("set_name", self.set_name.as_ref(py))?;
Expand Down
1 change: 1 addition & 0 deletions src/applications/input/buff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ impl PyBuffInterface {
Ok(format!("BuffInterface(name={}, config={})", name, config_repr))
}

#[getter]
pub fn __dict__(&self, py: Python) -> PyResult<PyObject> {
let dict = PyDict::new(py);
let name_str = self.name.as_ref(py).to_str()?;
Expand Down
2 changes: 1 addition & 1 deletion src/applications/input/character.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 1 addition & 0 deletions src/applications/input/enemy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl PyEnemyInterface {
))
}

#[getter]
pub fn __dict__(&self, py: Python) -> PyResult<PyObject> {
let dict = PyDict::new(py);
dict.set_item("level", self.level)?;
Expand Down
1 change: 1 addition & 0 deletions src/applications/input/skill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl PySkillInterface {
Ok(format!("SkillInterface(index: {}, config: {:?})", self.index, self.config))
}

#[getter]
pub fn __dict__(&self, py: Python) -> PyResult<PyObject> {
let dict = PyDict::new(py);
dict.set_item("index", self.index)?;
Expand Down
1 change: 1 addition & 0 deletions src/applications/input/weapon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl PyWeaponInterface {
))
}

#[getter]
pub fn __dict__(&self, py: Python) -> PyResult<PyObject> {
let dict = PyDict::new(py);
dict.set_item("name", self.name.as_ref(py))?;
Expand Down

0 comments on commit 36b308e

Please sign in to comment.