Skip to content

Commit

Permalink
Merge pull request #71 from DostEducation/develop
Browse files Browse the repository at this point in the history
Release 12 Jan 2024
  • Loading branch information
Sachinbisht27 authored Jan 12, 2024
2 parents 924179b + 0bfbe97 commit 949f8fb
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- Pull Request Title Guidelines -->
<!--
Please follow the format: #<issue_id> <Title>
- <issue_id>: Id of the issue for which the PR belongs to (e.g., #1023)
- <Title>: A brief summary of the change (e.g., Add user authentication functionality)
Example of Pull Request Title: #1023 Add user authentication functionality -->

#[ISSUE_ID]
<!--- If there is an open issue, please link to the issue here by replacing [ISSUE_ID]-->
<!-- Make sure the PR is against the `develop` branch -->
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.9'
- uses: pre-commit/[email protected]
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
repos:
- repo: https://github.com/PyCQA/prospector
rev: 1.10.2
hooks:
- id: prospector
additional_dependencies:
- ".[with-mypy]"
args:
- --with-tool=mypy
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
Expand Down
48 changes: 48 additions & 0 deletions .prospector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
output-format: grouped

# strictness: veryhigh
# doc-warnings: no
# test-warnings: no
max-line-length: 120
# pep8: full

ignore-paths:
- __pycache__/
- .github/
- venv/

mypy:
run: true
options:
ignore-missing-imports: true
follow-imports: skip
--disable-error-code

pylint:
options:
extension-pkg-allow-list: mypy
disable:
- cyclic-import
- django-not-available
- logging-fstring-interpolation
- unused-import
- singleton-comparison
- inconsistent-return-statements
- useless-object-inheritance
- logging-format-interpolation
- pointless-string-statement
- unused-import
- consider-using-f-string
- import-error

mccabe:
run: true

pycodestyle:
disable:
- E712

pyflakes:
disable:
- F401
- F811
4 changes: 2 additions & 2 deletions api/services/registration_service.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# This file is treated as service layer
from api import helpers, models, db
from api import helpers, models, app, db
from datetime import datetime
from api import app
from utils.loggingutils import logger


Expand Down Expand Up @@ -49,6 +48,7 @@ def create_registration(self, data):
program_id=program_id,
status="pending",
partner_id=partner.partner_id,
language_id=app.config["DEFAULT_LANGUAGE_ID"],
state=system_phone_data.state,
has_dropped_missedcall=True,
created_on=data["log_created_on"]
Expand Down
1 change: 1 addition & 0 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
DEFAULT_PROGRAM_TIME_CATEGORY = "AFTERNOON"
RETRY_LOGS_BATCH_LIMIT = os.environ.get("RETRY_LOGS_BATCH_LIMIT", 1000)
TELCO_CODE_ANSWERED = 16
DEFAULT_LANGUAGE_ID = 1
MAX_RETRY_ATTEMPTS_FOR_LOGS = os.environ.get("MAX_RETRY_ATTEMPTS_FOR_LOGS", 3)
12 changes: 10 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@


def callback(request):
json_data = None
form_data = None

if request.method == "POST":
json_data = request.get_json()
form_data = request.form
content_type = request.headers.get("Content-Type")

if content_type == "application/json":
json_data = request.get_json()
else:
form_data = request.form

transaction_log_service = services.TransactionLogService()

try:
Expand Down
10 changes: 0 additions & 10 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
# Includes dev dependencies on top of requirements.txt
-r requirements.txt
functions-framework==2.1.2
flake8==3.8.4
flake8-polyfill==1.0.2
pep8-naming==0.10.0
pre-commit==2.11.0
pep8-naming==0.10.0
prospector==1.3.1
pycodestyle==2.6.0
pydocstyle==5.1.1
pylint==2.5.3
pylint-celery==0.3
pylint-flask==0.6

0 comments on commit 949f8fb

Please sign in to comment.