Skip to content

Commit

Permalink
Minor fixes (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinAV authored Sep 19, 2024
1 parent 0f9b555 commit 5cb6045
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion tools/_setup_generation/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def exit(self):

# Utility function to update the MkDocs yml template file
def update_mkdocs_yaml_template(self, pattern: str, replacement: str):
# Retrieve and keep indendation
# Retrieve and keep indentation
if pattern.startswith(r"^\s*"):
pattern = r"^(\s*)" + pattern[4:]
lines = replacement.split("\n")
Expand Down
6 changes: 3 additions & 3 deletions tools/_setup_generation/step_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def get_avaiga_members(self):

def get_contributors(self):
for url in self.REPO_URLS:
response = self.__get(url + "/contents/contributors.txt", ignore404=True)
response = self.__get(url + "/contents/contributors.txt")
public_contributor_logins = []
if response.status_code == 200:
data = response.json()
Expand Down Expand Up @@ -126,13 +126,13 @@ def _replace(self, path, *pattern_content_tuples):
with open(path, 'w') as file:
file.write(file_data)

def __get(self, url, with_token=True, ignore404:bool = False):
def __get(self, url, with_token=True):
if with_token and self.GH_TOKEN:
headers = {
"Accept": "application/vnd.github+json",
"Authorization": "Bearer "+self.GH_TOKEN
}
#{'Authorization': f'token {self.GH_TOKEN}'}
# {'Authorization': f'token {self.GH_TOKEN}'}
return requests.get(url, headers=headers)
else:
return requests.get(url)
Expand Down
13 changes: 7 additions & 6 deletions tools/_setup_generation/step_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# The header of an item is a multiline header starting with '---' and ending with '---'.
# The header contains the following information:
# - title: The title of the item
# - category: The category of the item (fundamentals, visuals, scenario_management,
# - category: The category of the item (fundamentals, visuals, scenario_management,
# integration, large_data, finance, decision_support, llm, visualization or other)
# - data-keywords: A comma separated list of keywords
# - short-description: A short description of the item
Expand All @@ -21,9 +21,10 @@
import re
from typing import List, Dict

from .items import FolderItem, Item
from .items.exceptions import NoIndexFile
from .setup import SetupStep, Setup
from .items import FolderItem, FileItem, Item
from .items.exceptions import WrongHeader, NoHeader, NoIndexFile


class GalleryStep(SetupStep):
GALLERY_FOLDER_NAME = "gallery"
Expand Down Expand Up @@ -56,10 +57,10 @@ def enter(self, setup: Setup):
self.APPLICATIONS_BASE_PATH = os.path.join(self.GALLERY_BASE_PATH, self.APPLICATIONS_FOLDER_NAME)

items = os.listdir(self.GALLERY_BASE_PATH)

# Filter out only the directories
self.content_types = {item: [] for item in items if os.path.isdir(os.path.join(self.GALLERY_BASE_PATH, item)) and item not in self.NO_CONTENT_TYPE_FOLDERS}


for content_type in self.content_types.keys():
folder_path = os.path.join(self.GALLERY_BASE_PATH, content_type)
Expand All @@ -85,7 +86,7 @@ def setup(self, setup: Setup):
items_info.update(items_info_category)
content = self._build_content_for_main_index(items_info)
self._update_gallery_index_file(content)

def _get_list_of_items(self, folder_path) -> List[Item]:
items = []
for sub_folder in os.listdir(folder_path):
Expand Down
13 changes: 5 additions & 8 deletions tools/_setup_generation/step_refman.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class RefManStep(SetupStep):
REFERENCE_REL_PATH = "refmans/reference"

def __init__(self):
self.REFERENCE_DIR_PATH = None
self.XREFS_PATH = None
self.navigation = None

def get_id(self) -> str:
Expand Down Expand Up @@ -300,12 +302,7 @@ def read_module(module):
self.navigation += " "
package_nav_entry = package[len(package_group) :]
self.navigation += f'- "<code>{package_nav_entry}</code>": {RefManStep.REFERENCE_REL_PATH}/pkg_{package}.md\n'
package_output_path = os.path.join(
self.REFERENCE_DIR_PATH, f"pkg_{package}.md"
)
package_output_path = os.path.join(
self.REFERENCE_DIR_PATH, f"pkg_{package}.md"
)
package_output_path = os.path.join(self.REFERENCE_DIR_PATH, f"pkg_{package}.md")

def update_xrefs(name, type, force_package, module, others):
if not others:
Expand Down Expand Up @@ -382,8 +379,8 @@ def generate_entries(
name,
TYPE_ID,
package,
entry_info["module"],
entry_info.get("packages"),
type["module"],
type.get("packages"),
)
if functions:
package_output_file.write("## Functions\n\n")
Expand Down

0 comments on commit 5cb6045

Please sign in to comment.