mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
Fix: code quality issues (#59385)
* Fixed code quality issues using DeepSource * Removed redundant call * Removed unnecessary import alias * Removed unused imports * Removed duplicate elements during set declaration * Delete .deepsource.toml * Update vmctl.py * Update vmctl.py * Update vmctl.py
This commit is contained in:
parent
8ebc975471
commit
a112a2479c
6 changed files with 17 additions and 20 deletions
|
@ -1,4 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
:codeauthor: Pedro Algarvio (pedro@algarvio.me)
|
||||
|
||||
|
@ -9,8 +8,7 @@
|
|||
Properly handle ``__func_alias__``
|
||||
"""
|
||||
|
||||
# Import Sphinx libs
|
||||
from sphinx.ext.autodoc import FunctionDocumenter as FunctionDocumenter
|
||||
from sphinx.ext.autodoc import FunctionDocumenter
|
||||
|
||||
|
||||
class SaltFunctionDocumenter(FunctionDocumenter):
|
||||
|
|
|
@ -7,8 +7,7 @@ from docutils import nodes
|
|||
from docutils.parsers.rst import Directive
|
||||
from docutils.statemachine import ViewList
|
||||
from sphinx import addnodes
|
||||
from sphinx.directives import ObjectDescription
|
||||
from sphinx.domains import Domain, ObjType
|
||||
from sphinx.domains import ObjType
|
||||
from sphinx.domains import python as python_domain
|
||||
from sphinx.domains.python import PyObject
|
||||
from sphinx.locale import _
|
||||
|
@ -53,7 +52,7 @@ class LiterateCoding(Directive):
|
|||
comment; False designates code.
|
||||
"""
|
||||
comment_char = "#" # TODO: move this into a directive option
|
||||
comment = re.compile(r"^\s*{0}[ \n]".format(comment_char))
|
||||
comment = re.compile(r"^\s*{}[ \n]".format(comment_char))
|
||||
section_test = lambda val: bool(comment.match(val))
|
||||
|
||||
sections = []
|
||||
|
@ -70,7 +69,7 @@ class LiterateCoding(Directive):
|
|||
def run(self):
|
||||
try:
|
||||
lines = self.parse_lit(self.parse_file(self.arguments[0]))
|
||||
except IOError as exc:
|
||||
except OSError as exc:
|
||||
document = self.state.document
|
||||
return [document.reporter.warning(str(exc), line=self.lineno)]
|
||||
|
||||
|
@ -136,7 +135,7 @@ class LiterateFormula(LiterateCoding):
|
|||
formulas_dirs = config.formulas_dirs
|
||||
fpath = sls_path.replace(".", "/")
|
||||
|
||||
name_options = ("{0}.sls".format(fpath), os.path.join(fpath, "init.sls"))
|
||||
name_options = ("{}.sls".format(fpath), os.path.join(fpath, "init.sls"))
|
||||
|
||||
paths = [
|
||||
os.path.join(fdir, fname)
|
||||
|
@ -148,10 +147,10 @@ class LiterateFormula(LiterateCoding):
|
|||
try:
|
||||
with open(i, "rb") as f:
|
||||
return f.readlines()
|
||||
except IOError:
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
raise IOError("Could not find sls file '{0}'".format(sls_path))
|
||||
raise OSError("Could not find sls file '{}'".format(sls_path))
|
||||
|
||||
|
||||
class CurrentFormula(Directive):
|
||||
|
@ -196,7 +195,7 @@ class Formula(Directive):
|
|||
targetnode = nodes.target("", "", ids=["module-" + formname], ismod=True)
|
||||
self.state.document.note_explicit_target(targetnode)
|
||||
|
||||
indextext = u"{0}-formula)".format(formname)
|
||||
indextext = "{}-formula)".format(formname)
|
||||
inode = addnodes.index(
|
||||
entries=[("single", indextext, "module-" + formname, "")]
|
||||
)
|
||||
|
@ -221,9 +220,9 @@ class State(Directive):
|
|||
|
||||
formula = env.temp_data.get("salt:formula")
|
||||
|
||||
indextext = u"{1} ({0}-formula)".format(formula, statename)
|
||||
indextext = "{1} ({0}-formula)".format(formula, statename)
|
||||
inode = addnodes.index(
|
||||
entries=[("single", indextext, "module-{0}".format(statename), ""),]
|
||||
entries=[("single", indextext, "module-{}".format(statename), ""),]
|
||||
)
|
||||
|
||||
return [targetnode, inode]
|
||||
|
@ -280,7 +279,7 @@ class SaltDomain(python_domain.PythonDomain):
|
|||
if doc:
|
||||
return make_refnode(builder, fromdocname, doc, target, contnode, target)
|
||||
else:
|
||||
super(SaltDomain, self).resolve_xref(
|
||||
super().resolve_xref(
|
||||
env, fromdocname, builder, type, target, node, contnode
|
||||
)
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ _CREATE_OPTIONS_REQUIRED = {
|
|||
_ADD_OPTIONS = {
|
||||
"bitmap:ip": {"timeout", "packets", "bytes", "skbmark", "skbprio", "skbqueue"},
|
||||
"bitmap:ip,mac": {"timeout", "packets", "bytes", "skbmark", "skbprio", "skbqueue"},
|
||||
"bitmap:port": {"timeout", "packets", "bytes", "skbmark", "skbprio", "skbprio"},
|
||||
"bitmap:port": {"timeout", "packets", "bytes", "skbmark", "skbprio"},
|
||||
"hash:ip": {"timeout", "packets", "bytes", "skbmark", "skbprio", "skbqueue"},
|
||||
"hash:mac": {"timeout", "packets", "bytes", "skbmark", "skbprio", "skbqueue"},
|
||||
"hash:net": {
|
||||
|
|
|
@ -11,6 +11,7 @@ Manage vms running on the OpenBSD VMM hypervisor using vmctl(8).
|
|||
target machine.
|
||||
"""
|
||||
|
||||
|
||||
import logging
|
||||
import re
|
||||
|
||||
|
@ -310,7 +311,7 @@ def status(name=None, id=None):
|
|||
|
||||
# Grab the header and save it with the lowercase names.
|
||||
header = result["stdout"].splitlines()[0].split()
|
||||
header = list([x.lower() for x in header])
|
||||
header = [x.lower() for x in header]
|
||||
|
||||
# A VM can be in one of the following states (from vmm.c:vcpu_state_decode())
|
||||
# - stopped
|
||||
|
|
|
@ -6027,9 +6027,9 @@ def _processValueItem(
|
|||
element_valuenames = []
|
||||
element_values = this_element_value
|
||||
if this_element_value is not None:
|
||||
element_valuenames = list(
|
||||
[str(z) for z in range(1, len(this_element_value) + 1)]
|
||||
)
|
||||
element_valuenames = [
|
||||
str(z) for z in range(1, len(this_element_value) + 1)
|
||||
]
|
||||
if "additive" in element.attrib:
|
||||
if element.attrib["additive"].lower() == "false":
|
||||
# a delete values will be added before all the other
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
import hashlib
|
||||
import os
|
||||
|
||||
from yum import config
|
||||
from yum.plugins import TYPE_CORE
|
||||
|
||||
CK_PATH = "/var/cache/salt/minion/rpmdb.cookie"
|
||||
|
|
Loading…
Add table
Reference in a new issue