Skip to content

Commit 7007d44

Browse files
committed
0.0.1a1
1 parent d7bc9e5 commit 7007d44

File tree

115 files changed

+1538
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+1538
-15
lines changed

build/lib/eggdriver/__init__.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from eggdriver.driver import init
2+
from eggdriver.library import *
3+
from eggdriver.news import *
4+
from eggdriver.nqs import *
5+
from eggdriver.resources import *
6+
from eggdriver.app import *

build/lib/eggdriver/app.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Imports
2+
from eggdriver.resources.console import get, clearConsole
3+
from eggdriver.resources.constants import *
4+
from eggdriver.resources.modules import install, upgrade, Repo
5+
from eggdriver.resources.help import help
6+
from eggdriver.resources.auth import login, register
7+
8+
"""
9+
FUNCTION eggConsole(condition: bool = True)
10+
11+
Display the Egg Console
12+
Currently, the Egg Console commands are:
13+
14+
$nqs Start the NQS Depeloper console
15+
$new Start the News Journalist console
16+
$login Log in Egg-cosystem *comming soon*
17+
$register Register in Egg-cosystem *comming soon*
18+
$install Install a pip package
19+
$upgrade Upgrade a pip package
20+
$pull Import a package stored on a GitHUb repository *comming soon: currently, just use github_com package*
21+
$help Get started command
22+
$clear Clear the Egg Console
23+
$end End the Egg Console
24+
25+
WARNING:
26+
Always use $end command in every console you run
27+
*ONLY use a condition different to True as an argument of eggConsole(condition) if you know what are you doing**
28+
This is the reason why condition only allows <<bool>> as data type
29+
"""
30+
def eggConsole(condition: bool = True):
31+
print(white+"Egg Console is now running")
32+
logged=0
33+
while condition:
34+
i=get("egg")
35+
if i=="$nqs":
36+
from nqs.developer.app import developerConsole
37+
developerConsole()
38+
elif i=="$new":
39+
from news.app import journalistConsole
40+
journalistConsole()
41+
elif i=="$login":
42+
login()
43+
elif i=="$register":
44+
register()
45+
elif i=="$install":
46+
print(white+"Package:")
47+
name=get("egg")
48+
install(name)
49+
elif i=="$upgrade":
50+
print(white+"Package:")
51+
name=get("egg")
52+
upgrade(name)
53+
elif i=="$pull":
54+
print(white+"Repo:")
55+
name=get("egg")
56+
repo=Repo(name)
57+
print(white+"Package:")
58+
package=get("egg")
59+
last=repo.pull(package)
60+
# *comming soon*
61+
elif i=="$help":
62+
help()
63+
elif i=="$clear":
64+
clearConsole()
65+
elif i=="$end":
66+
print(white+"Egg Console stopped running")
67+
return "done"
68+
else:
69+
pass
File renamed without changes.
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from eggdriver.library.repos import *
2+
3+
author="eanorambuena"
4+
_author_email="[email protected]"
5+
6+
eggConsoleCommands=[
7+
"nqs",
8+
"new",
9+
"login,"
10+
"register",
11+
"install",
12+
"upgrade",
13+
"pull",
14+
"help",
15+
"clear",
16+
"end"
17+
]
18+
19+
developerConsoleCommands=[
20+
"display",
21+
"compile",
22+
"save",
23+
"run",
24+
"end",
25+
"delay"
26+
]
27+
28+
nqsCommands=[
29+
"host",
30+
"shots",
31+
"hist",
32+
"draw",
33+
"inject",
34+
"function",
35+
"clear",
36+
"delay"
37+
]
38+
39+
journalistConsoleCommands=[
40+
"save",
41+
"end",
42+
]
File renamed without changes.

build/lib/eggdriver/library/repos.py

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from eggdriver.resources.modules import Repo
2+
3+
NQS=Repo("NQS")
4+
nqs=NQS.pull("nqs")

build/lib/eggdriver/news/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from eggdriver.news.app import *
2+
from eggdriver.news.config import *
3+
from eggdriver.news.news import *

build/lib/eggdriver/news/app.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#Imports
2+
from eggdriver.news.news import New
3+
from eggdriver.news.config import files, year
4+
from eggdriver.resources.console import get
5+
from eggdriver.resources.constants import *
6+
7+
def journalistConsole(condition: bool = True):
8+
print(white + "Journalist Console is now running")
9+
while condition:
10+
print(white + "Title:")
11+
title=get("new")
12+
print(white + "Day:")
13+
day=int(get("new"))
14+
print(white + "Month:")
15+
month=int(get("new"))
16+
new=New(title, day, month, year, files)
17+
print(white + "Tags:")
18+
tagsbycommas = get("new")
19+
new.tags = tagsbycommas.split(", ")
20+
print(white + "Content:")
21+
content = ""
22+
while True:
23+
i = get("new")
24+
if i == "$save":
25+
new.text = content
26+
new.add()
27+
break
28+
elif i[0] == "$":
29+
print(white + "Error: NQS could not found the command \"" + i + " \"")
30+
else:
31+
content += i + "\n"
32+
print(white + "Write $end to close the console")
33+
print(white + "Press enter key to write other new")
34+
command = get("new")
35+
if command == "$end":
36+
print(white + "Journalist Console stopped running")
37+
return "done"
38+

