Skip to content

Commit

Permalink
Merge pull request #7 from ICRAR/fix_linting
Browse files Browse the repository at this point in the history
Fix linting: address failing workflows on github
  • Loading branch information
myxie authored Nov 15, 2024
2 parents c738d98 + ebcb255 commit 1e5eb71
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 19 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/main.yml → .github/workflows/general.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
on: [push, pull_request]

jobs:
linter:
Expand Down
4 changes: 2 additions & 2 deletions dlg_paletteGen/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import inspect
import re
import xml.etree.ElementTree as ET
from typing import Union
from typing import Optional, Union

from .settings import VALUE_TYPES, Language, logger
from .support_functions import cleanString, guess_type_from_default, typeFix
Expand Down Expand Up @@ -114,7 +114,7 @@ class DetailedDescription:
"casa": r"\n-{2,20}? parameter",
}

def __init__(self, descr: Union[str | None], name=None):
def __init__(self, descr: Optional[str] = None, name=None):
"""
:param descr: Text of the detaileddescription node
"""
Expand Down
4 changes: 2 additions & 2 deletions dlg_paletteGen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import sys
import tempfile
from typing import Any
from typing import Any, Tuple

import pkg_resources

Expand Down Expand Up @@ -168,7 +168,7 @@ def check_environment_variables() -> bool:
return True


def nodes_from_module(module_path, recursive=True) -> tuple[list, Any]:
def nodes_from_module(module_path, recursive=True) -> Tuple[list, Any]:
"""
Extract nodes from specified module.
Expand Down
4 changes: 2 additions & 2 deletions dlg_paletteGen/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def get_members(mod: types.ModuleType, module_members=[], parent=None):
:param parent: the parent module
:param member: filter the content of mod for this member
"""
if not mod:
if mod is None:
return {}
module_name = parent if parent else get_mod_name(mod)
module_name = str(module_name)
Expand Down Expand Up @@ -370,7 +370,7 @@ def module_hook(mod_name: str, modules: dict = {}, recursive: bool = True) -> tu
# traverse = True if len(modules) == 0 else False
mod = import_using_name(mod_name, traverse=True)
m_name = get_mod_name(mod)
if mod and mod_name != m_name:
if mod is not None and mod_name != m_name:
member = mod_name.split(".")[-1]
mod_name = m_name
members = get_members(
Expand Down
2 changes: 1 addition & 1 deletion dlg_paletteGen/support_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def get_mod_name(mod) -> str:
Helper function to get a name from a module in
all cases.
"""
if not mod:
if mod is None:
return ""
if hasattr(mod, "__name__"):
return mod.__name__
Expand Down
2 changes: 1 addition & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,4 @@ def test_full_numpy():
for members in modules.values():
for node in members.values():
nodes.append(node)
assert len(modules) == 651
assert len(modules) == 954

0 comments on commit 1e5eb71

Please sign in to comment.