PyFunceble.cli.filesystem.printer package

Submodules

PyFunceble.cli.filesystem.printer.base module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the base of all our printers.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2021 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.cli.filesystem.printer.base.PrinterBase(template_to_use: Optional[str] = None, *, dataset: Optional[Dict[str, str]] = None)[source]

Bases: object

Provides the base of all printer class.

Printer classes are classes which derivate from this class. their objectives should be the same: Unify and simplify the way to print something to a given destination.

HEADERS = {'amount': 'Amount', 'checker_type': 'Checker', 'days': 'Days', 'expiration_date': 'Expiration Date', 'hours': 'Hours', 'http_status_code': 'HTTP Code', 'idna_subject': 'Subject', 'ip': 'IP', 'minutes': 'Minutes', 'percentage': 'Percentage', 'seconds': 'Seconds', 'status': 'Status', 'status_source': 'Source'}
STD_LENGTH = {'amount': 12, 'checker_type': 13, 'days': 2, 'expiration_date': 17, 'hours': 2, 'http_status_code': 10, 'idna_subject': 100, 'minutes': 2, 'percentage': 12, 'seconds': 6, 'status': 11, 'status_source': 10}
STD_UNKNOWN = 'Unknown'
TEMPLATES = {'all': <string.Template object>, 'execution_time': <string.Template object>, 'hosts': <string.Template object>, 'less': <string.Template object>, 'percentage': <string.Template object>, 'plain': <string.Template object>, 'simple': <string.Template object>}
dataset

Provides the current state of the _dataset attribute.

ensure_dataset_is_given()[source]

Ensures that the dataset to write is given before launching the decorated method.

Raises:TypeError – When the current self.template_to_use is not set.
ensure_template_to_use_is_given()[source]

Ensures that the template to use is given before launching the decorated method.

Raises:TypeError – When the current self.template_to_use is not set.
get_header_to_print() → str[source]

Provides the template header to print.

get_line_to_print() → str[source]

Provides the line to print.

print_header() → None[source]

Prints the header.

print_interpolated_line() → None[source]

Prints the line where we are suppose to write it.

set_dataset(value: Dict[str, str]) → PyFunceble.cli.filesystem.printer.base.PrinterBase[source]

Sets the dataset to apply to the template.

Parameters:value – The value to set.
set_template_to_use(value: str) → PyFunceble.cli.filesystem.printer.base.PrinterBase[source]

Sets the template to use.

Parameters:value – The value to set.
template_to_use

Provides the current state of the _template_to_use attribute.

PyFunceble.cli.filesystem.printer.file module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the file printer.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2021 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.cli.filesystem.printer.file.FilePrinter(template_to_use: Optional[str] = None, *, dataset: Optional[Dict[str, str]] = None, destination: Optional[str] = None)[source]

Bases: PyFunceble.cli.filesystem.printer.base.PrinterBase

Provides the file printer.

STD_FILE_GENERATION = '# Generated by PyFunceble (v4.0.1.) / https://git.io/vpZoI\n'
allow_coloration = True
destination

Provides the current state of the _destination attribute.

ensure_destination_is_given()[source]

Ensures that the destination is given before launching the decorated method.

Raises:TypeError – When the current self.template_to_use is not set.
file_helper = <PyFunceble.helpers.file.FileHelper object>
static get_generation_date_line() → str[source]

Provides the line which informs of the date a file was generated.

print_interpolated_line() → None[source]

Prints the interpolated line into the destination.

propagate_destination()[source]

Propagates the new value of the destination just after launching the decorated method.

set_destination(value: str) → PyFunceble.cli.filesystem.printer.file.FilePrinter[source]

Sets the destination to use.

Parameters:value – The value to set.

PyFunceble.cli.filesystem.printer.stdout module

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides the stdout printer.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2021 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
class PyFunceble.cli.filesystem.printer.stdout.StdoutPrinter(template_to_use: Optional[str] = None, *, dataset: Optional[Dict[str, str]] = None, allow_coloration: Optional[bool] = None)[source]

Bases: PyFunceble.cli.filesystem.printer.base.PrinterBase

Provides the stdout printer.

BACKGROUND_COLORATED = ['all', 'less']
FOREGROUND_COLORATED = ['percentage', 'simple']
STATUS2BACKGROUND_COLOR = {'ACTIVE': '\x1b[30m\x1b[42m', 'INACTIVE': '\x1b[30m\x1b[41m', 'INVALID': '\x1b[30m\x1b[46m', 'MALICIOUS': '\x1b[30m\x1b[41m', 'SANE': '\x1b[30m\x1b[42m', 'VALID': '\x1b[30m\x1b[42m'}
STATUS2FORGROUND_COLOR = {'ACTIVE': '\x1b[1m\x1b[32m', 'INACTIVE': '\x1b[1m\x1b[31m', 'INVALID': '\x1b[1m\x1b[36m', 'MALICIOUS': '\x1b[1m\x1b[31m', 'SANE': '\x1b[1m\x1b[32m', 'VALID': '\x1b[1m\x1b[32m'}
STD_ALLOW_COLORATION = True
STD_FILE_HEADER = '# Generated by PyFunceble (v4.0.1.) / https://git.io/vpZoI\n'
allow_coloration

Provides the current state of the _allow_coloration attribute.

guess_allow_coloration() → PyFunceble.cli.filesystem.printer.stdout.StdoutPrinter[source]

Try to guess and set the allow_coloration attribute.

print_interpolated_line()[source]

Prints the interpolated line into the destination.

set_allow_coloration(value: bool) → PyFunceble.cli.filesystem.printer.stdout.StdoutPrinter[source]

Sets the authorization to use the coloration.

Parameters:value – The value to set.

Module contents

The tool to check the availability or syntax of domain, IP or URL.

██████╗ ██╗   ██╗███████╗██╗   ██╗███╗   ██╗ ██████╗███████╗██████╗ ██╗     ███████╗
██╔══██╗╚██╗ ██╔╝██╔════╝██║   ██║████╗  ██║██╔════╝██╔════╝██╔══██╗██║     ██╔════╝
██████╔╝ ╚████╔╝ █████╗  ██║   ██║██╔██╗ ██║██║     █████╗  ██████╔╝██║     █████╗
██╔═══╝   ╚██╔╝  ██╔══╝  ██║   ██║██║╚██╗██║██║     ██╔══╝  ██╔══██╗██║     ██╔══╝
██║        ██║   ██║     ╚██████╔╝██║ ╚████║╚██████╗███████╗██████╔╝███████╗███████╗
╚═╝        ╚═╝   ╚═╝      ╚═════╝ ╚═╝  ╚═══╝ ╚═════╝╚══════╝╚═════╝ ╚══════╝╚══════╝

Provides everything related to what we actually print (output) or to a file.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Special thanks:
https://pyfunceble.github.io/#/special-thanks
Contributors:
https://pyfunceble.github.io/#/contributors
Project link:
https://github.com/funilrys/PyFunceble
Project documentation:
https://pyfunceble.readthedocs.io/en/latest/
Project homepage:
https://pyfunceble.github.io/

License:

Copyright 2017, 2018, 2019, 2020, 2021 Nissar Chababy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.