Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
labels:
- "dependencies"
- "github-actions"

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
labels:
- "dependencies"

- package-ecosystem: "pre-commit"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
labels:
- "dependencies"
- "pre-commit"
23 changes: 8 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install ruff

- name: Install Poetry
run: pip install poetry

- name: Install Ruff
run: poetry install --only dev --no-root

# Update output format to enable automatic inline annotations.
- name: Run Ruff
run: ruff check --output-format=github .
- name: Run poetry build
run: |
python3 -m pip install poetry
python3 -m poetry install
python3 -m poetry check
python3 -m poetry build
run: poetry run ruff check --output-format=github .
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.15.22
hooks:
# Run the linter.
- id: ruff
Expand Down
577 changes: 251 additions & 326 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pillow = "^12.2.0"
nuitka = "^4.0.5"

[tool.poetry.group.dev.dependencies]
ruff = "^0.6.2"
ruff = "^0.15"
pre-commit = "^3.8.0"

[tool.ruff]
Expand Down
4 changes: 2 additions & 2 deletions src/changelogs/fetch_changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _get_wiki_content(self, date_key: str) -> str:
try:
date_obj = datetime.strptime(date_key, '%Y-%m-%d')
# Format: Update:February_12,_2026
page_title = f"Update:{date_obj.strftime('%B')}_{date_obj.day},_{date_obj.year}"
page_title = f'Update:{date_obj.strftime("%B")}_{date_obj.day},_{date_obj.year}'

page = self.wiki_site.pages[page_title]
if not page.exists:
Expand Down Expand Up @@ -232,7 +232,7 @@ def fetch_steam_changelogs(self):
try:
tags = item.get('tags', [])
if 'patchnotes' not in tags:
logger.trace(f"Skipping non-patch-note news: {item.get('title')} (Tags: {tags})")
logger.trace(f'Skipping non-patch-note news: {item.get("title")} (Tags: {tags})')
continue

gid = str(item['gid'])
Expand Down
4 changes: 2 additions & 2 deletions src/changelogs/parse_changelogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def format_and_save_wikitext_changelogs(self, changelogs, changelog_configs):
prev_date = datetime.strptime(prev_config['date'], '%Y-%m-%d')
# Format: {{Update link|Month|Day|Year}}
# Double braces {{ }} are required to escape them in an f-string
prev_update_link = f"{{{{Update link|{prev_date.strftime('%B')}|{prev_date.day}|{prev_date.year}}}}}"
prev_update_link = f'{{{{Update link|{prev_date.strftime("%B")}|{prev_date.day}|{prev_date.year}}}}}'
except ValueError:
pass

source_link = config.get('link') or ''
source_title = config.get('title') or f"{date_obj.strftime('%m-%d-%Y')} Update"
source_title = config.get('title') or f'{date_obj.strftime("%m-%d-%Y")} Update'

