A python package which converts a mojo file (.mojo or .🔥) into a python file.
Project description
Mojo2py
A python package which converts a mojo file (.mojo or .🔥) into a python file.
Installation using pip
pip install mojo2py
pip3 install mojo2py
Or clone the repo
git clone git@github.com:venvis/mojo2py.git
Initialize a mojo file , for example (example.mojo or example.🔥) :
from python import Python
def matplotlib(x:PythonObject,y:PythonObject):
var plt=Python.import_module("matplotlib.pyplot")
var np=Python.import_module("numpy")
var xval=np.array(x)
var yval=np.array(y)
plt.plot(xval,yval)
plt.show()
fn show() raises:
try:
matplotlib([1,2,3,4,5],[6,7,8,9,10])
except:
print("Error")
fn main():
try:
show()
except:
pass
Create a python file , for example (trial.py) :
from mojo2py import convert #import the class to convert
file=convert("example.mojo") # or file=convert("example.🔥")
file.final() # Call the final method to generate example.py file from example.mojo
A file called example.py , with the same name as the mojo file will be created in the same directory and the code is as follows :
import matplotlib.pyplot as plt
import numpy as np
def matplotlib(x,y):
xval=np.array(x)
yval=np.array(y)
plt.plot(xval,yval)
plt.show()
def show():
try:
matplotlib([1,2,3,4,5],[6,7,8,9,10])
except:
print("Error")
def main():
try:
show()
except:
pass
if __name__=="__main__":
main()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Mojo2py-1.3.tar.gz
(3.1 kB
view details)
File details
Details for the file Mojo2py-1.3.tar.gz
.
File metadata
- Download URL: Mojo2py-1.3.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 867ad93d667d37e9bfcfb561747d123e3109e3454fb70e96ca2ea313c482f5ec |
|
MD5 | 13804d4c4bc1c234df4ad98aa3d9ad02 |
|
BLAKE2b-256 | 74d4599980f71d4ee411388f4bbf796ffffedf97941a7eb048cf1501399ec0a6 |