diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 0000000..5b6e8b1 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,13 @@ +[files] +extend-exclude = ["**/*_gen.mbt"] + +[default.extend-identifiers] +IDentifier = "IDentifier" + +[default] +extend-ignore-re = [ + # ignore string literals + "pen.ba\\(distance\\)", + "\"(.*?)\"", + ".*#|.*", +] diff --git a/bool.mbt b/bool.mbt index ec9cef7..bea3d6b 100644 --- a/bool.mbt +++ b/bool.mbt @@ -8,9 +8,9 @@ pub struct PyBool { } ///| Create a python boolean object from a python object. -/// If the object is not a boolean, it will raise a TypeMisMatchError. +/// If the object is not a boolean, it will raise a TypeMismatchError. pub fn PyBool::create(obj : PyObject) -> PyBool raise PyRuntimeError { - guard obj.is_bool() else { raise TypeMisMatchError } + guard obj.is_bool() else { raise TypeMismatchError } PyBool::{ obj, } } @@ -20,11 +20,11 @@ fn PyBool::create_unchecked(obj : PyObject) -> PyBool { } ///| Create a python boolean object from a python object reference. -/// If the object is not a boolean, it will raise a TypeMisMatchError. +/// If the object is not a boolean, it will raise a TypeMismatchError. pub fn PyBool::create_by_ref( obj_ref : @cpython.PyObjectRef, ) -> PyBool raise PyRuntimeError { - guard @cpython.py_bool_check(obj_ref) else { raise TypeMisMatchError } + guard @cpython.py_bool_check(obj_ref) else { raise TypeMismatchError } PyBool::{ obj: PyObject::create(obj_ref) } } diff --git a/callable.mbt b/callable.mbt index f105417..69d3a9b 100644 --- a/callable.mbt +++ b/callable.mbt @@ -8,9 +8,9 @@ pub struct PyCallable { } ///| Create a python callable object from a PyObject. -/// If the object is not callable, a TypeMisMatchError is raised. +/// If the object is not callable, a TypeMismatchError is raised. pub fn PyCallable::create(obj : PyObject) -> PyCallable raise PyRuntimeError { - guard obj.is_callable() else { raise TypeMisMatchError } + guard obj.is_callable() else { raise TypeMismatchError } PyCallable::{ obj, } } @@ -20,11 +20,11 @@ fn PyCallable::create_unchecked(obj : PyObject) -> PyCallable { } ///| Create a python callable object from a PyObjectRef. -/// If the object is not callable, a TypeMisMatchError is raised. +/// If the object is not callable, a TypeMismatchError is raised. pub fn PyCallable::create_by_ref( obj : @cpython.PyObjectRef, ) -> PyCallable raise PyRuntimeError { - guard @cpython.py_callable_check(obj) else { raise TypeMisMatchError } + guard @cpython.py_callable_check(obj) else { raise TypeMismatchError } PyCallable::{ obj: PyObject::create(obj) } } diff --git a/dict.mbt b/dict.mbt index 50e4d35..9f0daca 100644 --- a/dict.mbt +++ b/dict.mbt @@ -8,9 +8,9 @@ pub struct PyDict { } ///| Create a python dict object. -/// If the python object is not a dict, it will raise a TypeMisMatchError. +/// If the python object is not a dict, it will raise a TypeMismatchError. pub fn PyDict::create(obj : PyObject) -> PyDict raise PyRuntimeError { - guard obj.is_dict() else { raise TypeMisMatchError } + guard obj.is_dict() else { raise TypeMismatchError } PyDict::{ obj, } } @@ -20,11 +20,11 @@ fn PyDict::create_unchecked(obj : PyObject) -> PyDict { } ///| Create a python dict object from a python object reference. -/// If the python object is not a dict, it will raise a TypeMisMatchError. +/// If the python object is not a dict, it will raise a TypeMismatchError. pub fn PyDict::create_by_ref( obj : @cpython.PyObjectRef, ) -> PyDict raise PyRuntimeError { - guard @cpython.py_dict_check(obj) else { raise TypeMisMatchError } + guard @cpython.py_dict_check(obj) else { raise TypeMismatchError } PyDict::{ obj: PyObject::create(obj) } } diff --git a/errors.mbt b/errors.mbt index b59613c..869699e 100644 --- a/errors.mbt +++ b/errors.mbt @@ -1,6 +1,6 @@ ///| pub suberror PyRuntimeError { - TypeMisMatchError + TypeMismatchError IndexOutOfBoundsError KeyIsUnHashableError InVokeError diff --git a/float.mbt b/float.mbt index ba2e904..702c0e6 100644 --- a/float.mbt +++ b/float.mbt @@ -4,9 +4,9 @@ pub struct PyFloat { } ///| Create a python float object from a python object. -/// If the python object is not a float, it will raise a TypeMisMatchError. +/// If the python object is not a float, it will raise a TypeMismatchError. pub fn PyFloat::create(obj : PyObject) -> PyFloat raise PyRuntimeError { - guard obj.is_float() else { raise TypeMisMatchError } + guard obj.is_float() else { raise TypeMismatchError } PyFloat::{ obj, } } @@ -15,12 +15,12 @@ fn PyFloat::create_unchecked(obj : PyObject) -> PyFloat { PyFloat::{ obj, } } -///| Ceate a python float object from a python object reference. -/// If the python object is not a float, it will raise a TypeMisMatchError. +///| Create a python float object from a python object reference. +/// If the python object is not a float, it will raise a TypeMismatchError. pub fn PyFloat::create_by_ref( obj : @cpython.PyObjectRef, ) -> PyFloat raise PyRuntimeError { - guard @cpython.py_float_check(obj) else { raise TypeMisMatchError } + guard @cpython.py_float_check(obj) else { raise TypeMismatchError } PyFloat::{ obj: PyObject::create(obj) } } @@ -58,7 +58,7 @@ pub fn PyFloat::to_double(self : PyFloat) -> Double { @cpython.py_float_as_double(self.obj_ref()) } -///| Print the PyFloat object direcly. +///| Print the PyFloat object directly. /// /// Different from use `println`, `dump` means we made python interpreter /// print the object directly. diff --git a/integer.mbt b/integer.mbt index b36be88..2d8496d 100644 --- a/integer.mbt +++ b/integer.mbt @@ -10,7 +10,7 @@ pub struct PyInteger { ///| Create a python integer object from a python object. /// If pub fn PyInteger::create(obj : PyObject) -> PyInteger raise PyRuntimeError { - guard obj.is_int() else { raise TypeMisMatchError } + guard obj.is_int() else { raise TypeMismatchError } PyInteger::{ obj, } } @@ -23,7 +23,7 @@ pub fn PyInteger::create_unchecked(obj : PyObject) -> PyInteger { pub fn PyInteger::create_by_ref( obj : @cpython.PyObjectRef, ) -> PyInteger raise PyRuntimeError { - guard @cpython.py_int_check(obj) else { raise TypeMisMatchError } + guard @cpython.py_int_check(obj) else { raise TypeMismatchError } PyInteger::{ obj: PyObject::create(obj) } } @@ -73,7 +73,7 @@ pub fn PyInteger::to_double(self : PyInteger) -> Double { @cpython.py_long_as_double(self.obj_ref()) } -///| Print the PyInteger object direcly. +///| Print the PyInteger object directly. /// /// Different from use `println`, `dump` means we made python interpreter /// print the object directly. diff --git a/list.mbt b/list.mbt index 213dc1d..ca62219 100644 --- a/list.mbt +++ b/list.mbt @@ -21,9 +21,9 @@ pub fn PyList::new() -> PyList { } ///| Create a python list object from a pyobject. -/// If the pyobject is not a list, it will raise a TypeMisMatchError. +/// If the pyobject is not a list, it will raise a TypeMismatchError. pub fn PyList::create(obj : PyObject) -> PyList raise PyRuntimeError { - guard obj.is_list() else { raise TypeMisMatchError } + guard obj.is_list() else { raise TypeMismatchError } PyList::{ obj, } } @@ -33,11 +33,11 @@ fn PyList::create_unchecked(obj : PyObject) -> PyList { } ///| Create a python list object from a pyobject reference. -/// If the pyobject is not a list, it will raise a TypeMisMatchError. +/// If the pyobject is not a list, it will raise a TypeMismatchError. pub fn PyList::create_by_ref( obj : @cpython.PyObjectRef, ) -> PyList raise PyRuntimeError { - guard @cpython.py_list_check(obj) else { raise TypeMisMatchError } + guard @cpython.py_list_check(obj) else { raise TypeMismatchError } PyList::{ obj: PyObject::create(obj) } } diff --git a/module.mbt b/module.mbt index ed8ba6b..ce9a570 100644 --- a/module.mbt +++ b/module.mbt @@ -11,7 +11,7 @@ pub struct PyModule { ///| pub fn PyModule::create(obj : PyObject) -> PyModule raise PyRuntimeError { - guard obj.is_module() else { raise TypeMisMatchError } + guard obj.is_module() else { raise TypeMismatchError } PyModule::{ obj, name: None, attrs: Map::new() } } @@ -24,7 +24,7 @@ fn PyModule::create_unchecked(obj : PyObject) -> PyModule { pub fn PyModule::create_by_ref( obj_ref : @cpython.PyObjectRef, ) -> PyModule raise PyRuntimeError { - guard @cpython.py_module_check(obj_ref) else { raise TypeMisMatchError } + guard @cpython.py_module_check(obj_ref) else { raise TypeMismatchError } PyModule::{ obj: PyObject::create(obj_ref), name: None, attrs: Map::new() } } diff --git a/python.mbti b/python.mbti index 9f42e20..4b6b30c 100644 --- a/python.mbti +++ b/python.mbti @@ -14,7 +14,7 @@ fn strip_quot(String) -> String // Errors pub suberror PyRuntimeError { - TypeMisMatchError + TypeMismatchError IndexOutOfBoundsError KeyIsUnHashableError InVokeError diff --git a/str.mbt b/str.mbt index 39dd5ea..7c1036f 100644 --- a/str.mbt +++ b/str.mbt @@ -8,9 +8,9 @@ pub struct PyString { } ///| Create a python string from a python object. -/// If the python object is not a string, it will raise a TypeMisMatchError. +/// If the python object is not a string, it will raise a TypeMismatchError. pub fn PyString::create(obj : PyObject) -> PyString raise PyRuntimeError { - guard obj.is_string() else { raise TypeMisMatchError } + guard obj.is_string() else { raise TypeMismatchError } PyString::{ obj, } } @@ -20,11 +20,11 @@ fn PyString::create_unchecked(obj : PyObject) -> PyString { } ///| Create a python string from a python object reference. -///If the python object is not a string, it will raise a TypeMisMatchError. +///If the python object is not a string, it will raise a TypeMismatchError. pub fn PyString::create_by_ref( obj_ref : @cpython.PyObjectRef, ) -> PyString raise PyRuntimeError { - guard @cpython.py_string_check(obj_ref) else { raise TypeMisMatchError } + guard @cpython.py_string_check(obj_ref) else { raise TypeMismatchError } PyString::{ obj: PyObject::create(obj_ref) } } @@ -54,7 +54,7 @@ pub fn PyString::from(s : String) -> PyString { } } -///| Print the PyString object direcly. +///| Print the PyString object directly. /// /// Different from use `println`, `dump` means we made python interpreter /// print the object directly. diff --git a/tuple.mbt b/tuple.mbt index 5847804..b7f7aaa 100644 --- a/tuple.mbt +++ b/tuple.mbt @@ -27,9 +27,9 @@ pub fn PyTuple::new(size : UInt64) -> PyTuple { } ///| Create a PyTuple object from a python object. -/// If the python object is not a tuple, it will raise a TypeMisMatchError. +/// If the python object is not a tuple, it will raise a TypeMismatchError. pub fn PyTuple::create(obj : PyObject) -> PyTuple raise PyRuntimeError { - guard obj.is_tuple() else { raise TypeMisMatchError } + guard obj.is_tuple() else { raise TypeMismatchError } PyTuple::{ obj, } } @@ -39,11 +39,11 @@ fn PyTuple::create_unchecked(obj : PyObject) -> PyTuple { } ///| Create a PyTuple object from a python object reference. -/// If the python object is not a tuple, it will raise a TypeMisMatchError. +/// If the python object is not a tuple, it will raise a TypeMismatchError. pub fn PyTuple::create_by_ref( obj_ref : @cpython.PyObjectRef, ) -> PyTuple raise PyRuntimeError { - guard @cpython.py_tuple_check(obj_ref) else { raise TypeMisMatchError } + guard @cpython.py_tuple_check(obj_ref) else { raise TypeMismatchError } PyTuple::{ obj: PyObject::create(obj_ref) } }