Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
r4stered committed Oct 6, 2024
1 parent 691c6c1 commit 30f9302
Show file tree
Hide file tree
Showing 32 changed files with 1,005 additions and 823 deletions.
7 changes: 7 additions & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ modifiableFileExclude {
ctre_sim/
.pathplanner/
choreoproj.chor
src/main/cpp/choreo/
src/main/cpp/pathplanner/
src/main/cpp/photon/
src/main/include/choreo/
src/main/include/pathplanner/
src/main/include/photon/
src/main/include/PhotonVersion.h
}
101 changes: 50 additions & 51 deletions grab_choreo.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,50 @@
import os
import requests

# GitHub repository details
repo_owner = "SleipnirGroup"
repo_name = "Choreo"
branch = "main"

# Folders to download
folders = [
"choreolib/src/main/native/cpp",
"choreolib/src/main/native/include"
]

# Destination directories (change these to your project's subdirectories)
destinations = [
"src/main/cpp",
"src/main/include"
]

def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item['type'] == 'file':
download_file(item['download_url'], os.path.join(destination, item['name']))
elif item['type'] == 'dir':
subdir = os.path.join(destination, item['name'])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item['path'], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")

def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, 'wb') as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")

# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
import os
import requests

# GitHub repository details
repo_owner = "SleipnirGroup"
repo_name = "Choreo"
branch = "main"

# Folders to download
folders = ["choreolib/src/main/native/cpp", "choreolib/src/main/native/include"]

# Destination directories (change these to your project's subdirectories)
destinations = ["src/main/cpp", "src/main/include"]


def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item["type"] == "file":
download_file(
item["download_url"], os.path.join(destination, item["name"])
)
elif item["type"] == "dir":
subdir = os.path.join(destination, item["name"])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item["path"], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")


def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, "wb") as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")


# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
104 changes: 53 additions & 51 deletions grab_pathplanner.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,53 @@
import os
import requests

# GitHub repository details
repo_owner = "mjansen4857"
repo_name = "pathplanner"
branch = "675-trajectory-generation-v2"

# Folders to download
folders = [
"pathplannerlib/src/main/native/cpp",
"pathplannerlib/src/main/native/include"
]

# Destination directories (change these to your project's subdirectories)
destinations = [
"src/main/cpp",
"src/main/include"
]

def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item['type'] == 'file':
download_file(item['download_url'], os.path.join(destination, item['name']))
elif item['type'] == 'dir':
subdir = os.path.join(destination, item['name'])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item['path'], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")

def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, 'wb') as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")

# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
import os
import requests

# GitHub repository details
repo_owner = "mjansen4857"
repo_name = "pathplanner"
branch = "675-trajectory-generation-v2"

# Folders to download
folders = [
"pathplannerlib/src/main/native/cpp",
"pathplannerlib/src/main/native/include",
]

# Destination directories (change these to your project's subdirectories)
destinations = ["src/main/cpp", "src/main/include"]


def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item["type"] == "file":
download_file(
item["download_url"], os.path.join(destination, item["name"])
)
elif item["type"] == "dir":
subdir = os.path.join(destination, item["name"])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item["path"], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")


def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, "wb") as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")


# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
123 changes: 64 additions & 59 deletions grab_photon.py
Original file line number Diff line number Diff line change
@@ -1,59 +1,64 @@
import os
import requests

# GitHub repository details
repo_owner = "PhotonVision"
repo_name = "photonvision"
branch = "master" # Assuming the main branch, change if needed

# Folders to download
folders = [
"photon-lib/src/main/native/cpp",
"photon-lib/src/main/native/include",
"photon-targeting/src/main/native/cpp",
"photon-targeting/src/main/native/include",
"photon-targeting/src/generated/main/native/cpp",
"photon-targeting/src/generated/main/native/include"
]

# Destination directories (change these to your project's subdirectories)
destinations = [
"src/main/cpp",
"src/main/include",
"src/main/cpp",
"src/main/include",
"src/main/cpp",
"src/main/include"
]

def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item['type'] == 'file':
download_file(item['download_url'], os.path.join(destination, item['name']))
elif item['type'] == 'dir':
subdir = os.path.join(destination, item['name'])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item['path'], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")

def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, 'wb') as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")

# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
import os
import requests

# GitHub repository details
repo_owner = "PhotonVision"
repo_name = "photonvision"
branch = "master" # Assuming the main branch, change if needed

# Folders to download
folders = [
"photon-lib/src/main/native/cpp",
"photon-lib/src/main/native/include",
"photon-targeting/src/main/native/cpp",
"photon-targeting/src/main/native/include",
"photon-targeting/src/generated/main/native/cpp",
"photon-targeting/src/generated/main/native/include",
]

# Destination directories (change these to your project's subdirectories)
destinations = [
"src/main/cpp",
"src/main/include",
"src/main/cpp",
"src/main/include",
"src/main/cpp",
"src/main/include",
]


def download_folder(owner, repo, path, branch, destination):
url = f"https://api.github.com/repos/{owner}/{repo}/contents/{path}?ref={branch}"
response = requests.get(url)
if response.status_code == 200:
contents = response.json()
for item in contents:
if item["type"] == "file":
download_file(
item["download_url"], os.path.join(destination, item["name"])
)
elif item["type"] == "dir":
subdir = os.path.join(destination, item["name"])
os.makedirs(subdir, exist_ok=True)
download_folder(owner, repo, item["path"], branch, subdir)
else:
print(f"Failed to fetch contents: {response.status_code}")


def download_file(url, destination):
response = requests.get(url)
if response.status_code == 200:
os.makedirs(os.path.dirname(destination), exist_ok=True)
with open(destination, "wb") as f:
f.write(response.content)
print(f"Downloaded: {destination}")
else:
print(f"Failed to download file: {url}")


# Download and copy folders
for folder, destination in zip(folders, destinations):
print(f"Downloading {folder} to {destination}")
download_folder(repo_owner, repo_name, folder, branch, destination)

print("Download and copy process completed.")
29 changes: 17 additions & 12 deletions src/main/cpp/PhotonVersion.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#include <string.h>
#include <regex>

static const char* dev_ = "dev";

namespace photon {
namespace PhotonVersion {
const char* versionString = "UNKNOWN";
const char* buildDate = "UNKNOWN";
const bool isRelease = strncmp(dev_, versionString, strlen(dev_)) != 0;
}
}
// Copyright (c) FRC 2053.
// Open Source Software; you can modify and/or share it under the terms of
// the MIT License file in the root of this project

#include <cstring>
#include <regex>

static const char *dev_ = "dev";

namespace photon {
namespace PhotonVersion {
const char *versionString = "UNKNOWN";
const char *buildDate = "UNKNOWN";
const bool isRelease =
std::strncmp(dev_, versionString, std::strlen(dev_)) != 0;
} // namespace PhotonVersion
} // namespace photon
Loading

0 comments on commit 30f9302

Please sign in to comment.