Skip to content

Commit

Permalink
chore: update pylint and linting (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed Feb 1, 2023
1 parent abbd269 commit 2db5e42
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -486,4 +486,4 @@ allow-any-import-level=

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception
10 changes: 5 additions & 5 deletions c8ylp/cli/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,11 @@ def run_proxy_in_background(
background = threading.Thread(
target=start_proxy,
args=(ctx, opts),
kwargs=dict(
connection_data=connection_data,
stop_signal=stop_signal,
ready_signal=_local_ready_signal,
),
kwargs={
"connection_data": connection_data,
"stop_signal": stop_signal,
"ready_signal": _local_ready_signal,
},
daemon=True,
)
background.start()
Expand Down
12 changes: 8 additions & 4 deletions c8ylp/cli/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
from .core import ExitCodes, ProxyContext


class CommandNotFound(Exception):
"""Command not found"""


def plugin_folders() -> List[Path]:
"""Plugin folders
Expand Down Expand Up @@ -113,7 +117,7 @@ def build_cmd_args(cmd_args: List[str]) -> List[str]:
return out_args

if not shutil.which(custom_shell):
raise Exception(f"Could not find {custom_shell}")
raise CommandNotFound(f"Could not find {custom_shell}")

return [shutil.which(custom_shell)] + out_args

Expand Down Expand Up @@ -288,9 +292,9 @@ def cli_plugin():
cls=PluginCLI,
hidden=False,
options_metavar="",
context_settings=dict(
ignore_unknown_options=True,
),
context_settings={
"ignore_unknown_options": True,
},
)
def run():
"""
Expand Down
2 changes: 1 addition & 1 deletion c8ylp/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_unused_port() -> int:
return sock.getsockname()[1]


CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}


@click.group(context_settings=CONTEXT_SETTINGS)
Expand Down
2 changes: 1 addition & 1 deletion c8ylp/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .cli.version import version
from .cli.connect import commands as connect

CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
CONTEXT_SETTINGS = {"help_option_names": ["-h", "--help"]}


@click.group()
Expand Down
6 changes: 5 additions & 1 deletion c8ylp/rest_client/c8yclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
from c8ylp.rest_client.sessions import BaseUrlSession


class CumulocityError(Exception):
"""Cumulocity error"""


class CumulocityMissingTFAToken(Exception):
"""Cumulocity missing TFA token"""

Expand Down Expand Up @@ -359,7 +363,7 @@ def get_managed_object(
mor_id = ext_id.get("managedObject", {}).get("id")

if not mor_id:
raise Exception("Managed object id is empty")
raise CumulocityError("Managed object id is empty")

response = self.session.get(f"/inventory/managedObjects/{mor_id}")
if response.status_code == 200:
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
invoke==2.0.0

# Linting/formating
pylint==2.15.5
pylint==2.16.0
black==22.10.0
licenseheaders==0.8.8

Expand Down

0 comments on commit 2db5e42

Please sign in to comment.