change sys.path.append using pathlib
This commit is contained in:
parent
40dd815d4b
commit
352fdd85af
|
@ -1,5 +1,5 @@
|
|||
import re, sys
|
||||
sys.path.append("./")
|
||||
import re, sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[1]))
|
||||
import json5 as json
|
||||
from wsgiref.simple_server import make_server
|
||||
from app.services.comments import return_pr_decision
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from app.models.user import User
|
||||
import sys
|
||||
sys.path.append('././')
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
from app.models.pull_request import PullRequest
|
||||
from app.models.user import User
|
||||
from typing import Optional
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
from app.models.user import User
|
||||
import sys
|
||||
sys.path.append('././')
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from app.models.pull_request import PullRequest
|
||||
|
||||
class PRLabel():
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
sys.path.append('././')
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
from app.models.user import User
|
||||
from app.models.repository import Repository
|
||||
from typing import Optional
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import sys
|
||||
sys.path.append("././")
|
||||
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
from app.models.pull_request import PullRequest
|
||||
from app.models.installation import Installation
|
||||
from app.models.repository import Repository
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
# this is the authentication service
|
||||
import sys, time
|
||||
sys.path.append("././")
|
||||
import sys, time, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
import yaml, jwt
|
||||
from app.models.jwt_query import JWTQuery
|
||||
from app.models.installation import Installation
|
||||
from app.services.queries import query_access_token
|
||||
from app.utils.config_loader import ConfigLoader
|
||||
|
||||
ALGORITHM = "RS256"
|
||||
|
||||
def getToken(installation: Installation) -> str:
|
||||
result: str = None
|
||||
try:
|
||||
with open(".env.yaml") as f:
|
||||
envConfig = yaml.load(f, Loader=yaml.FullLoader)
|
||||
if "APP_ID" not in envConfig or "PRIVATE_KEY_PATH" not in envConfig:
|
||||
raise Exception("error with configuration .env.yaml")
|
||||
envConfig = ConfigLoader().load_env()
|
||||
if "APP_ID" not in envConfig or "PRIVATE_KEY_PATH" not in envConfig:
|
||||
raise Exception("error with configuration .env.yaml")
|
||||
|
||||
appId: int = envConfig['APP_ID']
|
||||
private_key_path: str = envConfig['PRIVATE_KEY_PATH']
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# the services related to labels
|
||||
import sys, requests
|
||||
sys.path.append("././")
|
||||
import json
|
||||
import sys, requests, pathlib, json
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
from app.services.authentication import getToken
|
||||
from app.models.pr_comment import PRComment
|
||||
from app.models.trigger import *
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
# query github using apis
|
||||
from gettext import install
|
||||
import sys, requests
|
||||
sys.path.append("././")
|
||||
import sys, requests, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
import json5 as json
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# handle triggers
|
||||
import sys
|
||||
sys.path.append("././")
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from app.models.trigger import *
|
||||
from app.models.repository import Repository
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
import sys
|
||||
sys.path.append("././")
|
||||
|
||||
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
sys.path.append("././")
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from app.models.trigger import *
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
sys.path.append("././")
|
||||
import sys, pathlib
|
||||
sys.path.append(str(pathlib.Path(__file__).resolve().parents[2]))
|
||||
|
||||
from app.services.authentication import auth
|
||||
|
||||
|
|
Loading…
Reference in New Issue