-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3246 from c-po/spring-cleaning-2
T6199: drop unused Python imports from graphql source
- Loading branch information
Showing
10 changed files
with
39 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
name: Check for unused imports using Pylint | ||
on: | ||
pull_request_target: | ||
types: [opened, reopened, ready_for_review, locked] | ||
on: push | ||
# pull_request_target: | ||
# types: [opened, reopened, ready_for_review, locked] | ||
|
||
jobs: | ||
build: | ||
Check-Unused-Imports: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
tmp=$(git ls-files *.py | xargs pylint | grep W0611 | wc -l) | ||
if [[ $tmp -gt 0 ]]; then | ||
echo "Found $tmp occurrence of unused Python import statements!" | ||
exit 1 | ||
fi | ||
exit 0 | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: 3.11 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: make unused-imports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
# typing information for composite functions: those that invoke several | ||
# elementary requests, and return the result as a single dict | ||
import typing | ||
|
||
def system_status(): | ||
pass | ||
|
||
queries = {'system_status': system_status} | ||
|
||
mutations = {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2022-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -13,10 +13,10 @@ | |
# You should have received a copy of the GNU Lesser General Public License | ||
# along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import jwt | ||
import datetime | ||
from typing import Any, Dict | ||
from ariadne import ObjectType, UnionType | ||
from typing import Any | ||
from typing import Dict | ||
from ariadne import ObjectType | ||
from graphql import GraphQLResolveInfo | ||
|
||
from .. libs.token_auth import generate_token | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2021 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2021-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -13,7 +13,7 @@ | |
# You should have received a copy of the GNU Lesser General Public License | ||
# along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from ariadne import SchemaDirectiveVisitor, ObjectType | ||
from ariadne import SchemaDirectiveVisitor | ||
from . queries import * | ||
from . mutations import * | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2021-2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2021-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -14,11 +14,13 @@ | |
# along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from importlib import import_module | ||
from typing import Any, Dict, Optional | ||
from ariadne import ObjectType, convert_camel_case_to_snake | ||
from graphql import GraphQLResolveInfo | ||
from makefun import with_signature | ||
|
||
# used below by func_sig | ||
from typing import Any, Dict, Optional # pylint: disable=W0611 | ||
from graphql import GraphQLResolveInfo # pylint: disable=W0611 | ||
|
||
from .. import state | ||
from .. libs import key_auth | ||
from api.graphql.session.session import Session | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2021-2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2021-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -14,11 +14,13 @@ | |
# along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from importlib import import_module | ||
from typing import Any, Dict, Optional | ||
from ariadne import ObjectType, convert_camel_case_to_snake | ||
from graphql import GraphQLResolveInfo | ||
from makefun import with_signature | ||
|
||
# used below by func_sig | ||
from typing import Any, Dict, Optional # pylint: disable=W0611 | ||
from graphql import GraphQLResolveInfo # pylint: disable=W0611 | ||
|
||
from .. import state | ||
from .. libs import key_auth | ||
from api.graphql.session.session import Session | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2022-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -16,7 +16,9 @@ | |
import os | ||
import re | ||
import typing | ||
from typing import Union, Tuple, Optional | ||
|
||
from typing import Union | ||
from typing import Optional | ||
from humps import decamelize | ||
|
||
from vyos.defaults import directories | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright 2021-2022 VyOS maintainers and contributors <[email protected]> | ||
# Copyright 2021-2024 VyOS maintainers and contributors <[email protected]> | ||
# | ||
# This library is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU Lesser General Public | ||
|
@@ -21,7 +21,6 @@ | |
from vyos.config import Config | ||
from vyos.configtree import ConfigTree | ||
from vyos.defaults import directories | ||
from vyos.template import render | ||
from vyos.opmode import Error as OpModeError | ||
|
||
from api.graphql.libs.op_mode import load_op_mode_as_module, split_compound_op_mode_name | ||
|