build/lib/eggdriver/news/config.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from datetime import date
2+
todaysDate = date.today()
3+
4+
#News Config
5+
files = ["README.md"]
6+
year = int(todaysDate.year)

build/lib/eggdriver/news/news.py

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
from eggdriver.resources.console import sleep
2+
3+
class New():
4+
def __init__(self, title: str, day: int, month: int, year: int = 2021, files = ["README.md"]):
5+
self.title = title
6+
if day < 10:
7+
newday = "0" + str(day)
8+
else:
9+
newday = str(day)
10+
if month < 10:
11+
newmonth = "0" + str(month)
12+
else:
13+
newmonth = str(month)
14+
self.date = newmonth + "/" + newday + "/" + str(year)
15+
self.place = "Santiago, Chile"
16+
self.text = ""
17+
self.tags = []
18+
self.files = files
19+
def tag(self, text: str):
20+
try:
21+
self.tags.append(text)
22+
except:
23+
print("A tagging bug was happen")
24+
def format(self):
25+
t = "\n### " + self.title + "\n#### " + self.date + " " + self.place
26+
t += "\n##### Tags: "
27+
try:
28+
for i in self.tags:
29+
t += "[" + i + "](https://github.com/topics/" + i + ")"
30+
except:
31+
pass
32+
t += "\n" + self.text + "\n"
33+
return t
34+
def add(self):
35+
try:
36+
T = self.format()
37+
try:
38+
for i in self.files:
39+
f = open(i,"a")
40+
f.write(T)
41+
print("Writting the new in " + i)
42+
sleep(100)
43+
f.close()
44+
print("New added succesfully")
45+
print("Title: " + self.title)
46+
print("Date: " + self.date)
47+
print("Content: " + preview(self.text.split()))
48+
except:
49+
print("A writting bug was happen")
50+
except:
51+
print("A formatting bug was happen")
52+
53+
def preview(string: str):
54+
preview = ""
55+
try:
56+
preview += string[0]
57+
except:
58+
pass
59+
try:
60+
preview += " " + string[1]
61+
except:
62+
pass
63+
try:
64+
preview += " " + string[2]
65+
except:
66+
pass
67+
try:
68+
preview += " "+ string[3]
69+
except:
70+
pass
71+
preview += "..."
72+
return preview

build/lib/eggdriver/nqs/__init__.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from eggdriver.nqs.core import *
2+
from eggdriver.nqs.developer import *
3+
4+
_author="eanorambuena"
5+
_author_email="[email protected]"
6+
7+
nqsCommands=[
8+
"host",
9+
"shots",
10+
"hist",
11+
"draw",
12+
"inject",
13+
"function",
14+
"clear",
15+
"delay"
16+
]
17+
18+
consoleCommands=[
19+
"display",
20+
"compile",
21+
"save",
22+
"run",
23+
"end",
24+
"delay"
25+
]
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from eggdriver.nqs.core.core import *
2+
from eggdriver.nqs.core.functions import *
3+
from eggdriver.nqs.core.quantum import *
4+
from eggdriver.nqs.core.reader import *
5+
6+
_author="eanorambuena"
7+
_author_email="[email protected]"

build/lib/eggdriver/nqs/core/core.py

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from eggdriver.nqs.core.reader import settings
2+
from eggdriver.nqs.core.quantum import quantum
3+
from eggdriver.resources.extensions import nqa
4+
from eggdriver.resources.parser import Parser
5+
6+
def compile(name: str):
7+
lines=nqa.getLines(name)
8+
T="from user.index import Index\n"
9+
m=0
10+
s=0
11+
command=""
12+
param=""
13+
Q=0
14+
gate=""
15+
gatecount=0
16+
qdef=0
17+
p=Parser()
18+
for k in lines:
19+
for i in k:
20+
if p.isDeny(i):
21+
if m==2:
22+
m=0
23+
else:
24+
m=2
25+
elif s==1: #settings mode on
26+
if i!=" ":
27+
command+=i
28+
else:
29+
s=2
30+
elif s==2:
31+
if i!="\t" and i!="\n":
32+
param+=i
33+
else:
34+
T+=settings(command,param)
35+
command=""
36+
param=""
37+
s=0
38+
elif i=="$":
39+
s=1
40+
elif qdef==1:
41+
if i=="q":
42+
Q+=1
43+
elif i=="\n":
44+
qdef=2
45+
T+="from qiskit import QuantumCircuit, execute, Aer\n"
46+
T+="from qiskit.visualization import plot_histogram,display\n"
47+
T+="circuit=QuantumCircuit("+str(Q)+","+str(Q)+")\n"
48+
elif qdef==2:
49+
if i!="\n" and i!=" ":
50+
gate+=i
51+
elif i==" ":
52+
gatecount+=0.5
53+
T+=quantum(gate,gatecount)
54+
gate=""
55+
else:
56+
T+=quantum(gate,gatecount)
57+
gate=""
58+
gatecount=0
59+
elif i=="q":
60+
qdef=1
61+
Q+=1
62+
return T

0 commit comments

Comments
 (0)