ACIL FM
Dark
Refresh
Current DIR:
/usr/lib/python3.9/site-packages/ansible/utils
/
usr
lib
python3.9
site-packages
ansible
utils
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
collection_loader
-
chmod
Open
Rename
Delete
__pycache__
-
chmod
Open
Rename
Delete
cmd_functions.py
2.16 MB
chmod
View
DL
Edit
Rename
Delete
color.py
4.01 MB
chmod
View
DL
Edit
Rename
Delete
context_objects.py
3.05 MB
chmod
View
DL
Edit
Rename
Delete
display.py
18.99 MB
chmod
View
DL
Edit
Rename
Delete
encrypt.py
10.26 MB
chmod
View
DL
Edit
Rename
Delete
fqcn.py
1.24 MB
chmod
View
DL
Edit
Rename
Delete
galaxy.py
3.82 MB
chmod
View
DL
Edit
Rename
Delete
hashing.py
2.84 MB
chmod
View
DL
Edit
Rename
Delete
helpers.py
1.8 MB
chmod
View
DL
Edit
Rename
Delete
jsonrpc.py
3.74 MB
chmod
View
DL
Edit
Rename
Delete
listify.py
1.67 MB
chmod
View
DL
Edit
Rename
Delete
lock.py
1.36 MB
chmod
View
DL
Edit
Rename
Delete
multiprocessing.py
698 B
chmod
View
DL
Edit
Rename
Delete
native_jinja.py
346 B
chmod
View
DL
Edit
Rename
Delete
path.py
5.74 MB
chmod
View
DL
Edit
Rename
Delete
plugin_docs.py
14.74 MB
chmod
View
DL
Edit
Rename
Delete
py3compat.py
2.35 MB
chmod
View
DL
Edit
Rename
Delete
sentinel.py
2.4 MB
chmod
View
DL
Edit
Rename
Delete
shlex.py
1.25 MB
chmod
View
DL
Edit
Rename
Delete
singleton.py
949 B
chmod
View
DL
Edit
Rename
Delete
ssh_functions.py
2.23 MB
chmod
View
DL
Edit
Rename
Delete
unicode.py
1.14 MB
chmod
View
DL
Edit
Rename
Delete
unsafe_proxy.py
12.43 MB
chmod
View
DL
Edit
Rename
Delete
vars.py
9.9 MB
chmod
View
DL
Edit
Rename
Delete
version.py
7.65 MB
chmod
View
DL
Edit
Rename
Delete
_junit_xml.py
8.53 MB
chmod
View
DL
Edit
Rename
Delete
__init__.py
833 B
chmod
View
DL
Edit
Rename
Delete
Edit file: /usr/lib/python3.9/site-packages/ansible/utils/_junit_xml.py
""" Dataclasses for creating JUnit XML files. See: https://github.com/junit-team/junit5/blob/main/platform-tests/src/test/resources/jenkins-junit.xsd """ from __future__ import annotations import abc import dataclasses import datetime import decimal from xml.dom import minidom # noinspection PyPep8Naming from xml.etree import ElementTree as ET @dataclasses.dataclass # type: ignore[misc] # https://github.com/python/mypy/issues/5374 class TestResult(metaclass=abc.ABCMeta): """Base class for the result of a test case.""" output: str | None = None message: str | None = None type: str | None = None def __post_init__(self): if self.type is None: self.type = self.tag @property @abc.abstractmethod def tag(self) -> str: """Tag name for the XML element created by this result type.""" def get_attributes(self) -> dict[str, str]: """Return a dictionary of attributes for this instance.""" return _attributes( message=self.message, type=self.type, ) def get_xml_element(self) -> ET.Element: """Return an XML element representing this instance.""" element = ET.Element(self.tag, self.get_attributes()) element.text = self.output return element @dataclasses.dataclass class TestFailure(TestResult): """Failure info for a test case.""" @property def tag(self) -> str: """Tag name for the XML element created by this result type.""" return 'failure' @dataclasses.dataclass class TestError(TestResult): """Error info for a test case.""" @property def tag(self) -> str: """Tag name for the XML element created by this result type.""" return 'error' @dataclasses.dataclass class TestCase: """An individual test case.""" name: str assertions: int | None = None classname: str | None = None status: str | None = None time: decimal.Decimal | None = None errors: list[TestError] = dataclasses.field(default_factory=list) failures: list[TestFailure] = dataclasses.field(default_factory=list) skipped: str | None = None system_out: str | None = None system_err: str | None = None is_disabled: bool = False @property def is_failure(self) -> bool: """True if the test case contains failure info.""" return bool(self.failures) @property def is_error(self) -> bool: """True if the test case contains error info.""" return bool(self.errors) @property def is_skipped(self) -> bool: """True if the test case was skipped.""" return bool(self.skipped) def get_attributes(self) -> dict[str, str]: """Return a dictionary of attributes for this instance.""" return _attributes( assertions=self.assertions, classname=self.classname, name=self.name, status=self.status, time=self.time, ) def get_xml_element(self) -> ET.Element: """Return an XML element representing this instance.""" element = ET.Element('testcase', self.get_attributes()) if self.skipped: ET.SubElement(element, 'skipped').text = self.skipped element.extend([error.get_xml_element() for error in self.errors]) element.extend([failure.get_xml_element() for failure in self.failures]) if self.system_out: ET.SubElement(element, 'system-out').text = self.system_out if self.system_err: ET.SubElement(element, 'system-err').text = self.system_err return element @dataclasses.dataclass class TestSuite: """A collection of test cases.""" name: str hostname: str | None = None id: str | None = None package: str | None = None timestamp: datetime.datetime | None = None properties: dict[str, str] = dataclasses.field(default_factory=dict) cases: list[TestCase] = dataclasses.field(default_factory=list) system_out: str | None = None system_err: str | None = None def __post_init__(self): if self.timestamp and self.timestamp.tzinfo != datetime.timezone.utc: raise ValueError(f'timestamp.tzinfo must be {datetime.timezone.utc!r}') @property def disabled(self) -> int: """The number of disabled test cases.""" return sum(case.is_disabled for case in self.cases) @property def errors(self) -> int: """The number of test cases containing error info.""" return sum(case.is_error for case in self.cases) @property def failures(self) -> int: """The number of test cases containing failure info.""" return sum(case.is_failure for case in self.cases) @property def skipped(self) -> int: """The number of test cases containing skipped info.""" return sum(case.is_skipped for case in self.cases) @property def tests(self) -> int: """The number of test cases.""" return len(self.cases) @property def time(self) -> decimal.Decimal: """The total time from all test cases.""" return decimal.Decimal(sum(case.time for case in self.cases if case.time)) def get_attributes(self) -> dict[str, str]: """Return a dictionary of attributes for this instance.""" return _attributes( disabled=self.disabled, errors=self.errors, failures=self.failures, hostname=self.hostname, id=self.id, name=self.name, package=self.package, skipped=self.skipped, tests=self.tests, time=self.time, timestamp=self.timestamp.replace(tzinfo=None).isoformat(timespec='seconds') if self.timestamp else None, ) def get_xml_element(self) -> ET.Element: """Return an XML element representing this instance.""" element = ET.Element('testsuite', self.get_attributes()) if self.properties: ET.SubElement(element, 'properties').extend([ET.Element('property', dict(name=name, value=value)) for name, value in self.properties.items()]) element.extend([test_case.get_xml_element() for test_case in self.cases]) if self.system_out: ET.SubElement(element, 'system-out').text = self.system_out if self.system_err: ET.SubElement(element, 'system-err').text = self.system_err return element @dataclasses.dataclass class TestSuites: """A collection of test suites.""" name: str | None = None suites: list[TestSuite] = dataclasses.field(default_factory=list) @property def disabled(self) -> int: """The number of disabled test cases.""" return sum(suite.disabled for suite in self.suites) @property def errors(self) -> int: """The number of test cases containing error info.""" return sum(suite.errors for suite in self.suites) @property def failures(self) -> int: """The number of test cases containing failure info.""" return sum(suite.failures for suite in self.suites) @property def tests(self) -> int: """The number of test cases.""" return sum(suite.tests for suite in self.suites) @property def time(self) -> decimal.Decimal: """The total time from all test cases.""" return decimal.Decimal(sum(suite.time for suite in self.suites)) def get_attributes(self) -> dict[str, str]: """Return a dictionary of attributes for this instance.""" return _attributes( disabled=self.disabled, errors=self.errors, failures=self.failures, name=self.name, tests=self.tests, time=self.time, ) def get_xml_element(self) -> ET.Element: """Return an XML element representing this instance.""" element = ET.Element('testsuites', self.get_attributes()) element.extend([suite.get_xml_element() for suite in self.suites]) return element def to_pretty_xml(self) -> str: """Return a pretty formatted XML string representing this instance.""" return _pretty_xml(self.get_xml_element()) def _attributes(**kwargs) -> dict[str, str]: """Return the given kwargs as a dictionary with values converted to strings. Items with a value of None will be omitted.""" return {key: str(value) for key, value in kwargs.items() if value is not None} def _pretty_xml(element: ET.Element) -> str: """Return a pretty formatted XML string representing the given element.""" return minidom.parseString(ET.tostring(element, encoding='unicode')).toprettyxml()
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply