Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary assignment before return statement #958

Merged
merged 1 commit into from
Jul 1, 2024
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
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