mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
style: Format code with linter
This commit is contained in:
parent
b50b28c815
commit
0fc9928762
1 changed files with 26 additions and 9 deletions
|
@ -1,10 +1,11 @@
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
import urllib.parse
|
import urllib.parse
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import platform
|
|
||||||
import subprocess
|
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
|
||||||
from aider import __version__
|
from aider import __version__
|
||||||
|
@ -12,31 +13,41 @@ from aider.urls import github_issues
|
||||||
|
|
||||||
FENCE = "`" * 3
|
FENCE = "`" * 3
|
||||||
|
|
||||||
|
|
||||||
def get_python_info():
|
def get_python_info():
|
||||||
implementation = platform.python_implementation()
|
implementation = platform.python_implementation()
|
||||||
is_venv = sys.prefix != sys.base_prefix
|
is_venv = sys.prefix != sys.base_prefix
|
||||||
return f"Python implementation: {implementation}\nVirtual environment: {'Yes' if is_venv else 'No'}"
|
return (
|
||||||
|
f"Python implementation: {implementation}\nVirtual environment:"
|
||||||
|
f" {'Yes' if is_venv else 'No'}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_os_info():
|
def get_os_info():
|
||||||
return f"OS: {platform.system()} {platform.release()} ({platform.architecture()[0]})"
|
return f"OS: {platform.system()} {platform.release()} ({platform.architecture()[0]})"
|
||||||
|
|
||||||
|
|
||||||
def get_git_info():
|
def get_git_info():
|
||||||
try:
|
try:
|
||||||
git_version = subprocess.check_output(["git", "--version"]).decode().strip()
|
git_version = subprocess.check_output(["git", "--version"]).decode().strip()
|
||||||
branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode().strip()
|
branch = (
|
||||||
|
subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode().strip()
|
||||||
|
)
|
||||||
commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
|
commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
|
||||||
return f"Git version: {git_version}\nBranch: {branch}\nCommit: {commit}"
|
return f"Git version: {git_version}\nBranch: {branch}\nCommit: {commit}"
|
||||||
except:
|
except:
|
||||||
return "Git information unavailable"
|
return "Git information unavailable"
|
||||||
|
|
||||||
|
|
||||||
def get_dependencies():
|
def get_dependencies():
|
||||||
deps = [
|
deps = [
|
||||||
f"{pkg.key}=={pkg.version}"
|
f"{pkg.key}=={pkg.version}"
|
||||||
for pkg in pkg_resources.working_set
|
for pkg in pkg_resources.working_set
|
||||||
if pkg.key.lower() in ['openai', 'tiktoken', 'litellm'] # Add other relevant packages
|
if pkg.key.lower() in ["openai", "tiktoken", "litellm"] # Add other relevant packages
|
||||||
]
|
]
|
||||||
return "Relevant installed packages:\n" + "\n".join(deps)
|
return "Relevant installed packages:\n" + "\n".join(deps)
|
||||||
|
|
||||||
|
|
||||||
def report_github_issue(issue_text, title=None):
|
def report_github_issue(issue_text, title=None):
|
||||||
"""
|
"""
|
||||||
Compose a URL to open a new GitHub issue with the given text prefilled,
|
Compose a URL to open a new GitHub issue with the given text prefilled,
|
||||||
|
@ -53,12 +64,18 @@ def report_github_issue(issue_text, title=None):
|
||||||
os_info = get_os_info() + "\n"
|
os_info = get_os_info() + "\n"
|
||||||
git_info = get_git_info() + "\n"
|
git_info = get_git_info() + "\n"
|
||||||
dependencies = get_dependencies() + "\n"
|
dependencies = get_dependencies() + "\n"
|
||||||
|
|
||||||
system_info = (
|
system_info = (
|
||||||
version_info + python_version + platform_info +
|
version_info
|
||||||
python_info + os_info + git_info + dependencies + "\n"
|
+ python_version
|
||||||
|
+ platform_info
|
||||||
|
+ python_info
|
||||||
|
+ os_info
|
||||||
|
+ git_info
|
||||||
|
+ dependencies
|
||||||
|
+ "\n"
|
||||||
)
|
)
|
||||||
|
|
||||||
issue_text = system_info + issue_text
|
issue_text = system_info + issue_text
|
||||||
params = {"body": issue_text}
|
params = {"body": issue_text}
|
||||||
if title is None:
|
if title is None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue