generated from eanorambuena/Driver
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
832aa36
commit d9d4f8f
Showing
57 changed files
with
1,924 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from eggdriver.driver import init | ||
from eggdriver.library import * | ||
from eggdriver.news import * | ||
from eggdriver.resources import * | ||
from eggdriver.app import * | ||
from eggdriver.pypi import * | ||
from eggdriver.version import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from eggdriver.app import eggConsole | ||
import sys | ||
|
||
for command in sys.argv[1:]: | ||
if command == "console": | ||
eggConsole() | ||
else: | ||
try: | ||
eggConsole(str(command)) | ||
except: | ||
print("Error: Please write the command accurately") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
from eggdriver.resources.console import get, clearConsole, pg | ||
from eggdriver.resources.constants import white, blue, green | ||
from eggdriver.resources.modules import installFromRequests, upgrade, Repo | ||
from eggdriver.resources.help import welcome | ||
from eggdriver.resources.auth import login, register | ||
|
||
""" | ||
FUNCTION eggConsole(command = None) | ||
Display the Eggdriver Console | ||
Currently, the Eggdriver Console commands are: | ||
$nqs Start the NQS Depeloper console | ||
$new Start the News Journalist console | ||
$login Log in Egg-cosystem *comming soon* | ||
$register Register in Egg-cosystem *comming soon* | ||
$install Install a pip package | ||
$upgrade Upgrade a pip package | ||
$pull Import a package stored on a GitHUb repository *comming soon: currently, just use github_com package* | ||
$help Get started command | ||
$clear Clear the Egg Console | ||
$end End the Eggdriver Console | ||
WARNING: | ||
Always use $end command in every console you run | ||
""" | ||
def eggConsole(command = None): | ||
"""Display the Eggdriver Console""" | ||
print(white + "Eggdriver Console is now running") | ||
condition = True | ||
logged = False | ||
while condition: | ||
if command == None: | ||
i = get("egg") | ||
else: | ||
i = "$" + str(command) | ||
print(blue + "$egg> " + green + i + white + "executed") | ||
condition = False | ||
if i == "$nqs": | ||
from nqs import developerConsole | ||
developerConsole() | ||
elif i == "$new": | ||
from eggdriver.news import journalistConsole | ||
journalistConsole() | ||
elif i == "$login": | ||
logged = login() | ||
elif i == "$register": | ||
register() | ||
elif i == "$install": | ||
name = pg("Package:") | ||
installFromRequests([name], False) | ||
elif i == "$upgrade": | ||
name = pg("Package:") | ||
upgrade(name) | ||
elif i == "$pull": | ||
org = pg("User or Organization:") | ||
name = pg("Repository:") | ||
repo = Repo(org, name) | ||
repo.pull() | ||
elif i == "$help": | ||
welcome() | ||
elif i == "$clear": | ||
clearConsole() | ||
elif i == "$end": | ||
print(white + "Eggdriver Console stopped running") | ||
return None | ||
else: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from eggdriver.resources.modules import installFromRequests, install_option_1 | ||
from eggdriver.resources.console import sleep | ||
from eggdriver.resources.server import Server | ||
|
||
""" | ||
FUNCTION init() | ||
Initialize Repository: | ||
- Upgrade pip | ||
- Install all the packages in requests file | ||
Eg: | ||
init() | ||
>>> Requirement already satisfied: pip in <root> (21.2.4) | ||
""" | ||
def init(): | ||
"""Upgrade pip and install all the packages in requests file""" | ||
install_option_1("$upgrade") # Upgrade pip | ||
sleep(10) # Waits 10 ms | ||
installFromRequests() # Install all the packages in requests file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from eggdriver.library.repos import * | ||
|
||
author="eanorambuena" | ||
_author_email="eanorambuena@uc.cl" | ||
|
||
eggConsoleCommands=[ | ||
"nqs", | ||
"new", | ||
"login," | ||
"register", | ||
"install", | ||
"upgrade", | ||
"pull", | ||
"help", | ||
"clear", | ||
"end" | ||
] | ||
|
||
developerConsoleCommands=[ | ||
"display", | ||
"compile", | ||
"save", | ||
"run", | ||
"end", | ||
"delay" | ||
] | ||
|
||
nqsCommands=[ | ||
"host", | ||
"shots", | ||
"hist", | ||
"draw", | ||
"inject", | ||
"function", | ||
"clear", | ||
"delay" | ||
] | ||
|
||
journalistConsoleCommands=[ | ||
"save", | ||
"end", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
_author = "eanorambuena" | ||
_author_email = "eanorambuena@uc.cl" | ||
|
||
eggConsoleCommands = [ | ||
"nqs", | ||
"new", | ||
"login," | ||
"register", | ||
"install", | ||
"upgrade", | ||
"pull", | ||
"help", | ||
"clear", | ||
"end" | ||
] | ||
|
||
developerConsoleCommands = [ | ||
"display", | ||
"compile", | ||
"save", | ||
"run", | ||
"delay", | ||
"end" | ||
] | ||
|
||
nqsCommands = [ | ||
"host", | ||
"shots", | ||
"hist", | ||
"draw", | ||
"inject", | ||
"function", | ||
"clear", | ||
"delay" | ||
] | ||
|
||
journalistConsoleCommands = [ | ||
"save", | ||
"end" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from eggdriver.resources.modules import Repo | ||
|
||
# NQS=Repo("PythonForChange", "eggdriver") | ||
# nqs=NQS.pull("nqs") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from eggdriver.news.app import * | ||
from eggdriver.news.config import * | ||
from eggdriver.news.news import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#Imports | ||
from eggdriver.news.news import New | ||
from eggdriver.news.config import files, year | ||
from eggdriver.resources.console import get | ||
from eggdriver.resources.constants import * | ||
|
||
def journalistConsole(condition: bool = True): | ||
print(white + "Journalist Console is now running") | ||
while condition: | ||
print(white + "Title:") | ||
title=get("new") | ||
print(white + "Day:") | ||
day=int(get("new")) | ||
print(white + "Month:") | ||
month=int(get("new")) | ||
new=New(title, day, month, year, files) | ||
print(white + "Tags:") | ||
tagsbycommas = get("new") | ||
new.tags = tagsbycommas.split(", ") | ||
print(white + "Content:") | ||
content = "" | ||
while True: | ||
i = get("new") | ||
if i == "$save": | ||
new.text = content | ||
new.add() | ||
break | ||
elif i[0] == "$": | ||
print(white + "Error: NQS could not found the command \"" + i + " \"") | ||
else: | ||
content += i + "\n" | ||
print(white + "Write $end to close the console") | ||
print(white + "Press enter key to write other new") | ||
command = get("new") | ||
if command == "$end": | ||
print(white + "Journalist Console stopped running") | ||
return "done" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from datetime import date | ||
todaysDate = date.today() | ||
|
||
# News Config | ||
files = ["README.md"] | ||
year = int(todaysDate.year) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
from eggdriver.resources.console import sleep | ||
|
||
class New(): | ||
def __init__(self, title: str, day: int, month: int, year: int = 2021, files = ["README.md"]): | ||
self.title = title | ||
if day < 10: | ||
newday = "0" + str(day) | ||
else: | ||
newday = str(day) | ||
if month < 10: | ||
newmonth = "0" + str(month) | ||
else: | ||
newmonth = str(month) | ||
self.date = newmonth + "/" + newday + "/" + str(year) | ||
self.place = "Santiago, Chile" | ||
self.text = "" | ||
self.tags = [] | ||
self.files = files | ||
def tag(self, text: str): | ||
try: | ||
self.tags.append(text) | ||
except: | ||
print("A tagging bug was happen") | ||
def format(self): | ||
t = "\n### " + self.title + "\n#### " + self.date + " " + self.place | ||
t += "\n##### Tags: " | ||
try: | ||
for i in self.tags: | ||
t += "[" + i + "](https://github.com/topics/" + i + ")" | ||
except: | ||
pass | ||
t += "\n" + self.text + "\n" | ||
return t | ||
def add(self): | ||
try: | ||
T = self.format() | ||
try: | ||
for i in self.files: | ||
f = open(i,"a") | ||
f.write(T) | ||
print("Writting the new in " + i) | ||
sleep(100) | ||
f.close() | ||
print("New added succesfully") | ||
print("Title: " + self.title) | ||
print("Date: " + self.date) | ||
print("Content: " + preview(self.text.split())) | ||
except: | ||
print("A writting bug was happen") | ||
except: | ||
print("A formatting bug was happen") | ||
|
||
def preview(string: str): | ||
preview = "" | ||
try: | ||
preview += string[0] | ||
except: | ||
pass | ||
try: | ||
preview += " " + string[1] | ||
except: | ||
pass | ||
try: | ||
preview += " " + string[2] | ||
except: | ||
pass | ||
try: | ||
preview += " "+ string[3] | ||
except: | ||
pass | ||
preview += "..." | ||
return preview |
Oops, something went wrong.