WIP: feature_genfix #9

Closed
s444383 wants to merge 3 commits from feature_genfix into master
3 changed files with 58 additions and 22 deletions

View File

@ -1,12 +1,3 @@
#Possible actions:
# - create repository
# - delete repository
# - list repositories
# - list respository issues
# - list repository pull requests
# - list notifications
# - list repository tests
repositoriesMock = ["repo1", "repo2", "repo3"] repositoriesMock = ["repo1", "repo2", "repo3"]
issuesMock = [ issuesMock = [
{ {

View File

@ -1,3 +1,4 @@
from apimock import *
import difflib as dl import difflib as dl
import random import random
import sys import sys
@ -37,7 +38,7 @@ bye = [
"Do zobaczenia", "Do zobaczenia",
"Do widzenia", "Do widzenia",
"Miłego dnia", "Miłego dnia",
"Do widzenia i miłego dnia" "Do widzenia i miłego dnia",
"Narazie" "Narazie"
] ]
@ -63,16 +64,53 @@ def generator_jezyka_nautalnego(frame, tactic, state, text):
if len(beastMatch) > 0: if len(beastMatch) > 0:
print(random.choice(other) + ', '.join(beastMatch)) print(random.choice(other) + ', '.join(beastMatch))
elif tactic[1] == 'help': elif tactic[0] == False: #ASK
print(f'Proszę podaj {tactic[1][0]}')
print()
elif tactic[0] == True:
_, act, req_args, opt_args = tactic
print('DEBUG: ', act, req_args, opt_args,sep = '\n')
if act == 'help':
print(random.choice(help)) print(random.choice(help))
print("Dostępne komendy: \n - " + '\n - '.join(commands)) print("Dostępne komendy: \n - " + '\n - '.join(commands))
elif tactic == 'bye': <<<<<<< HEAD
elif act == 'bye':
print(random.choice(bye)) print(random.choice(bye))
print() print()
sys.exit(0) sys.exit(0)
=======
elif tactic[0] == 'ANSWER' and tactic[1] == 'issues':
print("Lista issues w repozytorium " + tactic[2][0][1] + ":")
issues = listRepositoryIssues(tactic[2][0][1])
for issue in issues:
print(issue['name'])
print(issue['description'])
print(issue['status'])
print()
elif tactic[0] == 'ANSWER' and tactic[1] == 'pullrequest':
print("Lista pull requestów w repozytorium " + tactic[2][0][1] + ":")
prs = listRepositoryPullRequests(tactic[2][0][1])
for pr in prs:
print(pr['name'])
print(pr['description'])
print(pr['state'])
print()
elif tactic == 'hello':
print(random.choice(welcome))
elif tactic[0] == 'QUESTION' and tactic[1][0] == 'repo':
print("Dodaj nazwę repozytorium na końcu komendy")
print("np. w nazwarepozytorium")
else: else:
print(tactic) print(tactic)
>>>>>>> origin/master
else:
print(tactic)
else:
print('ERROR')
print() print()

View File

@ -56,6 +56,8 @@ def validate_repo(repo):
def long_thread(state): def long_thread(state):
act = state['current_context'] act = state['current_context']
if act == None:
return 'null'
for topic in state['topics']: for topic in state['topics']:
if act == topic['act']: if act == topic['act']:
slots = topic['slots'] slots = topic['slots']
@ -66,8 +68,13 @@ def long_thread(state):
opt_args = add_facts(opt_args, facts) opt_args = add_facts(opt_args, facts)
required_empty = check_req(req_args) required_empty = check_req(req_args)
if required_empty: if required_empty:
<<<<<<< HEAD
return False, required_empty[0] #slot do uzupełnienia return False, required_empty[0] #slot do uzupełnienia
return True, act, req_args, opt_args #wyświetl użytkownikowi return True, act, req_args, opt_args #wyświetl użytkownikowi
=======
return "QUESTION", required_empty[0] #slot do uzupełnienia
return "ANSWER", act, req_args, opt_args #wyświetl użytkownikowi
>>>>>>> origin/master
def check_req(req_args): def check_req(req_args):
req = [] req = []