Skip to content

Commit

Permalink
Remove unnecessary assignment before return statement
Browse files Browse the repository at this point in the history
  • Loading branch information
ogenstad committed Jul 1, 2024
1 parent dcdc34e commit 57e5aa0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 1 addition & 2 deletions nornir/init_nornir.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ def load_runner(
) -> RunnerPlugin:
RunnersPluginRegister.auto_register()
runner_plugin = RunnersPluginRegister.get_plugin(config.runner.plugin)
runner = runner_plugin(**config.runner.options)
return runner
return runner_plugin(**config.runner.options)


def InitNornir(
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ ignore = [
"PTH100", # `os.path.abspath()` should be replaced by `Path.resolve()`
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"PTH123", # `open()` should be replaced by `Path.open()`
"RET504", # Unnecessary assignment before `return` statement
"RSE102", # Unnecessary parentheses on raised exception
"RUF001", # String contains ambiguous `–` (EN DASH). Did you mean `-` (HYPHEN-MINUS)?
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
Expand Down
7 changes: 2 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_defaults():
with open(defaults_file, "r") as f:
defaults_dict = yml.load(f)

defaults = Defaults(
return Defaults(
hostname=defaults_dict.get("hostname"),
port=defaults_dict.get("port"),
username=defaults_dict.get("username"),
Expand All @@ -55,8 +55,6 @@ def get_defaults():
),
)

return defaults

def get_inventory_element(typ, data, name, defaults):
return typ(
name=name,
Expand Down Expand Up @@ -124,8 +122,7 @@ def inv(request):
@pytest.fixture(scope="session", autouse=True)
def nornir(request):
"""Initializes nornir"""
nr = Nornir(inventory=inventory_from_yaml(), runner=SerialRunner(), data=global_data)
return nr
return Nornir(inventory=inventory_from_yaml(), runner=SerialRunner(), data=global_data)


@pytest.fixture(scope="function", autouse=True)
Expand Down

0 comments on commit 57e5aa0

Please sign in to comment.