%global _empty_manifest_terminate_build 0 Name: python-InfixParser Version: 3.1.4 Release: 1 Summary: Evaluate infix math expresion in python with ease. License: MIT URL: https://github.com/KJ002/Py-MathParser Source0: https://mirrors.nju.edu.cn/pypi/web/packages/76/16/14368fd66406be1d51855a85c2be8671d455bc9287c100c56e6271fad080/InfixParser-3.1.4.tar.gz %description # InfixParser InfixParser is a Python binding for MathParser (https://github.com/KJ002/MathParser/). This module allows for a simple and quick evaluation of strings. It allows you to evaluate a string with security, you define the external variables! ## Examples ### Basic Eval ```py result: float = InfixParser.evaluate("1+1") # returns 2.0 ``` ### Basic Eval (With Evaluator Class) ```py evaluator = InfixParser.Evaluator() result: float = evaluator.eval("1+1") # returns 2.0 ``` ### External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result: float = evaluator.eval("1+x") # returns 21.0 ``` ### Updating External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result1: float = evaluator.eval("1+x") # returns 21.0 x: int = 10 evaluator.append_variable("x", x) result2: float = evaluator.eval("1+x") # returns 11.0 ``` ### Functions Eval ```py """ It is important to note that function do not have to have to be called with in an instantiated class and can just be called with InfixParser.evaluate() """ evaluator = InfixParser.Evaluator() result: float = evaluator.eval("sin(1.5707963267948966)") # returns 1.0 ``` %package -n python3-InfixParser Summary: Evaluate infix math expresion in python with ease. Provides: python-InfixParser BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip BuildRequires: python3-cffi BuildRequires: gcc BuildRequires: gdb %description -n python3-InfixParser # InfixParser InfixParser is a Python binding for MathParser (https://github.com/KJ002/MathParser/). This module allows for a simple and quick evaluation of strings. It allows you to evaluate a string with security, you define the external variables! ## Examples ### Basic Eval ```py result: float = InfixParser.evaluate("1+1") # returns 2.0 ``` ### Basic Eval (With Evaluator Class) ```py evaluator = InfixParser.Evaluator() result: float = evaluator.eval("1+1") # returns 2.0 ``` ### External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result: float = evaluator.eval("1+x") # returns 21.0 ``` ### Updating External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result1: float = evaluator.eval("1+x") # returns 21.0 x: int = 10 evaluator.append_variable("x", x) result2: float = evaluator.eval("1+x") # returns 11.0 ``` ### Functions Eval ```py """ It is important to note that function do not have to have to be called with in an instantiated class and can just be called with InfixParser.evaluate() """ evaluator = InfixParser.Evaluator() result: float = evaluator.eval("sin(1.5707963267948966)") # returns 1.0 ``` %package help Summary: Development documents and examples for InfixParser Provides: python3-InfixParser-doc %description help # InfixParser InfixParser is a Python binding for MathParser (https://github.com/KJ002/MathParser/). This module allows for a simple and quick evaluation of strings. It allows you to evaluate a string with security, you define the external variables! ## Examples ### Basic Eval ```py result: float = InfixParser.evaluate("1+1") # returns 2.0 ``` ### Basic Eval (With Evaluator Class) ```py evaluator = InfixParser.Evaluator() result: float = evaluator.eval("1+1") # returns 2.0 ``` ### External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result: float = evaluator.eval("1+x") # returns 21.0 ``` ### Updating External Variable Eval ```py evaluator = InfixParser.Evaluator() x: int = 20 evaluator.append_variable("x", x) result1: float = evaluator.eval("1+x") # returns 21.0 x: int = 10 evaluator.append_variable("x", x) result2: float = evaluator.eval("1+x") # returns 11.0 ``` ### Functions Eval ```py """ It is important to note that function do not have to have to be called with in an instantiated class and can just be called with InfixParser.evaluate() """ evaluator = InfixParser.Evaluator() result: float = evaluator.eval("sin(1.5707963267948966)") # returns 1.0 ``` %prep %autosetup -n InfixParser-3.1.4 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-InfixParser -f filelist.lst %dir %{python3_sitearch}/* %files help -f doclist.lst %{_docdir}/* %changelog * Mon May 15 2023 Python_Bot - 3.1.4-1 - Package Spec generated