PyFunceble.cli.filesystem package

Submodules

PyFunceble.cli.filesystem.cleanup module

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

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

Provides everything related to the cleanup of the filesystem.

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.cleanup.FilesystemCleanup(parent_dirname: Optional[str] = None, *, db_session: Optional[PyFunceble.database.session.DBSession] = None)[source]

Bases: PyFunceble.cli.filesystem.dir_base.FilesystemDirBase

Provides the interface for the cleanup of the filesystem.

clean_database() → PyFunceble.cli.filesystem.cleanup.FilesystemCleanup[source]

Cleanups the uneeded data that were stored in the database.

Warning

This method cleans everything except the WHOIS records.

clean_output_files() → PyFunceble.cli.filesystem.cleanup.FilesystemCleanup[source]

Cleanups the unneeded files from the output directory.

file_helper = <PyFunceble.helpers.file.FileHelper object>
output_files_to_delete

Provides the list of output files to delete.

start() → PyFunceble.cli.filesystem.cleanup.FilesystemCleanup[source]

Starts the cleanup of everything unneeded.

PyFunceble.cli.filesystem.counter module

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

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

Provides everything related to our counter tracker.

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.counter.FilesystemCounter(parent_dirname: Optional[str] = None, *, db_session: Optional[PyFunceble.database.session.DBSession] = None)[source]

Bases: PyFunceble.cli.filesystem.dir_base.FilesystemDirBase

Provides our counter.

PERCENTAGE_STATUSES = {'AVAILABILITY': ['ACTIVE', 'INACTIVE', 'INVALID'], 'REPUTATION': ['SANE', 'MALICIOUS'], 'SYNTAX': ['VALID', 'INVALID']}
STD_DATASET = {'counter': {'ACTIVE': 0, 'INACTIVE': 0, 'INVALID': 0, 'MALICIOUS': 0, 'SANE': 0, 'VALID': 0, 'total': 0}, 'percentage': {'ACTIVE': 0, 'INACTIVE': 0, 'INVALID': 0, 'MALICIOUS': 0, 'SANE': 0, 'VALID': 0, 'total': 0}}
count(status: PyFunceble.checker.status_base.CheckerStatusBase) → PyFunceble.cli.filesystem.counter.FilesystemCounter[source]

Starts the counting process.

Parameters:status – The status to count into our dataset.
dataset = {}
fetch_dataset() → PyFunceble.cli.filesystem.counter.FilesystemCounter[source]

Fetches the source file into the current instance.

fetch_dataset_beforehand()[source]

Updates the dataset to work with before launching the decorated method.

get_dataset_for_printer() → List[Dict[str, Union[str, int]]][source]

Provides the dataset that the printer may understand.

Raises:ValueError – When the current testing mode is not supported (yet?).
save_dataset() → PyFunceble.cli.filesystem.counter.FilesystemCounter[source]

Saves the current dataset into it’s final destination.

save_dataset_afterwards()[source]

Saves the dataset after launching the decorated method.

source_file = None
update_source_file_beforehand()[source]

Updates the source file before launching the decorated method.

PyFunceble.cli.filesystem.dir_base module

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

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

Provides a common base to the manipulation of the output directory.

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.dir_base.FilesystemDirBase(parent_dirname: Optional[str] = None, *, db_session: Optional[PyFunceble.database.session.DBSession] = None)[source]

Bases: object

Provides a common base for the manipulation of our output directory.

db_session = None
get_output_basedir() → str[source]

Provides the output base directory.

Parameters:create_if_missing – Authorizes the creation of the directory if it’s missing.
parent_dirname

Provides the current state of the _parent_dirname attribute.

set_parent_dirname(value: str) → PyFunceble.cli.filesystem.dir_base.FilesystemDirBase[source]

Sets the parent dirname. The parent dirname is a directory which acts a parent into the output directory.

Parm value:The value to set.

PyFunceble.cli.filesystem.status_file module

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

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

Provides everything related to our status file generation.

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.status_file.StatusFileGenerator(status: Union[PyFunceble.checker.syntax.status.SyntaxCheckerStatus, PyFunceble.checker.availability.status.AvailabilityCheckerStatus, PyFunceble.checker.reputation.status.ReputationCheckerStatus, None] = None, *, allow_hosts_files: Optional[bool] = None, allow_plain_files: Optional[bool] = None, allow_analytic_files: Optional[bool] = None, hosts_ip: Optional[str] = None, allow_unified_file: Optional[bool] = None, parent_dirname: Optional[str] = None, test_dataset: Optional[dict] = None)[source]

Bases: PyFunceble.cli.filesystem.dir_base.FilesystemDirBase

Provides an interface for the generation of the status file from a given status.

STD_ALLOW_ANALYTIC_FILES = True
STD_ALLOW_HOSTS_FILES = True
STD_ALLOW_PLAIN_FILES = True
STD_ALLOW_UNIFIED_FILE = False
STD_HOSTS_IP = '0.0.0.0'
allow_analytic_files

Provides the current state of the _allow_analytic_files attribute.

allow_hosts_files

Provides the current state of the _allow_hosts_files attribute.

allow_plain_files

Provides the current state of the _allow_plain_file attribute.

allow_unified_file

Provides the current state of the allow_unified_file attribute.

ensure_status_is_given()[source]

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

Raises:TypeError – When self.status is not set.
file_printer = <PyFunceble.cli.filesystem.printer.file.FilePrinter object>
generate_analytic_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Generates the analytic files.

generate_hosts_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Generates the hosts file.

generate_plain_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Generates the plain file.

generate_splitted_status_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Generates the splitted status file.

generate_unified_status_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Generates the unified status file.

get_output_basedir() → str[source]

Provides the output base directory.

Parameters:create_if_missing – Authorizes the creation of the directory if it’s missing.
guess_all_settings() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Try to guess all settings.

guess_and_set_allow_analytic_files() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Tries to guess the value of the allow_analytic_files from the configuration file.

guess_and_set_allow_hosts_files() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Tries to guess the value of the allow_hosts_files from the configuration file.

guess_and_set_allow_plain_files() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Tries to guess the value of the allow_plain_files from the configuration file.

guess_and_set_allow_unified_file() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Tries to guess the value of the allow_unified_file from the configuration file.

guess_and_set_hosts_ip() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Tries to guess the value of the hosts_ip from the configuration file.

hosts_ip

Provides the current state of the _hosts_ip attribute.

set_allow_analytic_files(value: bool) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the authorization to generation of analytic files.

Parameters:value – The value to set.
set_allow_hosts_files(value: bool) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the authorization to generation of hosts files.

Parameters:value – The value to set.
set_allow_plain_files(value: bool) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the authorization to generation of plain files.

Parameters:value – The value to set.
set_allow_unified_file(value: bool) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the authorization to generation of the unified status file.

Parameters:value – The value to set.
set_hosts_ip(value: str) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the hosts IP to use while generating the hosts files.

Parameters:value – The value to set.
set_status(value: PyFunceble.checker.status_base.CheckerStatusBase) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the status to work with.

Parameters:value – The value to set.
set_test_dataset(value: dict) → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Sets the test dataset which was given to the tester.

Parameters:value – The value to set.
Raises:TypeError – When the given value is not a :py:class`dict`.
start() → PyFunceble.cli.filesystem.status_file.StatusFileGenerator[source]

Starts the generation of everything possible.

status

Provides the current state of the _status attribute.

test_dataset

Provides the current state of the _test_dataset attribute.

Module contents

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

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

Provides everything related to our very own filesystem or output structure.

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.