Skip to content

Commit

Permalink
Linting.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jul 6, 2022
1 parent 7b6fa60 commit c29837f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/antsibull_docs/lint_plugin_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import tempfile
import typing as t

import docutils.utils
import sh

from antsibull_core.compat import asyncio_run
Expand Down Expand Up @@ -41,6 +40,8 @@


class CollectionCopier:
dir: t.Optional[str]

def __init__(self):
self.dir = None

Expand All @@ -51,21 +52,23 @@ def __enter__(self):
return self

def add_collection(self, collecion_source_path: str, namespace: str, name: str) -> None:
if self.dir is None:
self_dir = self.dir
if self_dir is None:
raise AssertionError('Collection copier not initialized')
collection_container_dir = os.path.join(
self.dir, 'ansible_collections', namespace)
self_dir, 'ansible_collections', namespace)
os.makedirs(collection_container_dir, exist_ok=True)

collection_dir = os.path.join(collection_container_dir, name)
shutil.copytree(collecion_source_path, collection_dir, symlinks=True)

return self.dir
return self_dir

def __exit__(self, type_, value, traceback_):
if self.dir is None:
self_dir = self.dir
if self_dir is None:
raise AssertionError('Collection copier not initialized')
shutil.rmtree(self.dir, ignore_errors=True)
shutil.rmtree(self_dir, ignore_errors=True)
self.dir = None


Expand Down
2 changes: 1 addition & 1 deletion stubs/rstcheck.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ def check(source: str,
ignore: Union[dict, None] = ...,
debug: bool = ...) -> List[Tuple[int, str]]: ...

def ignore_directives_and_roles(directives: List[str], roles: List[str]) -> None:
def ignore_directives_and_roles(directives: List[str], roles: List[str]) -> None: ...

0 comments on commit c29837f

Please sign in to comment.