-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from typhonshambo/main
Update formatting to prevent linting errors
- Loading branch information
Showing
13 changed files
with
190 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"name": "Python 3", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye", | ||
"customizations": { | ||
"codespaces": { | ||
"openFiles": [ | ||
"README.md", | ||
"streamlit.py" | ||
] | ||
}, | ||
"vscode": { | ||
"settings": {}, | ||
"extensions": [ | ||
"ms-python.python", | ||
"ms-python.vscode-pylance" | ||
] | ||
} | ||
}, | ||
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'", | ||
"postAttachCommand": { | ||
"server": "streamlit run streamlit.py --server.enableCORS false --server.enableXsrfProtection false" | ||
}, | ||
"portsAttributes": { | ||
"8501": { | ||
"label": "Application", | ||
"onAutoForward": "openPreview" | ||
} | ||
}, | ||
"forwardPorts": [ | ||
8501 | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[flake8] | ||
ignore = E302, W292 | ||
exclude = | ||
.git, | ||
__pycache__, | ||
venv | ||
examples | ||
max-line-length = 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Lint and Streamlit Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
run-linters: | ||
name: Run Linters | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
pip install black flake8 streamlit | ||
- name: Run Python linters | ||
uses: wearerequired/lint-action@v2 | ||
with: | ||
auto_fix: true | ||
black: true | ||
flake8: true | ||
|
||
- name: Streamlit Check | ||
run: | | ||
# Remove the old 'streamlit run streamlit.py' line. | ||
python streamlit_test.py && echo "Streamlit test passed!" || echo "Streamlit test failed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
from .gemini_analyzer import CodeAnalyzer | ||
__all__ = [ | ||
'CodeAnalyzer' | ||
] | ||
|
||
__all__ = ["CodeAnalyzer"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,38 @@ | ||
import os | ||
import streamlit as st | ||
from typing import TypedDict | ||
from typing_extensions import TypedDict | ||
|
||
|
||
class AnalyzerConfigs: | ||
''' | ||
""" | ||
This class contains configuration settings for the CodeAnalyzer class. | ||
''' | ||
""" | ||
|
||
gemini_models: list = [ | ||
"gemini-1.5-flash", | ||
"gemini-1.5-pro", #INFO : https://ai.google.dev/gemini-api/docs/json-mode?lang=python | ||
"gemini-1.5-flash", | ||
"gemini-1.5-pro", # INFO : https://ai.google.dev/gemini-api/docs/json-mode?lang=python | ||
] | ||
famous_languages: list = [ | ||
"Python", | ||
"Java", | ||
"JavaScript", | ||
"C++", | ||
"C#", | ||
"Ruby", | ||
"Go", | ||
"Swift", | ||
"Rust", | ||
] | ||
famous_languages: list = ["Python", "Java", "JavaScript", "C++", "C#", "Ruby", "Go", "Swift", "Rust"] | ||
genai_api_key: str = st.secrets["GENAI_API_KEY"] | ||
style_guides: dict = { | ||
'google style': 'https://google.github.io/styleguide/pyguide.html', | ||
'pep8': 'https://pep8.org/' | ||
"google style": "https://google.github.io/styleguide/pyguide.html", | ||
"pep8": "https://pep8.org/", | ||
} | ||
|
||
|
||
|
||
class ResponseData(TypedDict): | ||
''' | ||
""" | ||
For schema based responses like `JSON` | ||
''' | ||
""" | ||
|
||
line: int | ||
message: str | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
def greet(name): | ||
"""Greets the person with the given name.""" | ||
"""Greets the person with the given name.""" | ||
|
||
print("Hello,", name) | ||
|
||
print("Hello,", name) | ||
|
||
greet("Alice") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
def calculate_sum( a , b): # Intentional spacing issues | ||
def calculate_sum(a, b): # Intentional spacing issues | ||
"""This function calculates the sum of two numbers.""" | ||
result=a+b | ||
return result # Incorrect indentation | ||
result = a + b | ||
|
||
|
||
return result # Incorrect indentation | ||
|
||
print(calculate_sum(10, 5)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters