Skip to content

Commit

Permalink
Merge pull request #274 from 4k4xs4pH1r3/deepsource-transform-95057662
Browse files Browse the repository at this point in the history
style: format code with Autopep8, Black, ClangFormat, dotnet-format, Go fmt, Gofumpt, Google Java Format, isort, PHP CS Fixer, Prettier, RuboCop, Ruff Formatter, Rustfmt, Scalafmt, StandardJS, StandardRB, swift-format and Yapf
  • Loading branch information
4k4xs4pH1r3 authored Dec 14, 2024
2 parents 0aff503 + b74a0f3 commit 7c4b9bf
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 38 deletions.
23 changes: 14 additions & 9 deletions ai/x/deployX.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
"""Download google/api"""
import requests

import os

import requests


def download_file(url, folder_name):
"""
Downloads a file from a URL and saves it to a specified folder.
Expand All @@ -20,7 +23,7 @@ def download_file(url, folder_name):
file_name = url.split("/")[-1]
file_path = os.path.join(folder_name, file_name)

with open(file_path, 'wb') as file:
with open(file_path, "wb") as file:
for chunk in response.iter_content(chunk_size=8192):
file.write(chunk)

Expand All @@ -29,6 +32,7 @@ def download_file(url, folder_name):
except requests.exceptions.RequestException as e:
print(f"Error downloading {url}: {e}")


def print_directory_tree(folder_name):
"""
Prints the full directory tree structure with filenames and extensions.
Expand All @@ -37,12 +41,13 @@ def print_directory_tree(folder_name):
folder_name: The name of the folder to print the tree for.
"""
for root, dirs, files in os.walk(folder_name):
level = root.replace(folder_name, '').count(os.sep)
indent = ' ' * 4 * (level)
print(f'{indent}{os.path.basename(root)}/')
subindent = ' ' * 4 * (level + 1)
level = root.replace(folder_name, "").count(os.sep)
indent = " " * 4 * (level)
print(f"{indent}{os.path.basename(root)}/")
subindent = " " * 4 * (level + 1)
for f in files:
print(f'{subindent}{f}')
print(f"{subindent}{f}")


# URLs and their corresponding folder paths
files_to_download = {
Expand All @@ -51,12 +56,12 @@ def print_directory_tree(folder_name):
"https://raw.githubusercontent.com/protocolbuffers/protobuf/main/src/google/protobuf/descriptor.proto": "google/protobuf",
"https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/client.proto": "google/api",
"https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/field_behavior.proto": "google/api",
"https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/launch_stage.proto": "google/api"
"https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/launch_stage.proto": "google/api",
}

# Download the files
for url, folder_name in files_to_download.items():
download_file(url, folder_name)

# Print the directory tree
print_directory_tree("google")
print_directory_tree("google")
68 changes: 39 additions & 29 deletions ai/x/x_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7c4b9bf

Please sign in to comment.