File Core

Problematic

How can we operate in one place the test of file(s) content?

Documentation

The tool to check the availability or syntax of domains, IPv4 or URL.

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

Provide the logic for a file test from the CLI.

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

License:

MIT License

Copyright (c) 2017, 2018, 2019 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyFunceble.file_core.FileCore(file, file_type='domain')[source]

Brain of PyFunceble for file testing.

Parameters:
  • file (str) – The file we are testing.
  • file_type (str) –

    The file type. Should be one of the following.

    • domain
    • url
_FileCore__process_test(subject)

Given a subject, we perform its test.

Parameters:subject (str) – The subjet we have to test.
classmethod _format_line(line)[source]

Format the extracted line before passing it to the system.

Parameters:line (str) – The extracted line.
Returns:The formatted line with only the element to test.
Return type:str
_get_list_to_of_subjects_to_test_from_file(file_object)[source]

Give a file object, we construct/get the list of subject to test.

_test_line(line, manager_data=None)[source]

Given a line, we test it.

Parameters:
  • line (str) – A line to work with.
  • manager_data (multiprocessing.Manager.list) – A Server process.
domain(subject)[source]

Handle the test of a single domain.

Parameters:subject (str) – The subject we are testing.

Download the file if it is an URL.

get_complements()[source]

Generate a list of complements to test.

classmethod get_simple_coloration(status)[source]

Given a status we give the coloration for the simple mode.

Parameters:status (str) – An official status output.
read_and_test_file_content()[source]

Read a file block by block and test its content.

url(subject)[source]

Handle the simple URL testing.

Parameters:subject (str) – The subject we are testing.