Skip to content

Commit

Permalink
laying ground for basic functionality #1
Browse files Browse the repository at this point in the history
  • Loading branch information
p0larstern committed Nov 26, 2018
1 parent e02e17a commit aca5d07
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
2 changes: 1 addition & 1 deletion possible_flags.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- [ ] -o -original
- [ ] -s --same
- the solution file have the name as the code of the question

> Checked options are working or will be included in future versions
Expand Down
18 changes: 12 additions & 6 deletions serve.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import sys,os
fileName = sys.argv[1]
if os.path.exists(fileName):
pass
else :
print("File not found!")
import argparse,site

parser = argparse.ArgumentParser(description="Submit your codechef's solution directly from command-line!!")
parser.add_argument("file", type=str, help="expects code of question in lowercase")
parser.add_argument("-s", "--same", help="solution file must have its name as the code of the question",
action="store_true")
args = parser.parse_args()
code = args.file
if args.same :
print("file name is same")
else:
print("file name is different")
14 changes: 10 additions & 4 deletions site.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from time import sleep
import user

current = user._users_("r")
current.openFile()
uname = current.userDetail("username")
current.closeFile()

options = Options()
options.headless = True
driver = webdriver.Firefox(options=options)
driver.get("http://google.com/")
print ("Headless Firefox Initialized")

print ("Done")
driver.get("http://codechef.com/node")
print("Headless Firefox Initialized")
print("Done")
input('Press anything to quit')
print("Finished")
driver.quit()
14 changes: 8 additions & 6 deletions user.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@ def showUsers(self):
for user in self.users:
for param in user:
print("%s : %s" % (param,user[param]))

def userDetail(self,param):
return self.users[0][param]

def closeFile(self):
self.userFile.close()
if self.userFile.closed :
del self.userFile

if __name__ == "__main__":
current = _users_("r")
current.openFile()
#current.addUser()
current.showUsers()
current.closeFile()
"""
(decomment this block for testing only)
if __name__ == "__main__" :
pass
"""
1 change: 1 addition & 0 deletions users.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{
"logged_in": 0,
"username": "polarstern",
"email": "paldhruv89@gmail.com"
}
Expand Down

0 comments on commit aca5d07

Please sign in to comment.