PyFunceble.cli.utils package

Submodules

PyFunceble.cli.utils.sort module

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

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

Provides some utilities related to the sorting mechanism.

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, 2022, 2023 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.
PyFunceble.cli.utils.sort.get_best_sorting_key() → Callable[[Any], List[Union[int, Any]]][source]

Provides the best sorting key from the configuration.

PyFunceble.cli.utils.sort.hierarchical(element: Any) → List[Union[int, Any]][source]

Provides the key to use for the hierarchical sorting.

Parameters:element – The element to format.
PyFunceble.cli.utils.sort.standard(element: Any) → List[Union[int, Any]][source]

Provides the key to use for the standard sorting.

Parameters:element – The element to format.

PyFunceble.cli.utils.stdout module

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

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

Provides some utilities related to the CLI stdout.

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, 2022, 2023 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.
PyFunceble.cli.utils.stdout.get_template_to_use() → str[source]

Provides the template to use.

PyFunceble.cli.utils.stdout.print_single_line(value: str = '.', end: str = '', *, force: bool = False) → None[source]

Prints the given value in the current line.

Parameters:
  • value – The default value
  • end – Same as the end argument of the built-in print function.
  • force – Forces the printing.
PyFunceble.cli.utils.stdout.print_thanks() → None[source]

Randomly prints our thanks message.

PyFunceble.cli.utils.testing module

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

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

Provides some testing related utilities

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, 2022, 2023 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.
PyFunceble.cli.utils.testing.get_continue_databaset_object(db_session: Optional[sqlalchemy.orm.session.Session] = None) → Union[PyFunceble.dataset.base.DatasetBase, PyFunceble.dataset.csv_base.CSVDatasetBase, PyFunceble.dataset.db_base.DBDatasetBase][source]

Provides the continue object to work with.

Parameters:db_session – A database session to use.
Raises:ValueError – When the given database type is unkown.
PyFunceble.cli.utils.testing.get_destination_from_origin(origin: str) → str[source]

Given the origin, we provides the destination.

PyFunceble.cli.utils.testing.get_inactive_dataset_object(db_session: Optional[sqlalchemy.orm.session.Session] = None) → Union[PyFunceble.dataset.base.DatasetBase, PyFunceble.dataset.csv_base.CSVDatasetBase, PyFunceble.dataset.db_base.DBDatasetBase][source]

Provides the inactive object to work with.

Parameters:db_session – A database session to use.
Raises:ValueError – When the given database type is unkown.
PyFunceble.cli.utils.testing.get_subjects_from_line(line: str, checker_type: str, *, adblock_inputline2subject: Optional[PyFunceble.converter.adblock_input_line2subject.AdblockInputLine2Subject] = None, wildcard2subject: Optional[PyFunceble.converter.wildcard2subject.Wildcard2Subject] = None, rpz_policy2subject: Optional[PyFunceble.converter.rpz_policy2subject.RPZPolicy2Subject] = None, rpz_inputline2subject: Optional[PyFunceble.converter.rpz_input_line2subject.RPZInputLine2Subject] = None, inputline2subject: Optional[PyFunceble.converter.input_line2subject.InputLine2Subject] = None, subject2complements: Optional[PyFunceble.converter.subject2complements.Subject2Complements] = None, url2netloc: Optional[PyFunceble.converter.url2netloc.Url2Netloc] = None, cidr2subject: Optional[PyFunceble.converter.cidr2subject.CIDR2Subject] = None) → List[str][source]

Provides the list of subject to test.

PyFunceble.cli.utils.testing.get_testing_mode() → str[source]

Tries to provides the testing mode to apply to the CLI.

PyFunceble.cli.utils.version module

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

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

Provides the version comparison tool.

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, 2022, 2023 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.
PyFunceble.cli.utils.version.get_local_version() → box.box.Box[source]

Provides the state of the local version file.

PyFunceble.cli.utils.version.get_upstream_version() → box.box.Box[source]

Provides the state of the upstream version.

PyFunceble.cli.utils.version.handle_deprecated_version(upstream_version: box.box.Box) → bool[source]

Checks if the current version (local) is deprecated and provides a message to the end-user.

Returns:True if local is deprecated. False otherwise.
PyFunceble.cli.utils.version.handle_force_update(upstream_version: box.box.Box) → None[source]

Checks if we should force the end-user to update.

PyFunceble.cli.utils.version.handle_greater_version(upstream_version: box.box.Box) → None[source]

Checks if the current version (local) is more recent than the upstream one and provides a message.

Returns:True if local is greater. False otherwise.
PyFunceble.cli.utils.version.handle_messages(upstream_version: box.box.Box) → None[source]

Handles and prints the upstream messages.

PyFunceble.cli.utils.version.handle_older_version(upstream_version: box.box.Box) → bool[source]

Checks if the current version (local) is older than the upstream one and provides a message to the end-user.

Returns:True if local is older. False otherwise.
PyFunceble.cli.utils.version.print_central_messages(check_force_update: bool = False) → None[source]

Collect all possible messages from upstream and downstream and print them.

Module contents

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

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

Provides some utilities related to the CLI.

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, 2022, 2023 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.