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

Sort slots - Fix RUF023 #936

Merged
merged 1 commit into from
Jun 28, 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
10 changes: 5 additions & 5 deletions nornir/core/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def dict(self) -> Dict[str, Any]:


class InventoryConfig(object):
__slots__ = "plugin", "options", "transform_function", "transform_function_options"
__slots__ = "options", "plugin", "transform_function", "transform_function_options"

class Parameters:
plugin = Parameter(typ=str, default="SimpleInventory", envvar="NORNIR_INVENTORY_PLUGIN")
Expand Down Expand Up @@ -102,7 +102,7 @@ def dict(self) -> Dict[str, Any]:


class LoggingConfig(object):
__slots__ = "enabled", "level", "log_file", "format", "to_console", "loggers"
__slots__ = "enabled", "format", "level", "log_file", "loggers", "to_console"

class Parameters:
enabled = Parameter(default=True, envvar="NORNIR_LOGGING_ENABLED")
Expand Down Expand Up @@ -195,7 +195,7 @@ def configure(self) -> None:


class RunnerConfig(object):
__slots__ = ("plugin", "options")
__slots__ = ("options", "plugin")

class Parameters:
plugin = Parameter(default="threaded", envvar="NORNIR_RUNNER_PLUGIN")
Expand Down Expand Up @@ -232,10 +232,10 @@ def dict(self) -> Dict[str, Any]:
class Config(object):
__slots__ = (
"core",
"runner",
"ssh",
"inventory",
"logging",
"runner",
"ssh",
"user_defined",
)

Expand Down
10 changes: 5 additions & 5 deletions nornir/core/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@


class BaseAttributes(object):
__slots__ = ("hostname", "port", "username", "password", "platform")
__slots__ = ("hostname", "password", "platform", "port", "username")

def __init__(
self,
Expand Down Expand Up @@ -113,7 +113,7 @@ def add(self, group: "Group") -> None:


class InventoryElement(BaseAttributes):
__slots__ = ("groups", "data", "connection_options")
__slots__ = ("connection_options", "data", "groups")

def __init__(
self,
Expand Down Expand Up @@ -195,7 +195,7 @@ def extended_groups(self) -> List["Group"]:


class Defaults(BaseAttributes):
__slots__ = ("data", "connection_options")
__slots__ = ("connection_options", "data")

def __init__(
self,
Expand Down Expand Up @@ -234,7 +234,7 @@ def dict(self) -> Dict[str, Any]:


class Host(InventoryElement):
__slots__ = ("name", "connections", "defaults")
__slots__ = ("connections", "defaults", "name")

def __init__(
self,
Expand Down Expand Up @@ -577,7 +577,7 @@ def __call__(self, host: Host, **kwargs: Any) -> bool: ...


class Inventory(object):
__slots__ = ("hosts", "groups", "defaults")
__slots__ = ("defaults", "groups", "hosts")

def __init__(
self,
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ ignore = [
"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`
"RUF023", # `__slots__` is not sorted
"RUF100", # Unused blanket `noqa` directive
"S701", # By default, jinja2 sets `autoescape` to `False`. Consider using `autoescape=True` or the `select_autoescape` function to mitigate XSS vulnerabilities.
"SLF001", # Private member accessed
Expand Down