mirror of https://github.com/arc53/DocsGPT
Linting
* validate python formatting on every build with Ruff * fix lint warningspull/232/head
parent
168648e789
commit
962becb9a5
@ -0,0 +1,17 @@
|
|||||||
|
name: Python linting
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
types: [ opened, synchronize ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ruff:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Lint with Ruff
|
||||||
|
uses: chartboost/ruff-action@v1
|
@ -0,0 +1,2 @@
|
|||||||
|
# Allow lines to be as long as 120 characters.
|
||||||
|
line-length = 120
|
@ -1,7 +1,8 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
broker_url = os.getenv("CELERY_BROKER_URL")
|
broker_url = os.getenv("CELERY_BROKER_URL")
|
||||||
result_backend = os.getenv("CELERY_RESULT_BACKEND")
|
result_backend = os.getenv("CELERY_RESULT_BACKEND")
|
||||||
|
|
||||||
task_serializer = 'json'
|
task_serializer = 'json'
|
||||||
result_serializer = 'json'
|
result_serializer = 'json'
|
||||||
accept_content = ['json']
|
accept_content = ['json']
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
from flask import jsonify
|
from flask import jsonify
|
||||||
from werkzeug.http import HTTP_STATUS_CODES
|
from werkzeug.http import HTTP_STATUS_CODES
|
||||||
|
|
||||||
def response_error(code_status,message=None):
|
|
||||||
payload = {'error':HTTP_STATUS_CODES.get(code_status,"something went wrong")}
|
def response_error(code_status, message=None):
|
||||||
|
payload = {'error': HTTP_STATUS_CODES.get(code_status, "something went wrong")}
|
||||||
if message:
|
if message:
|
||||||
payload['message'] = message
|
payload['message'] = message
|
||||||
response = jsonify(payload)
|
response = jsonify(payload)
|
||||||
response.status_code = code_status
|
response.status_code = code_status
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def bad_request(status_code=400,message=''):
|
|
||||||
return response_error(code_status=status_code,message=message)
|
def bad_request(status_code=400, message=''):
|
||||||
|
return response_error(code_status=status_code, message=message)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from app import app
|
from app import app
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True, port=5001)
|
app.run(debug=True, port=5001)
|
||||||
|
Loading…
Reference in New Issue