Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 16, 2020
1 parent d121560 commit b3bf1be
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions configconfig/autoconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def run(self) -> Sequence[nodes.Node]: # type: ignore
return node_list

else:
module_name, class_ = config_var.rsplit(".", 1)
module_name, class_ = config_var.rsplit('.', 1)
var_obj = import_object(module_name, [class_])[3]
if not issubclass(var_obj, ConfigVar):
warnings.warn("'autoconfig' can only be used with 'ConfigVar' subclasses.")
Expand All @@ -164,8 +164,8 @@ def document_config_var(self, var_obj: Type[ConfigVar]) -> nodes.paragraph:
targetid = f'autoconfig-{self.env.new_serialno("autoconfig"):d}'
targetnode = nodes.section(ids=[targetid])

content = docstring.replace("\t", " ")
view = StringList(content.split("\n"))
content = docstring.replace('\t', " ")
view = StringList(content.split('\n'))
config_node = nodes.paragraph(rawsource=content)
self.state.nested_parse(view, self.content_offset, config_node)

Expand All @@ -183,7 +183,7 @@ def parse_conf_node(env: BuildEnvironment, text: str, node: addnodes.desc_signat
:param node: The docutils node class.
"""

args = text.split("^")
args = text.split('^')
name = args[0].strip()

node += addnodes.literal_strong(name, name)
Expand Down
4 changes: 2 additions & 2 deletions configconfig/configvar.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def make_documentation(cls):
docstring = cls.__doc__ or ''
docstring = (indent(dedent(docstring), tab))

if not docstring.startswith("\n"):
docstring = "\n" + docstring
if not docstring.startswith('\n'):
docstring = '\n' + docstring

buf = StringList()
buf.indent_type = " "
Expand Down
2 changes: 1 addition & 1 deletion configconfig/metaclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def get_schema_entry(cls, schema: Optional[Dict] = None) -> Dict[str, Any]:
schema["required"].append(cls.__name__)

for line in (cls.__doc__ or '').split("\n\n"):
line = " ".join([p.strip() for p in line.split("\n") if p.strip()])
line = ' '.join([p.strip() for p in line.split('\n') if p.strip()])
if line:
schema["properties"][cls.__name__]["description"] = line
break
Expand Down
2 changes: 1 addition & 1 deletion configconfig/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_args(tp):
]

#: A literal ``TAB`` (``\t``) character for use in f-strings.
tab = "\t"
tab = '\t'

if sys.version_info < (3, 7):
UnionType = Any
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
domdf_python_tools>=0.10.0
domdf-python-tools>=0.10.0
jsonschema>=3.2.0
ruamel.yaml>=0.16.12
typing_extensions>=3.7.4.3
typing_inspect>=0.6.0
ruamel-yaml>=0.16.12
typing-extensions>=3.7.4.3
typing-inspect>=0.6.0
6 changes: 3 additions & 3 deletions tests/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ def validate(cls, raw_config_vars: Optional[Dict[str, Any]] = None):

@staticmethod
def validator(name: str) -> str:
name = name.replace("-", "_") # replace hyphens with underscores
name = name.replace("/", ".")
for part in name.split("."):
name = name.replace('-', '_') # replace hyphens with underscores
name = name.replace('/', '.')
for part in name.split('.'):
if not part.isidentifier():
raise ValueError(
"""\
Expand Down
6 changes: 3 additions & 3 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ def parse_extras(raw_config_vars: Dict[str, Any], repo_path: pathlib.Path) -> Tu
if (repo_path / requires).is_file():
# a path to the requirements file from the repo root
extras_require[extra] = [
x for x in (repo_path / requires).read_text(encoding="UTF-8").split("\n") if x
x for x in (repo_path / requires).read_text(encoding="UTF-8").split('\n') if x
]
if requires not in additional_requirements_files:
additional_requirements_files.append(requires)
else:
# A single requirement
extras_require[extra] = [requires]

all_extras += [x.replace(" ", '') for x in extras_require[extra]]
all_extras += [x.replace(' ', '') for x in extras_require[extra]]

all_extras = sorted(set(all_extras))

Expand All @@ -174,7 +174,7 @@ def get_tox_python_versions(python_versions: Iterable[str]) -> List[str]:
tox_py_versions = []

for py_version in python_versions:
py_version = str(py_version).replace(".", '')
py_version = str(py_version).replace('.', '')
if not py_version.startswith("py"):
py_version = f"py{py_version}"
tox_py_versions.append(py_version)
Expand Down

0 comments on commit b3bf1be

Please sign in to comment.