full_page_content = f"""{{{{Update layout
| prev_update = {prev_update_link}
Expand Down
2 changes: 1 addition & 1 deletion src/deadbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def main():
logger.add(
sys.stderr,
level=log_level,
format='<white><dim>{time:YYYY-MM-DD HH:mm:ss.SSS} | </dim>' '</white><level>{level:<7} <dim>|</dim> <normal>{message}</normal></level>',
format='<white><dim>{time:YYYY-MM-DD HH:mm:ss.SSS} | </dim></white><level>{level:<7} <dim>|</dim> <normal>{message}</normal></level>',
)

logger.info(f'Running Deadbot v{get_deadbot_version()}')
Expand Down
6 changes: 3 additions & 3 deletions src/parser/parsers/ability_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def _parse_ability_card(self, ability):
if 'm_vecBasicProperties' in info_section:
parsed_info_section['Alt'] = self._parse_alt_block(info_section)

parsed_ui[f'Info{index+1}'] = parsed_info_section
parsed_ui[f'Info{index + 1}'] = parsed_info_section

parsed_ui['Upgrades'] = self._parse_upgrades()

Expand Down Expand Up @@ -216,7 +216,7 @@ def _parse_main_block(self, info_section):

attr_key = parsed_prop['key']
if attr_key is None:
raise Exception(f"Missing value for ability {self.ability['Name']}")
raise Exception(f'Missing value for ability {self.ability["Name"]}')

# This is probably an upgrade attr that is not tagged as such, so it will
# not be shown in the main block
Expand Down Expand Up @@ -416,7 +416,7 @@ def _parse_upgrades(self):
upgrade = self._deduplicate_upgrade_props(upgrade, raw_props)

# Description key includes t1, t2, and t3 denoting the upgrade tier
desc_key = f'{self.ability["Key"]}_t{index+1}_desc'
desc_key = f'{self.ability["Key"]}_t{index + 1}_desc'

# this key in particular is not accurate to the one in game
ignore_desc_key = False
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parsers/heroes.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ def _parse_hero_weapon(self, hero_value, hero_key):

# The primary weapon name/description key is constructed from the hero's key, not its own ability ID.
# e.g., hero_shiv -> citadel_weapon_hero_shiv_set
weapon_stats['NameKey'] = f"citadel_weapon_hero_{hero_key.replace('hero_', '')}_set"
weapon_stats['NameKey'] = f'citadel_weapon_hero_{hero_key.replace("hero_", "")}_set'
weapon_stats['DescKey'] = weapon_stats['NameKey'] + '_desc'

# Alt-fire weapon
Expand Down
6 changes: 3 additions & 3 deletions src/parser/parsers/item_investment.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def run(self) -> dict:
else:
if first != remapped:
raise ValueError(
f'Item investment stats differ between heroes {first_key} and {hero_key}.\n' f'{first_key}: {first}\n{hero_key}: {remapped}'
f'Item investment stats differ between heroes {first_key} and {hero_key}.\n{first_key}: {first}\n{hero_key}: {remapped}'
)

if first is None:
raise ValueError('Could not find m_MapModCostBonuses in any selectable hero. ' 'Item investment data cannot be extracted.')
raise ValueError('Could not find m_MapModCostBonuses in any selectable hero. Item investment data cannot be extracted.')

logger.trace(f'Extracted item investment stats from {first_key} ' '(validated across all selectable heroes)')
logger.trace(f'Extracted item investment stats from {first_key} (validated across all selectable heroes)')
return {'ItemInvestments': first}
2 changes: 1 addition & 1 deletion src/wiki/changelog_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def calculate_prev_update_link(
prev_date, _ = final_candidates[-1]

# Format: {{Update link|Month|Day|Year}}
return f"{{{{Update link|{prev_date.strftime('%B')}|{prev_date.day}|{prev_date.year}}}}}"
return f'{{{{Update link|{prev_date.strftime("%B")}|{prev_date.day}|{prev_date.year}}}}}'


def inject_prev_update(content: str, prev_update_link: str) -> str:
Expand Down
16 changes: 8 additions & 8 deletions src/wiki/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _upload_changelog_pages(self):
if not date_obj:
raise ValueError(f'Invalid date format in {changelog_id}')

wiki_date_str = f"{date_obj.strftime('%B')}_{date_obj.day},_{date_obj.year}"
wiki_date_str = f'{date_obj.strftime("%B")}_{date_obj.day},_{date_obj.year}'
page_title = f'Update:{wiki_date_str}'

filepath = os.path.join(changelog_dir, filename)
Expand Down Expand Up @@ -163,7 +163,7 @@ def _process_hotfixes(self):
try:
date_obj = datetime.strptime(hotfix['date'], '%Y-%m-%d')
# Assuming standard naming: Update:Month_Day,_Year
page_title = f"Update:{date_obj.strftime('%B')}_{date_obj.day},_{date_obj.year}"
page_title = f'Update:{date_obj.strftime("%B")}_{date_obj.day},_{date_obj.year}'
page = self.site.pages[page_title]

if not page.exists:
Expand All @@ -179,7 +179,7 @@ def _process_hotfixes(self):
# Perform the append before the closing }} of the layout template
if current_text.strip().endswith('}}'):
base_text = current_text.strip()
new_page_text = base_text[:-2] + f"\n\n{hotfix['text']}\n}}"
new_page_text = base_text[:-2] + f'\n\n{hotfix["text"]}\n}}'

logger.info(f'Appending new hotfix section to Wiki page: {page_title}')
if not self.dry_run:
Expand All @@ -188,7 +188,7 @@ def _process_hotfixes(self):
else:
logger.warning(f"Page {page_title} does not end with '}}', cannot safely append hotfix.")
except Exception as e:
logger.error(f"Failed to process hotfix for {hotfix.get('date')}: {e}")
logger.error(f'Failed to process hotfix for {hotfix.get("date")}: {e}')

def _update_data_pages(self):
namespace_id = self._get_namespace_id(self.DATA_NAMESPACE)
Expand Down Expand Up @@ -289,7 +289,7 @@ def _update_latest_chain(self):
logger.error(f'Could not parse date from {latest_file}, cannot update chain')
return

latest_page_title = f"Update:{latest_date.strftime('%B')}_{latest_date.day},_{latest_date.year}"
latest_page_title = f'Update:{latest_date.strftime("%B")}_{latest_date.day},_{latest_date.year}'

# Use cached wiki updates from earlier fetch
if not self.wiki_updates:
Expand All @@ -307,7 +307,7 @@ def _update_latest_chain(self):
earlier_updates.sort(key=lambda x: x[0])
prev_date, prev_page_title = earlier_updates[-1]

logger.info(f"Found previous update: {prev_page_title} (date: {prev_date.strftime('%Y-%m-%d')})")
logger.info(f'Found previous update: {prev_page_title} (date: {prev_date.strftime("%Y-%m-%d")})')

# Link the previous update to the latest one
self._link_updates(prev_page_title, latest_page_title, prev_date, latest_date)
Expand All @@ -325,7 +325,7 @@ def _link_updates(self, prev_title: str, next_title: str, prev_date: datetime, n
current_text = page.text()

# Create the link string: {{Update link|Month|Day|Year}}
next_link_str = f"{{{{Update link|{next_date.strftime('%B')}|{next_date.day}|{next_date.year}}}}}"
next_link_str = f'{{{{Update link|{next_date.strftime("%B")}|{next_date.day}|{next_date.year}}}}}'

# Robust idempotency check: normalize whitespace and match the template
# Handles extra spaces inside template like {{Update link | January | 29 | 2026 }}
Expand Down Expand Up @@ -354,7 +354,7 @@ def _link_updates(self, prev_title: str, next_title: str, prev_date: datetime, n

logger.info(f'Linking {prev_title} -> {next_title}')
if not self.dry_run:
page.save(new_text, summary=f"{self.upload_message}: Linking next update to {next_date.strftime('%Y-%m-%d')}")
page.save(new_text, summary=f'{self.upload_message}: Linking next update to {next_date.strftime("%Y-%m-%d")}')
logger.success(f'Updated {prev_title}')

def _update_page(self, page, updated_text):
Expand Down
Loading