if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>try:<EOL><INDENT>_ = PyFunceble.environ["<STR_LIT>"]<EOL>time_autorisation = False<EOL>try:<EOL><INDENT>time_autorisation = int(PyFunceble.time()) >= int(<EOL>PyFunceble.INTERN["<STR_LIT:start>"]<EOL>) + (int(PyFunceble.CONFIGURATION["<STR_LIT>"]) * <NUM_LIT>)<EOL><DEDENT>except KeyError:<EOL><INDENT>if self.last and not self.bypass:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>if self.last or time_autorisation or self.bypass:<EOL><INDENT>Percentage().log()<EOL>self.travis_permissions()<EOL>command = '<STR_LIT>'<EOL>if self.last or self.bypass:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>for line in Command(<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>).run():<EOL><INDENT>sys_stdout.write("<STR_LIT>".format(line))<EOL><DEDENT>self.travis_permissions()<EOL><DEDENT>message = (<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>+ "<STR_LIT>"<EOL>)<EOL>Command(command % message).execute()<EOL><DEDENT>else:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>for line in Command(<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>).run():<EOL><INDENT>sys_stdout.write("<STR_LIT>".format(line))<EOL><DEDENT>self.travis_permissions()<EOL><DEDENT>Command(<EOL>command % PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>).execute()<EOL><DEDENT>print(<EOL>Command(<EOL>"<STR_LIT>"<EOL>% PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>).execute()<EOL>)<EOL>exit(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>


try:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>except KeyError:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT:*>" * <NUM_LIT:3><EOL><DEDENT>try:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>except KeyError:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>

Handle and check that some configuration index exists.


<EOL>output_dir = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>if self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>output_dir += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]<EOL><DEDENT>elif (<EOL>self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]<EOL>):<EOL><INDENT>output_dir += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>output_dir += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>output_dir += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>return output_dir<EOL>

Return the analytic directory to write depending of the matched
status.


if self._do_not_produce_file():<EOL><INDENT>return False<EOL><DEDENT>if (<EOL>"<STR_LIT>" in PyFunceble.INTERN<EOL>and PyFunceble.INTERN["<STR_LIT>"]<EOL>and (<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>or PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>or PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>)<EOL>):<EOL><INDENT>splited_destination = "<STR_LIT>"<EOL>http_list = []<EOL>http_list.extend(PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"])<EOL>http_list.extend(PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"])<EOL>http_list.extend(PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"])<EOL>http_list.extend(PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"])<EOL>output_hosts = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ "<STR_LIT:%s>"<EOL>+ directory_separator<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>)<EOL>output_domains = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ "<STR_LIT:%s>"<EOL>+ directory_separator<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>)<EOL>output_json = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ "<STR_LIT:%s>"<EOL>+ directory_separator<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>)<EOL>if self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>hosts_destination = output_hosts % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>plain_destination = output_domains % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>json_destination = output_json % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>hosts_destination = (<EOL>output_hosts % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>plain_destination = (<EOL>output_domains % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>json_destination = output_json % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>hosts_destination = output_hosts % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>plain_destination = (<EOL>output_domains % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>json_destination = output_json % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>hosts_destination = (<EOL>output_hosts % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>plain_destination = (<EOL>output_domains % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>json_destination = (<EOL>output_json % PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL><DEDENT>elif self.domain_status.lower() in http_list:<EOL><INDENT>output_dir = self._analytic_host_file_directory()<EOL>if not output_dir.endswith(directory_separator):<EOL><INDENT>output_dir += directory_separator<EOL><DEDENT>hosts_destination = output_dir + PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>plain_destination = (<EOL>output_dir + PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>)<EOL>json_destination = output_dir + PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT:filename>"]<EOL>splited_destination = output_dir + str(PyFunceble.INTERN["<STR_LIT>"])<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Prints(<EOL>[PyFunceble.CONFIGURATION["<STR_LIT>"], self.tested],<EOL>"<STR_LIT>",<EOL>hosts_destination,<EOL>).data()<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Prints([self.tested], "<STR_LIT>", plain_destination).data()<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"] and splited_destination:<EOL><INDENT>Prints([self.tested], "<STR_LIT>", splited_destination).data()<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Prints([self.tested], "<STR_LIT>", json_destination).data()<EOL><DEDENT><DEDENT>

Generate the hosts file, the plain list and the splitted lists.


if (<EOL>"<STR_LIT>" in PyFunceble.INTERN<EOL>and PyFunceble.INTERN["<STR_LIT>"]<EOL>and PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>):<EOL><INDENT>output = (<EOL>self.output_parent_dir + PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>to_print = [<EOL>self.tested,<EOL>self.domain_status,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>]<EOL><DEDENT>else:<EOL><INDENT>to_print = [self.tested, self.domain_status, self.source]<EOL><DEDENT>Prints(to_print, "<STR_LIT>", output, True).data()<EOL><DEDENT>else:<EOL><INDENT>to_print = [<EOL>self.tested,<EOL>self.domain_status,<EOL>self.expiration_date,<EOL>self.source,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL>Prints(to_print, "<STR_LIT>", output, True).data()<EOL><DEDENT><DEDENT>

Generate unified file. Understand by that that we use an unified table
instead of a separate table for each status which could result into a
misunderstanding.


def analytic_file(self, new_status, old_status=None):

if not old_status:<EOL><INDENT>old_status = self.domain_status<EOL><DEDENT>if "<STR_LIT>" in PyFunceble.INTERN and PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>output = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>+ "<STR_LIT>"<EOL>)<EOL>if new_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>output = output % (<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>)<EOL>Generate("<STR_LIT>").info_files()<EOL><DEDENT>elif new_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>output = output % (<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>)<EOL>Generate("<STR_LIT>").info_files()<EOL><DEDENT>elif new_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>output = output % (<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>)<EOL>Generate("<STR_LIT>").info_files()<EOL><DEDENT>else:<EOL><INDENT>output = output % (<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>)<EOL>Generate("<STR_LIT>").info_files()<EOL><DEDENT>Prints(<EOL>[<EOL>self.tested,<EOL>old_status,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>PyFunceble.CURRENT_TIME,<EOL>],<EOL>"<STR_LIT>",<EOL>output,<EOL>True,<EOL>).data()<EOL><DEDENT>

Generate :code:`Analytic/*` files based on the given old and
new statuses.

:param new_status: The new status of the domain.
:type new_status: str

:param old_status: The old status of the domain.
:type old_status: str


if PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>output = (<EOL>self.output_parent_dir<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ self.domain_status<EOL>)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Prints(<EOL>[self.tested, self.domain_status, self.source], "<STR_LIT>", output, True<EOL>).data()<EOL><DEDENT>elif PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.expiration_date,<EOL>self.source,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>else:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.expiration_date,<EOL>self.source,<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>Prints(<EOL>data_to_print, PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"], output, True<EOL>).data()<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>data_to_print = [self.tested, self.source, PyFunceble.CURRENT_TIME]<EOL>Prints(<EOL>data_to_print,<EOL>PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>output,<EOL>True,<EOL>).data()<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>self.domain_status,<EOL>self.source,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>else:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>self.domain_status,<EOL>self.source,<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>Prints(<EOL>data_to_print,<EOL>PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>output,<EOL>True,<EOL>).data()<EOL><DEDENT>elif self.domain_status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.source,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>else:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.source,<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>Prints(<EOL>data_to_print,<EOL>PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>output,<EOL>True,<EOL>).data()<EOL><DEDENT><DEDENT><DEDENT>

Logic behind the printing (in file) when generating status file.


if not PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>to_print = [<EOL>self.tested,<EOL>self.domain_status,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>]<EOL>if not PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>to_print[-<NUM_LIT:1>] = self.source<EOL><DEDENT>Prints(to_print, "<STR_LIT>").data()<EOL><DEDENT>else:<EOL><INDENT>if PyFunceble.HTTP_CODE["<STR_LIT>"]:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.domain_status,<EOL>self.expiration_date,<EOL>self.source,<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL>]<EOL><DEDENT>else:<EOL><INDENT>data_to_print = [<EOL>self.tested,<EOL>self.domain_status,<EOL>self.expiration_date,<EOL>self.source,<EOL>PyFunceble.CURRENT_TIME,<EOL>]<EOL><DEDENT>Prints(data_to_print, "<STR_LIT>").data()<EOL><DEDENT><DEDENT>

Logic behind the printing (on screen) when generating status file.


if "<STR_LIT>" in PyFunceble.INTERN:<EOL><INDENT>Generate(self.domain_status, self.source, self.expiration_date).info_files()<EOL>Percentage(self.domain_status).count()<EOL>self._prints_status_screen()<EOL>if self._do_not_produce_file():<EOL><INDENT>return None<EOL><DEDENT>if (<EOL>not PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>and PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>):<EOL><INDENT>self._prints_status_file()<EOL><DEDENT>else:<EOL><INDENT>self.unified_file()<EOL><DEDENT><DEDENT>

Generate a file according to the domain status.


if (<EOL>Inactive().is_present()<EOL>and self.domain_status<EOL>in [<EOL>PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>]<EOL>and PyFunceble.INTERN["<STR_LIT>"]<EOL>not in PyFunceble.INTERN["<STR_LIT>"]<EOL>):<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Check if we are allowed to produce a file based from the given
information.

:return:
    The state of the production.
    True: We do not produce file.
    False: We do produce file.
:rtype: bool


return [x for x in list_from_file if not self._is_to_ignore(x)]<EOL>

Removed the ignored element from the given list.

:param list_from_file:
    The list which represent the file we are decoding.
:type list_from_list: list

:return: The filtered list.
:rtype: list


<EOL>to_ignore = [r"<STR_LIT>"]  <EOL>for element in to_ignore:<EOL><INDENT>if Regex(line, element, return_data=False).match():<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Check if we have to ignore the given line.

:param line: The line from the file.
:type line: str


<EOL>result = []<EOL>regex_domain_option = r"<STR_LIT>"<EOL>for option in options:<EOL><INDENT>try:<EOL><INDENT>domains = Regex(<EOL>option, regex_domain_option, return_data=True, rematch=True, group=<NUM_LIT:0><EOL>).match()[-<NUM_LIT:1>]<EOL>if domains:<EOL><INDENT>if self.aggressive:  <EOL><INDENT>result.extend(<EOL>[<EOL>x<EOL>for x in domains.split("<STR_LIT:|>")<EOL>if x and not x.startswith("<STR_LIT>")<EOL>]<EOL>)<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT><DEDENT><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return result<EOL>

Handle the data from the options.

:param options: The list of options from the rule.
:type options: list

:return: The list of domains to return globally.
:rtype: list


if isinstance(element, list):<EOL><INDENT>return [self._extract_base(x) for x in element]<EOL><DEDENT>base = self.checker.is_url_valid(url=element, return_base=True)<EOL>if base:<EOL><INDENT>return base<EOL><DEDENT>if "<STR_LIT:/>" in element:<EOL><INDENT>return element.split("<STR_LIT:/>")[<NUM_LIT:0>]<EOL><DEDENT>return element<EOL>

Extract the base of the given element.

.. example:
    given "hello/world?world=beautiful" return "hello"

:param element: The element we are working with.
:type element: str|list


<EOL>result = []<EOL>regex = r"<STR_LIT>"<EOL>regex_v3 = (<EOL>r"<STR_LIT>"<EOL>)<EOL>regex_v4 = r"<STR_LIT>"<EOL>for line in self.to_format:<EOL><INDENT>rematch = rematch_v3 = rematch_v4 = None<EOL>rematch = Regex(<EOL>line, regex, return_data=True, rematch=True, group=<NUM_LIT:0><EOL>).match()<EOL>rematch_v4 = Regex(<EOL>line, regex_v4, return_data=True, rematch=True, group=<NUM_LIT:0><EOL>).match()<EOL>rematch_v3 = Regex(<EOL>line, regex_v3, return_data=True, rematch=True, group=<NUM_LIT:0><EOL>).match()<EOL>if rematch:<EOL><INDENT>if self.options_separator in line:<EOL><INDENT>options = line.split(self.options_separator)[-<NUM_LIT:1>].split(<EOL>self.option_separator<EOL>)<EOL>if (<EOL>not options[-<NUM_LIT:1>]<EOL>or "<STR_LIT>" in options<EOL>or "<STR_LIT>" in options<EOL>or "<STR_LIT>" in options<EOL>or "<STR_LIT>" in options<EOL>):<EOL><INDENT>result.extend(self._extract_base(rematch))<EOL><DEDENT>extra = self._handle_options(options)<EOL>if extra and isinstance(extra, list):  <EOL><INDENT>extra.extend(self._extract_base(rematch))<EOL>result.extend(self._extract_base(extra))<EOL><DEDENT>elif extra:<EOL><INDENT>result.extend(self._extract_base(rematch))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result.extend(self._extract_base(rematch))<EOL><DEDENT><DEDENT>if rematch_v4:<EOL><INDENT>result.extend(List(self._format_decoded(rematch_v4)).format())<EOL><DEDENT>if rematch_v3:<EOL><INDENT>result.extend(List(self._format_decoded(rematch_v3)).format())<EOL><DEDENT><DEDENT>return List(result).format()<EOL>

Decode/extract the domains to test from the adblock formated file.

:return: The list of domains to test.
:rtype: list


def _format_decoded(self, to_format, result=None):

if not result:<EOL><INDENT>result = []<EOL><DEDENT>for data in List(to_format).format():<EOL><INDENT>if data:<EOL><INDENT>if "<STR_LIT>" in data:<EOL><INDENT>return self._format_decoded(data.split("<STR_LIT>"), result)<EOL><DEDENT>if "<STR_LIT:#>" in data:<EOL><INDENT>return self._format_decoded(data.split("<STR_LIT:#>"), result)<EOL><DEDENT>if "<STR_LIT:U+002C>" in data:<EOL><INDENT>return self._format_decoded(data.split("<STR_LIT:U+002C>"), result)<EOL><DEDENT>if "<STR_LIT:!>" in data:<EOL><INDENT>return self._format_decoded(data.split("<STR_LIT:!>"), result)<EOL><DEDENT>if "<STR_LIT:|>" in data:<EOL><INDENT>return self._format_decoded(data.split("<STR_LIT:|>"), result)<EOL><DEDENT>if data:<EOL><INDENT>data = self._extract_base(data)<EOL>if data and (<EOL>self.checker.is_domain_valid(data)<EOL>or self.checker.is_ip_valid(data)<EOL>):<EOL><INDENT>result.append(data)<EOL><DEDENT>elif data:<EOL><INDENT>url_base = self.checker.is_url_valid(data, return_base=True)<EOL>if url_base:<EOL><INDENT>result.append(url_base)<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>return result<EOL>

Format the exctracted adblock line before passing it to the system.

:param to_format: The extracted line from the file.
:type to_format: str

:param result: A list of the result of this method.
:type result: list

:return: The list of domains or IP to test.
:rtype: list


@classmethod<EOL><INDENT>def _authorization(cls):  <DEDENT>

if (<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>or PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>):<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Check the execution authorization.

:return: The authorization status.
:rtype: bool


if (<EOL>self._authorization()<EOL>and PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>and "<STR_LIT>" in PyFunceble.INTERN<EOL>and PyFunceble.INTERN["<STR_LIT>"]<EOL>):<EOL><INDENT>self.file = (<EOL>PyFunceble.OUTPUT_DIRECTORY<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>)<EOL>if PyFunceble.path.isfile(self.file):<EOL><INDENT>content = Dict().from_json(File(self.file).read())<EOL><DEDENT>else:<EOL><INDENT>content = {}<EOL><DEDENT>if self.action == "<STR_LIT:start>":<EOL><INDENT>if "<STR_LIT>" in content and content["<STR_LIT>"]:<EOL><INDENT>del content["<STR_LIT>"]<EOL><DEDENT>if "<STR_LIT:data>" in content:<EOL><INDENT>content["<STR_LIT:data>"].append([PyFunceble.INTERN["<STR_LIT:start>"]])<EOL><DEDENT>else:<EOL><INDENT>content["<STR_LIT:data>"] = [[PyFunceble.INTERN["<STR_LIT:start>"]]]<EOL><DEDENT><DEDENT>elif self.action == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>content["<STR_LIT:data>"][-<NUM_LIT:1>].append(PyFunceble.INTERN["<STR_LIT:end>"])<EOL>start = content["<STR_LIT:data>"][<NUM_LIT:0>][<NUM_LIT:0>]<EOL>end = content["<STR_LIT:data>"][-<NUM_LIT:1>][-<NUM_LIT:1>]<EOL>content["<STR_LIT>"] = self.format_execution_time(start, end)<EOL>if last:<EOL><INDENT>content["<STR_LIT>"] = content["<STR_LIT>"]<EOL>print(<EOL>PyFunceble.Fore.MAGENTA<EOL>+ PyFunceble.Style.BRIGHT<EOL>+ "<STR_LIT>"<EOL>+ content["<STR_LIT>"]<EOL>)<EOL><DEDENT><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>try:<EOL><INDENT>Dict(content).to_json(self.file)<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>DirectoryStructure()<EOL>Dict(content).to_json(self.file)<EOL><DEDENT><DEDENT>

Save the current time to the file.

:param last:
    Tell us if we are at the very end of the file testing.
:type last: bool


@classmethod<EOL><INDENT>def _starting_time(cls):  <DEDENT>

<EOL>PyFunceble.INTERN["<STR_LIT:start>"] = int(PyFunceble.time())<EOL>


@classmethod<EOL><INDENT>def _stoping_time(cls):  <DEDENT>

<EOL>PyFunceble.INTERN["<STR_LIT:end>"] = int(PyFunceble.time())<EOL>


@classmethod<EOL><INDENT>def _calculate(cls, start=None, end=None):<DEDENT>

if start and end:<EOL><INDENT>time_difference = int(end) - int(start)<EOL><DEDENT>else:<EOL><INDENT>time_difference = PyFunceble.INTERN["<STR_LIT:end>"] - PyFunceble.INTERN["<STR_LIT:start>"]<EOL><DEDENT>data = PyFunceble.OrderedDict()<EOL>data["<STR_LIT>"] = str(time_difference // (<NUM_LIT> * <NUM_LIT> * <NUM_LIT>)).zfill(<NUM_LIT:2>)<EOL>data["<STR_LIT>"] = str((time_difference // (<NUM_LIT> * <NUM_LIT>)) % <NUM_LIT>).zfill(<NUM_LIT:2>)<EOL>data["<STR_LIT>"] = str((time_difference % <NUM_LIT>) // <NUM_LIT>).zfill(<NUM_LIT:2>)<EOL>data["<STR_LIT>"] = str(time_difference % <NUM_LIT>).zfill(<NUM_LIT:2>)<EOL>return data<EOL>

calculate the difference between starting and ending time.

:param start: A starting time.
:type start: int|str

:param stop: A ending time.
:type stop: int|str

:return:
    A dict with following as index.

        * :code:`days`
        * :code:`hours`
        * :code:`minutes`
        * :code:`seconds`

    as index.
:rtype: dict


def format_execution_time(self, start=None, end=None):

<EOL>return "<STR_LIT::>".join(list(self._calculate(start, end).values()))<EOL>

Format the calculated time into a human readable format.

:param start: A starting time.
:type start: int|str

:param stop: A ending time.
:type stop: int|str

:return: A human readable date.
:rtype: str


<EOL>output_path = self.base + PyFunceble.OUTPUTS["<STR_LIT>"]<EOL>result = {PyFunceble.OUTPUTS["<STR_LIT>"]: {}}<EOL>for root, _, files in PyFunceble.walk(output_path):<EOL><INDENT>directories = Directory(root.split(output_path)[<NUM_LIT:1>]).fix_path()<EOL>local_result = result[PyFunceble.OUTPUTS["<STR_LIT>"]]<EOL>for file in files:<EOL><INDENT>file_path = root + PyFunceble.directory_separator + file<EOL>file_hash = Hash(file_path, "<STR_LIT>", True).get()<EOL>lines_in_list = [line.rstrip("<STR_LIT:\n>") for line in open(file_path)]<EOL>formatted_content = "<STR_LIT>".join(lines_in_list)<EOL>local_result = local_result.setdefault(<EOL>directories,<EOL>{file: {"<STR_LIT>": file_hash, "<STR_LIT:content>": formatted_content}},<EOL>)<EOL><DEDENT><DEDENT>Dict(result).to_json(self.base + "<STR_LIT>")<EOL>

Backup the developer state of `output/` in order to make it restorable
    and portable for user.


if PyFunceble.path.isdir(self.base + "<STR_LIT>"):<EOL><INDENT>if "<STR_LIT>" not in Command("<STR_LIT>").execute():<EOL><INDENT>return True<EOL><DEDENT>return False<EOL><DEDENT>return True<EOL>

Check if we need to replace ".gitignore" to ".keep".

:return: The replacement status.
:rtype: bool


<EOL>to_replace_base_map = {"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]}<EOL>to_replace_map = {<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>+ PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"],<EOL>"<STR_LIT>": PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"],<EOL>}<EOL>to_replace = {}<EOL>for mapped, declared in to_replace_map.items():<EOL><INDENT>declared = Directory(declared).fix_path()<EOL>to_replace.update({mapped: declared})<EOL><DEDENT>to_replace_base = {}<EOL>for mapped, declared in to_replace_base_map.items():<EOL><INDENT>declared = Directory(declared).fix_path()<EOL>to_replace_base.update({mapped: declared})<EOL><DEDENT>structure = Dict(structure).rename_key(to_replace_base)<EOL>structure[PyFunceble.OUTPUTS["<STR_LIT>"]] = Dict(<EOL>structure[PyFunceble.OUTPUTS["<STR_LIT>"]]<EOL>).rename_key(to_replace)<EOL>try:<EOL><INDENT>Dict(structure).to_json(self.structure)<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>PyFunceble.mkdir(<EOL>PyFunceble.directory_separator.join(<EOL>self.structure.split(PyFunceble.directory_separator)[:-<NUM_LIT:1>]<EOL>)<EOL>)<EOL>Dict(structure).to_json(self.structure)<EOL><DEDENT>return structure<EOL>

Update the paths according to configs.

:param structure: The read structure.
:type structure: dict


<EOL>structure_file = "<STR_LIT>"<EOL>req = "<STR_LIT>"<EOL>if PyFunceble.path.isfile(self.structure):<EOL><INDENT>structure_file = self.structure<EOL><DEDENT>elif PyFunceble.path.isfile(self.base + "<STR_LIT>"):<EOL><INDENT>structure_file = self.base + "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>if "<STR_LIT>" not in PyFunceble.VERSION:<EOL><INDENT>req = PyFunceble.requests.get(<EOL>PyFunceble.LINKS["<STR_LIT>"].replace("<STR_LIT>", "<STR_LIT>")<EOL>)<EOL><DEDENT>else:<EOL><INDENT>req = PyFunceble.requests.get(<EOL>PyFunceble.LINKS["<STR_LIT>"].replace("<STR_LIT>", "<STR_LIT>")<EOL>)<EOL><DEDENT><DEDENT>if structure_file.endswith("<STR_LIT>"):<EOL><INDENT>return self._update_structure_from_config(<EOL>Dict().from_json(File(structure_file).read())<EOL>)<EOL><DEDENT>if structure_file.endswith("<STR_LIT>"):<EOL><INDENT>return self._update_structure_from_config(<EOL>Dict().from_json(File(structure_file).read())<EOL>)<EOL><DEDENT>return self._update_structure_from_config(Dict().from_json(req.text))<EOL>

Get the structure we are going to work with.

:return: The structure we have to work with.
:rtype: dict


@classmethod<EOL><INDENT>def _create_directory(cls, directory, loop=False):<DEDENT>

if not loop and PyFunceble.directory_separator in directory:<EOL><INDENT>splited_directory = directory.split(PyFunceble.directory_separator)<EOL>full_path_to_create = "<STR_LIT>"<EOL>for single_directory in splited_directory:<EOL><INDENT>full_path_to_create += single_directory + PyFunceble.directory_separator<EOL>cls._create_directory(full_path_to_create, True)<EOL><DEDENT><DEDENT>if not PyFunceble.path.isdir(directory):<EOL><INDENT>AutoSave.travis_permissions()<EOL>PyFunceble.mkdir(directory)<EOL>AutoSave.travis_permissions()<EOL><DEDENT>

Creates the given directory if it does not exists.

:param directory: The directory to create.
:type directory: str

:param loop: Tell us if we are in the creation loop or not.
:type loop: bool


<EOL>structure = self._get_structure()<EOL>list_of_key = list(structure.keys())<EOL>structure = structure[list_of_key[<NUM_LIT:0>]]<EOL>parent_path = list_of_key[<NUM_LIT:0>]<EOL>if not parent_path.endswith(PyFunceble.directory_separator):<EOL><INDENT>parent_path += PyFunceble.directory_separator<EOL><DEDENT>replacement_status = self._restore_replace()<EOL>for directory in structure:<EOL><INDENT>base = self.base + parent_path + directory<EOL>if not base.endswith(PyFunceble.directory_separator):<EOL><INDENT>base += PyFunceble.directory_separator<EOL><DEDENT>self._create_directory(base)<EOL>for file in structure[directory]:<EOL><INDENT>file_path = base + file<EOL>content_to_write = structure[directory][file]["<STR_LIT:content>"]<EOL>online_sha = structure[directory][file]["<STR_LIT>"]<EOL>content_to_write = Regex(<EOL>content_to_write, "<STR_LIT>", escape=True, replace_with="<STR_LIT>"<EOL>).replace()<EOL>git_to_keep = file_path.replace("<STR_LIT>", "<STR_LIT>")<EOL>keep_to_git = file_path.replace("<STR_LIT>", "<STR_LIT>")<EOL>if replacement_status:<EOL><INDENT>if (<EOL>PyFunceble.path.isfile(file_path)<EOL>and Hash(file_path, "<STR_LIT>", True).get() == online_sha<EOL>):<EOL><INDENT>PyFunceble.rename(file_path, git_to_keep)<EOL>write = False<EOL><DEDENT>else:<EOL><INDENT>File(file_path).delete()<EOL>file_path = git_to_keep<EOL>write = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if (<EOL>PyFunceble.path.isfile(keep_to_git)<EOL>and Hash(file_path, "<STR_LIT>", True).get() == online_sha<EOL>):<EOL><INDENT>PyFunceble.rename(file_path, keep_to_git)<EOL>write = False<EOL><DEDENT>else:<EOL><INDENT>File(keep_to_git).delete()<EOL>file_path = keep_to_git<EOL>write = True<EOL><DEDENT><DEDENT>if write:<EOL><INDENT>File(file_path).write(content_to_write + "<STR_LIT:\n>", True)<EOL><DEDENT><DEDENT><DEDENT>self.delete_uneeded()<EOL>

Restore the 'output/' directory structure based on the `dir_structure.json` file.


<EOL>structure = self._get_structure()<EOL>list_of_key = list(structure.keys())<EOL>structure = structure[list_of_key[<NUM_LIT:0>]]<EOL>parent_path = list_of_key[<NUM_LIT:0>]<EOL>if not parent_path.endswith(PyFunceble.directory_separator):<EOL><INDENT>parent_path += PyFunceble.directory_separator<EOL><DEDENT>for root, _, _ in PyFunceble.walk(parent_path):<EOL><INDENT>root = Directory(root).fix_path()<EOL>if root.replace(parent_path, "<STR_LIT>") not in structure:<EOL><INDENT>PyFunceble.rmtree(root)<EOL><DEDENT><DEDENT>

Delete the directory which are not registered into our structure.


try:<EOL><INDENT>if "<STR_LIT>" in PyFunceble.INTERN:  <EOL><INDENT>if not Check().is_ip_valid():<EOL><INDENT>request = PyFunceble.socket.getaddrinfo(<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL><NUM_LIT>,<EOL><NUM_LIT:0>,<EOL><NUM_LIT:0>,<EOL>PyFunceble.socket.IPPROTO_TCP,<EOL>)<EOL>for sequence in request:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"].append(<EOL>sequence[-<NUM_LIT:1>][<NUM_LIT:0>]<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>request = PyFunceble.socket.gethostbyaddr(<EOL>PyFunceble.INTERN["<STR_LIT>"]<EOL>)<EOL>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>] = request[<NUM_LIT:0>]<EOL>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"][<EOL>"<STR_LIT>"<EOL>] = request[<NUM_LIT:1>]<EOL>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] = request[<EOL><NUM_LIT:2><EOL>]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if not Check().is_ip_valid():<EOL><INDENT>PyFunceble.socket.getaddrinfo(<EOL>PyFunceble.INTERN["<STR_LIT>"],<EOL><NUM_LIT>,<EOL><NUM_LIT:0>,<EOL><NUM_LIT:0>,<EOL>PyFunceble.socket.IPPROTO_TCP,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>PyFunceble.socket.gethostbyaddr(PyFunceble.INTERN["<STR_LIT>"])<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>except (OSError, PyFunceble.socket.herror, PyFunceble.socket.gaierror):<EOL><INDENT>return False<EOL><DEDENT>


@classmethod<EOL><INDENT>def whois(cls, whois_server, domain=None, timeout=None):  <DEDENT>

if domain is None:<EOL><INDENT>domain = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>if timeout is None:<EOL><INDENT>timeout = PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL><DEDENT>if whois_server:<EOL><INDENT>req = PyFunceble.socket.socket(<EOL>PyFunceble.socket.AF_INET, PyFunceble.socket.SOCK_STREAM<EOL>)<EOL>if timeout % <NUM_LIT:3> == <NUM_LIT:0>:<EOL><INDENT>req.settimeout(timeout)<EOL><DEDENT>else:<EOL><INDENT>req.settimeout(<NUM_LIT:3>)<EOL><DEDENT>try:<EOL><INDENT>req.connect((whois_server, <NUM_LIT>))<EOL><DEDENT>except PyFunceble.socket.error:<EOL><INDENT>return None<EOL><DEDENT>req.send((domain + "<STR_LIT:\r\n>").encode())<EOL>response = b"<STR_LIT>"<EOL>while True:<EOL><INDENT>try:<EOL><INDENT>data = req.recv(<NUM_LIT>)<EOL><DEDENT>except (PyFunceble.socket.timeout, ConnectionResetError):<EOL><INDENT>req.close()<EOL>return None<EOL><DEDENT>response += data<EOL>if not data:<EOL><INDENT>break<EOL><DEDENT><DEDENT>req.close()<EOL>try:<EOL><INDENT>return response.decode()<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>return response.decode("<STR_LIT:utf-8>", "<STR_LIT:replace>")<EOL><DEDENT><DEDENT>return None<EOL>

Implementation of UNIX whois.

:param whois_server: The WHOIS server to use to get the record.
:type whois_server: str

:param domain: The domain to get the whois record from.
:type domain: str

:param timeout: The timeout to apply to the request.
:type timeout: int

:return: The whois record from the given whois server, if exist.
:rtype: str|None


if PyFunceble.INTERN["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>if Check().is_domain_valid() or Check().is_ip_valid():<EOL><INDENT>return SyntaxStatus(PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]).handle()<EOL><DEDENT><DEDENT>elif PyFunceble.INTERN["<STR_LIT>"] == "<STR_LIT:url>":<EOL><INDENT>if Check().is_url_valid():<EOL><INDENT>return SyntaxStatus(PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]).handle()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>return SyntaxStatus(PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]).handle()<EOL>

Execute the logic behind the Syntax handling.

:return: The syntax status.
:rtype: str


def is_url_valid(self, url=None, return_base=False, return_formatted=False):

<EOL>initial_base = None<EOL>if url:<EOL><INDENT>to_test = url<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>if to_test.startswith("<STR_LIT:http>"):<EOL><INDENT>try:<EOL><INDENT>regex = r"<STR_LIT>"<EOL>initial_base = base = Regex(<EOL>to_test, regex, return_data=True, rematch=True<EOL>).match()[<NUM_LIT:2>]<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>base = domain2idna(base)<EOL><DEDENT>domain_status = self.is_domain_valid(base)<EOL>ip_status = self.is_ip_valid(base)<EOL>if domain_status or ip_status:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"] and return_formatted:<EOL><INDENT>return Regex(<EOL>to_test,<EOL>initial_base,<EOL>escape=True,<EOL>return_data=True,<EOL>replace_with=base,<EOL>occurences=<NUM_LIT:1>,<EOL>).replace()<EOL><DEDENT>if return_formatted:<EOL><INDENT>return to_test<EOL><DEDENT>if return_base:<EOL><INDENT>return base<EOL><DEDENT>return True<EOL><DEDENT><DEDENT>except TypeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if return_formatted:<EOL><INDENT>return to_test<EOL><DEDENT>return False<EOL>

Check if the given URL is valid.

:param url: The url to validate.
:type url: str

:param return_base:
    Allow us the return of the url base (if URL formatted correctly).
:type return_formatted: bool

:param return_formatted:
    Allow us to get the URL converted to IDNA if the conversion
    is activated.
:type return_formatted: bool

:return: The validity of the URL or its base.
:rtype: bool|str


def is_domain_valid(<EOL>self, domain=None, subdomain_check=False<EOL>):

<EOL>regex_valid_domains = r"<STR_LIT>"  <EOL>regex_valid_subdomains = r"<STR_LIT>"  <EOL>if domain:<EOL><INDENT>to_test = domain<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>try:<EOL><INDENT>last_point_index = to_test.rindex("<STR_LIT:.>")<EOL>extension = to_test[last_point_index + <NUM_LIT:1> :]<EOL>if not extension and to_test.endswith("<STR_LIT:.>"):<EOL><INDENT>try:<EOL><INDENT>extension = [x for x in to_test.split("<STR_LIT:.>") if x][-<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if not extension or extension not in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>return False<EOL><DEDENT>if (<EOL>Regex(to_test, regex_valid_domains, return_data=False).match()<EOL>and not subdomain_check<EOL>):<EOL><INDENT>return True<EOL><DEDENT>if extension in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>for suffix in PyFunceble.INTERN["<STR_LIT>"][extension]:<EOL><INDENT>try:<EOL><INDENT>suffix_index = to_test.rindex("<STR_LIT:.>" + suffix)<EOL>to_check = to_test[:suffix_index]<EOL>if "<STR_LIT:.>" not in to_check and subdomain_check:<EOL><INDENT>return False<EOL><DEDENT>if "<STR_LIT:.>" in to_check and subdomain_check:<EOL><INDENT>return True<EOL><DEDENT>if "<STR_LIT:.>" in to_check:<EOL><INDENT>return Regex(<EOL>to_check, regex_valid_subdomains, return_data=False<EOL>).match()<EOL><DEDENT><DEDENT>except ValueError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT><DEDENT>to_check = to_test[:last_point_index]<EOL>if "<STR_LIT:.>" in to_check and subdomain_check:<EOL><INDENT>return True<EOL><DEDENT>if "<STR_LIT:.>" in to_check:<EOL><INDENT>return Regex(<EOL>to_check, regex_valid_subdomains, return_data=False<EOL>).match()<EOL><DEDENT><DEDENT>except (ValueError, AttributeError):<EOL><INDENT>pass<EOL><DEDENT>return False<EOL>

Check if the given domain is a valid.

:param domain: The domain to validate.
:type domain: str

:param subdomain_check:
    Activate the subdomain checking.
:type subdomain_check: bool

:return: The validity of the sub-domain.
:rtype: bool


if domain:<EOL><INDENT>to_test = domain<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>return self.is_domain_valid(to_test, subdomain_check=True)<EOL>

Check if the given subdomain is a subdomain.

:param domain: The domain to validate.
:type domain: str

:return: The validity of the subdomain.
:rtype: bool


<EOL>regex_ipv4 = r"<STR_LIT>"  <EOL>if ip_to_check:<EOL><INDENT>to_test = ip_to_check<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>return Regex(to_test, regex_ipv4, return_data=False).match()<EOL>

Check if the given IP is a valid IPv4.

:param ip_to_check: The IP to test.
:type ip_to_check: str

:return: The validity of the IP.
:rtype: bool

.. note::
    We only test IPv4 because for now we only them for now.


if ip_to_check:<EOL><INDENT>to_test = ip_to_check<EOL><DEDENT>elif self.element:<EOL><INDENT>to_test = self.element<EOL><DEDENT>else:<EOL><INDENT>to_test = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>if self.is_ip_valid(to_test):<EOL><INDENT>regex_ipv4_range = r"<STR_LIT>"  <EOL>return Regex(to_test, regex_ipv4_range, return_data=False).match()<EOL><DEDENT>return False<EOL>


if domain and isinstance(domain, str):<EOL><INDENT>load_config(True)<EOL>return Check(domain).is_domain_valid()<EOL><DEDENT>return None<EOL>

Check the syntax of the given domain.

:param domain: The domain to check the syntax for.
:type domain: str

:return: The syntax validity.
:rtype: bool

.. warning::
    If an empty or a non-string :code:`domain` is given, we return :code:`None`.


if domain and isinstance(domain, str):<EOL><INDENT>load_config(True)<EOL>return Check(domain).is_subdomain()<EOL><DEDENT>return None<EOL>

Check if the given domain is a subdomain.

:param domain: The domain we are checking.
:type domain: str

:return: The subdomain state.
:rtype: bool

.. warning::
    If an empty or a non-string :code:`domain` is given, we return :code:`None`.


if ip and isinstance(ip, str):<EOL><INDENT>load_config(True)<EOL>return Check(ip).is_ip_valid()<EOL><DEDENT>return None<EOL>

Check the syntax of the given IPv4.

:param ip: The IPv4 to check the syntax for.
:type ip: str

:return: The syntax validity.
:rtype: bool

.. warning::
    If an empty or a non-string :code:`ip` is given, we return :code:`None`.


if ip and isinstance(ip, str):<EOL><INDENT>load_config(True)<EOL>return Check(ip).is_ip_range()<EOL><DEDENT>return None<EOL>

Check if the given IP is an IP range.

:param ip: The IP we are checking.
:type ip: str

:return: The IPv4 range state.
:rtype: bool

.. warning::
    If an empty or a non-string :code:`ip` is given, we return :code:`None`.


if url and isinstance(url, str):<EOL><INDENT>load_config(True)<EOL>return Check(url).is_url_valid()<EOL><DEDENT>return None<EOL>

Check the syntax of the given URL.

:param url: The URL to check the syntax for.
:type url: str

:return: The syntax validity.
:rtype: bool

.. warning::
    If an empty or a non-string :code:`url` is given, we return :code:`None`.


random = int(choice(str(int(time()))))<EOL>if not CONFIGURATION["<STR_LIT>"] and random % <NUM_LIT:3> == <NUM_LIT:0>:<EOL><INDENT>print("<STR_LIT:\n>" + Fore.GREEN + Style.BRIGHT + "<STR_LIT>")<EOL>print(<EOL>Fore.YELLOW<EOL>+ Style.BRIGHT<EOL>+ "<STR_LIT>"<EOL>+ Fore.CYAN<EOL>+ "<STR_LIT>"<EOL>+ Fore.YELLOW<EOL>+ "<STR_LIT>"<EOL>+ Fore.CYAN<EOL>+ "<STR_LIT>"<EOL>+ Fore.YELLOW<EOL>+ "<STR_LIT:!>"<EOL>)<EOL>print(<EOL>Fore.GREEN<EOL>+ Style.BRIGHT<EOL>+ "<STR_LIT>"<EOL>)<EOL>print(<EOL>Fore.YELLOW<EOL>+ Style.BRIGHT<EOL>+ "<STR_LIT>"<EOL>+ Fore.CYAN<EOL>+ "<STR_LIT>"<EOL>+ Fore.YELLOW<EOL>+ "<STR_LIT:!>"<EOL>)<EOL><DEDENT>


if __name__ == "<STR_LIT>":<EOL><INDENT>initiate(autoreset=True)<EOL>load_config(True)<EOL>try:<EOL><INDENT>try:<EOL><INDENT>PARSER = argparse.ArgumentParser(<EOL>epilog="<STR_LIT>"<EOL>% (<EOL>Fore.RED + "<STR_LIT>" + Fore.RESET,<EOL>Style.BRIGHT<EOL>+ Fore.CYAN<EOL>+ "<STR_LIT>"<EOL>+ Style.RESET_ALL<EOL>+ "<STR_LIT>"<EOL>+ Style.BRIGHT<EOL>+ Fore.GREEN<EOL>+ "<STR_LIT>"<EOL>+ Style.RESET_ALL<EOL>+ "<STR_LIT>"<EOL>+ Style.BRIGHT<EOL>+ Fore.GREEN<EOL>+ "<STR_LIT>",<EOL>),<EOL>add_help=False,<EOL>)<EOL>CURRENT_VALUE_FORMAT = (<EOL>Fore.YELLOW + Style.BRIGHT + "<STR_LIT>" + Fore.BLUE<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>" "<STR_LIT:-c>",<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=int,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>", action="<STR_LIT:store_true>", help="<STR_LIT>"<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>", "<STR_LIT>", type=str, help="<STR_LIT>"<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>type=int,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>",  <EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>", type=str, help="<STR_LIT>"<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT>",<EOL>default=argparse.SUPPRESS,<EOL>help="<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(HTTP_CODE["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(Core.switch("<STR_LIT>"))<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(Core.switch("<STR_LIT>"))<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>", type=str, help="<STR_LIT>"<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(not CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>",<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>type=int,<EOL>default=<NUM_LIT:3>,<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>type=str,<EOL>default="<STR_LIT>",<EOL>help="<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>", "<STR_LIT>", type=str, help="<STR_LIT>"<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>",  <EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>type=str,<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>",  <EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>help="<STR_LIT>",<EOL>action="<STR_LIT:version>",<EOL>version="<STR_LIT>" + VERSION,<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>PARSER.add_argument(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>",<EOL>action="<STR_LIT:store_true>",<EOL>help="<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (<EOL>CURRENT_VALUE_FORMAT<EOL>+ repr(CONFIGURATION["<STR_LIT>"])<EOL>+ Style.RESET_ALL<EOL>),<EOL>)<EOL>ARGS = PARSER.parse_args()<EOL>if ARGS.less:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.less})<EOL><DEDENT>elif not ARGS.all:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.all})<EOL><DEDENT>if ARGS.adblock:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.auto_continue:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.autosave_minutes:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": ARGS.autosave_minutes}<EOL>)<EOL><DEDENT>if ARGS.clean:<EOL><INDENT>Clean(None)<EOL><DEDENT>if ARGS.clean_all:<EOL><INDENT>Clean(None, ARGS.clean_all)<EOL><DEDENT>if ARGS.cmd:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.cmd})<EOL><DEDENT>if ARGS.cmd_before_end:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.cmd_before_end})<EOL><DEDENT>if ARGS.commit_autosave_message:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": ARGS.commit_autosave_message}<EOL>)<EOL><DEDENT>if ARGS.commit_results_message:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": ARGS.commit_results_message}<EOL>)<EOL><DEDENT>if ARGS.database:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.days_between_db_retest:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": ARGS.days_between_db_retest}<EOL>)<EOL><DEDENT>if ARGS.debug:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.directory_structure:<EOL><INDENT>DirectoryStructure()<EOL><DEDENT>if ARGS.execution:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.filter:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.filter})<EOL><DEDENT>if ARGS.hierarchical:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.host:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.http:<EOL><INDENT>HTTP_CODE.update({"<STR_LIT>": Core.switch(HTTP_CODE["<STR_LIT>"], True)})<EOL><DEDENT>if ARGS.iana:<EOL><INDENT>IANA().update()<EOL><DEDENT>if ARGS.idna:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.ip:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.ip})<EOL><DEDENT>if ARGS.json:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.local:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.mining:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.no_files:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.no_logs:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.no_special:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.no_unified:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.no_whois:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.percentage:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.plain:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.production:<EOL><INDENT>Production()<EOL><DEDENT>if ARGS.public_suffix:<EOL><INDENT>PublicSuffix().update()<EOL><DEDENT>if ARGS.quiet:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.share_logs:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.simple:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>"), "<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if ARGS.split:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.syntax:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.timeout and ARGS.timeout % <NUM_LIT:3> == <NUM_LIT:0>:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.timeout})<EOL><DEDENT>if ARGS.travis:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": Core.switch("<STR_LIT>")})<EOL><DEDENT>if ARGS.travis_branch:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.travis_branch})<EOL><DEDENT>if ARGS.user_agent:<EOL><INDENT>CONFIGURATION.update({"<STR_LIT>": ARGS.user_agent})<EOL><DEDENT>if ARGS.verify_ssl_certificate:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": ARGS.verify_ssl_certificate}<EOL>)<EOL><DEDENT>if ARGS.whois_database:<EOL><INDENT>CONFIGURATION.update(<EOL>{"<STR_LIT>": Core.switch("<STR_LIT>")}<EOL>)<EOL><DEDENT>if not CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Core.colorify_logo(home=True)<EOL><DEDENT>Version().compare()<EOL>Core(<EOL>domain_or_ip_to_test=ARGS.domain,<EOL>file_path=ARGS.file,<EOL>url_to_test=ARGS.url,<EOL>url_file=ARGS.url_file,<EOL>link_to_test=ARGS.link,<EOL>)<EOL><DEDENT>except KeyError as e:<EOL><INDENT>if not Version(True).is_cloned():<EOL><INDENT>Merge(CURRENT_DIRECTORY)<EOL><DEDENT>else:<EOL><INDENT>raise e<EOL><DEDENT><DEDENT><DEDENT>except KeyboardInterrupt:<EOL><INDENT>stay_safe()<EOL><DEDENT><DEDENT>


<EOL>hash_data = getattr(hashlib, algo)()<EOL>with open(self.path, "<STR_LIT:rb>") as file:<EOL><INDENT>content = file.read()<EOL>hash_data.update(content)<EOL><DEDENT>return hash_data.hexdigest()<EOL>

Get the hash of the given file

        :param algo: The algorithm to use.
        :type algo: str

        :return: The hexdigest of the data.
        :rtype: str


<EOL>hash_data = getattr(hashlib, algo)()<EOL>hash_data.update(self.data)<EOL>return hash_data.hexdigest()<EOL>

Get hash of the given data.

:param algo: The algorithm to use.
:type algo: str


<EOL>result = {}<EOL>if self.algorithm in self.valid_algorithms:<EOL><INDENT>if self.algorithm == "<STR_LIT:all>":<EOL><INDENT>del self.valid_algorithms[<NUM_LIT:0>]<EOL>for algo in self.valid_algorithms:<EOL><INDENT>if self.path and path.isfile(self.path):<EOL><INDENT>result[algo] = self._hash_file(algo)<EOL><DEDENT>elif self.data:<EOL><INDENT>result[algo] = self._hash_data(algo)<EOL><DEDENT>else:  <EOL><INDENT>return None<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if self.path and path.isfile(self.path):<EOL><INDENT>result[self.algorithm] = self._hash_file(self.algorithm)<EOL><DEDENT>elif self.data:<EOL><INDENT>result[self.algorithm] = self._hash_data(self.algorithm)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT><DEDENT>else:  <EOL><INDENT>return None<EOL><DEDENT>if self.algorithm != "<STR_LIT:all>" and self.only_hash:<EOL><INDENT>return result[self.algorithm]<EOL><DEDENT>return result<EOL>


return to_decode.decode(self.decode_type)<EOL>

Decode the output of a shell command in order to be readable.

:param to_decode: Output of a command to decode.
:type: bytes

:return: The decoded output.
:rtype: str


<EOL>process = Popen(self.command, stdout=PIPE, stderr=PIPE, shell=True)<EOL>(output, error) = process.communicate()<EOL>if process.returncode != <NUM_LIT:0>:  <EOL><INDENT>return self._decode_output(error)<EOL><DEDENT>return self._decode_output(output)<EOL>

Execute the given command.

:return: The output of the command.
:rtype: str


with Popen(self.command, stdout=PIPE, shell=True) as process:<EOL><INDENT>while True:<EOL><INDENT>current_line = process.stdout.readline().rstrip()<EOL>if not current_line:<EOL><INDENT>break<EOL><DEDENT>yield self._decode_output(current_line)<EOL><DEDENT><DEDENT>

Run the given command and yield each line(s) one by one.

.. note::
    The difference between this method and :code:`self.execute()`
    is that :code:`self.execute()` wait for the process to end
    in order to return its output.


if isinstance(self.main_dictionnary, dict):<EOL><INDENT>if isinstance(key_to_remove, list):<EOL><INDENT>for key in key_to_remove:<EOL><INDENT>del self.main_dictionnary[key]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>del self.main_dictionnary[key_to_remove]<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return self.main_dictionnary<EOL><DEDENT>return None<EOL>

Remove a given key from a given dictionary.

:param key_to_remove: The key(s) to delete.
:type key_to_remove: list|str

:return: The dict without the given key(s).
:rtype: dict|None


def rename_key(self, key_to_rename, strict=True):

if isinstance(self.main_dictionnary, dict) and isinstance(key_to_rename, dict):<EOL><INDENT>for old, new in key_to_rename.items():<EOL><INDENT>if strict:<EOL><INDENT>if old in self.main_dictionnary:<EOL><INDENT>self.main_dictionnary[new] = self.main_dictionnary.pop(old)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>to_rename = {}<EOL>for index in self.main_dictionnary:<EOL><INDENT>if old in index:<EOL><INDENT>to_rename.update({index: new[:-<NUM_LIT:1>] + index.split(old)[-<NUM_LIT:1>]})<EOL><DEDENT><DEDENT>self.main_dictionnary = Dict(self.main_dictionnary).rename_key(<EOL>to_rename, True<EOL>)<EOL><DEDENT><DEDENT>return self.main_dictionnary<EOL><DEDENT>return None<EOL>

Rename the given keys from the given dictionary.

:param key_to_rename:
    The key(s) to rename.
    Expected format: :code:`{old:new}`
:type key_to_rename: dict

:param strict:
    Tell us if we have to rename the exact index or
    the index which looks like the given key(s)

:return: The well formatted dict.
:rtype: dict|None


<EOL>result = {}<EOL>for element in to_merge:<EOL><INDENT>if element in self.main_dictionnary:<EOL><INDENT>if isinstance(to_merge[element], dict) and isinstance(<EOL>self.main_dictionnary[element], dict<EOL>):<EOL><INDENT>result[element] = Dict(self.main_dictionnary[element]).merge(<EOL>to_merge[element]<EOL>)<EOL><DEDENT>elif isinstance(to_merge[element], list) and isinstance(<EOL>self.main_dictionnary[element], list<EOL>):<EOL><INDENT>result[element] = List(self.main_dictionnary[element]).merge(<EOL>to_merge[element], strict<EOL>)<EOL><DEDENT>else:<EOL><INDENT>result.update({element: to_merge[element]})<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result.update({element: to_merge[element]})<EOL><DEDENT><DEDENT>for element in self.main_dictionnary:<EOL><INDENT>if element not in result:<EOL><INDENT>result[element] = self.main_dictionnary[element]<EOL><DEDENT><DEDENT>return result<EOL>

Merge the content of to_merge into the given main dictionnary.

:param to_merge: The dictionnary to merge.
:type to_merge: dict

:param strict:
    Tell us if we have to strictly merge lists.

    :code:`True`: We follow index
    :code`False`: We follow element (content)
:type strict: bool

:return: The merged dict.
:rtype: dict


try:<EOL><INDENT>with open(destination, "<STR_LIT:w>") as file:<EOL><INDENT>dump(<EOL>self.main_dictionnary,<EOL>file,<EOL>ensure_ascii=False,<EOL>indent=<NUM_LIT:4>,<EOL>sort_keys=True,<EOL>)<EOL><DEDENT><DEDENT>except UnicodeEncodeError:  <EOL><INDENT>with open(destination, "<STR_LIT:w>", encoding="<STR_LIT:utf-8>") as file:<EOL><INDENT>dump(<EOL>self.main_dictionnary,<EOL>file,<EOL>ensure_ascii=False,<EOL>indent=<NUM_LIT:4>,<EOL>sort_keys=True,<EOL>)<EOL><DEDENT><DEDENT>

Save a dictionnary into a JSON file.

:param destination:
    A path to a file where we're going to
    write the converted dict into a JSON format.
:type destination: str


def to_yaml(self, destination, flow_style=False):

with open(destination, "<STR_LIT:w>") as file:<EOL><INDENT>dump_yaml(<EOL>self.main_dictionnary,<EOL>file,<EOL>encoding="<STR_LIT:utf-8>",<EOL>allow_unicode=True,<EOL>indent=<NUM_LIT:4>,<EOL>default_flow_style=flow_style,<EOL>)<EOL><DEDENT>

Save a dictionnary into a YAML file.

:param destination:
    A path to a file where we're going to write the
    converted dict into a JSON format.
:type destination: str


try:<EOL><INDENT>return loads(data)<EOL><DEDENT>except decoder.JSONDecodeError:  <EOL><INDENT>return {}<EOL><DEDENT>

Convert a JSON formatted string into a dictionary.

:param data: A JSON formatted string to convert to dict format.
:type data: str

:return: The dict representation of the JSON formatted string.
:rtype: dict


<EOL>return load_yaml(data)<EOL>

Convert a YAML formatted string into a dictionary.

:param data: A YAML formatted string to convert to dict format.
:type data: str

:return: The dict representation of the YAML formatted string.
:rtype: dict


if not splited_path:<EOL><INDENT>split_path = []<EOL>if self.directory:<EOL><INDENT>if "<STR_LIT:/>" in self.directory:<EOL><INDENT>split_path = self.directory.split("<STR_LIT:/>")<EOL><DEDENT>elif "<STR_LIT:\\>" in self.directory:<EOL><INDENT>split_path = self.directory.split("<STR_LIT:\\>")<EOL><DEDENT>else:<EOL><INDENT>split_path = [self.directory]<EOL><DEDENT>return self.fix_path(splited_path=[x for x in split_path if x])<EOL><DEDENT>return self.directory<EOL><DEDENT>return directory_separator.join(splited_path) + directory_separator<EOL>

Fix the path of the given path.

:param splited_path: A list to convert to the right path.
:type splited_path: list

:return: The fixed path.
:rtype: str


def write(self, data_to_write, overwrite=False):

if overwrite or not path.isfile(self.file):<EOL><INDENT>with open(self.file, "<STR_LIT:w>", encoding="<STR_LIT:utf-8>", newline="<STR_LIT:\n>") as file:<EOL><INDENT>if data_to_write and isinstance(data_to_write, str):<EOL><INDENT>file.write(data_to_write)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>with open(self.file, "<STR_LIT:a>", encoding="<STR_LIT:utf-8>", newline="<STR_LIT:\n>") as file:<EOL><INDENT>if data_to_write and isinstance(data_to_write, str):<EOL><INDENT>file.write(data_to_write)<EOL><DEDENT><DEDENT><DEDENT>

Write or append data into the given file path.

:param data_to_write: The data to write.
:type data_to_write: str

:param overwrite:
    Tell us if we have to overwrite the
    content of the file we are working with.
:type overwrite: bool


try:<EOL><INDENT>with open(self.file, "<STR_LIT:r>", encoding="<STR_LIT:utf-8>") as file:<EOL><INDENT>funilrys = file.read()<EOL><DEDENT><DEDENT>except UnicodeDecodeError:  <EOL><INDENT>with open(self.file, "<STR_LIT:r>") as file:<EOL><INDENT>funilrys = file.read()<EOL><DEDENT><DEDENT>return funilrys<EOL>

Read a given file path and return its content.

:return: The content of the given file path.
:rtype: str


try:<EOL><INDENT>remove(self.file)<EOL><DEDENT>except OSError:<EOL><INDENT>pass<EOL><DEDENT>


shutil_copy(self.file, destination)<EOL>

Copy the given file to the destination.

:param destination: The destination of the copy.
:type destination: str


try:<EOL><INDENT>return sorted(list(set(self.main_list)), key=str.lower)<EOL><DEDENT>except TypeError:  <EOL><INDENT>return self.main_list<EOL><DEDENT>

Return a well formatted list. Basicaly, it's sort a list and remove duplicate.

:return: A sorted, without duplicate, list.
:rtype: list


def custom_format(self, key_method, reverse=False):

try:<EOL><INDENT>return sorted(list(set(self.main_list)), key=key_method, reverse=reverse)<EOL><DEDENT>except TypeError:  <EOL><INDENT>return self.main_list<EOL><DEDENT>

Return a well formatted list. With the key_method as a function/method to format
the elements before sorting.

:param key_method:
    A function or method to use to format the
    readed element before sorting.
:type key_method: function|method

:param reverse: Tell us if we have to reverse the list.
:type reverse: bool

:return: A sorted list.
:rtype: list


<EOL>result = []<EOL>if strict:<EOL><INDENT>for index, element in enumerate(to_merge):<EOL><INDENT>try:<EOL><INDENT>if isinstance(element, dict) and isinstance(<EOL>self.main_list[index], dict<EOL>):<EOL><INDENT>result.append(Dict(self.main_list[index]).merge(element))<EOL><DEDENT>elif isinstance(element, list) and isinstance(<EOL>self.main_list[index], list<EOL>):<EOL><INDENT>result.append(List(self.main_list[index]).merge(element))<EOL><DEDENT>else:<EOL><INDENT>result.append(element)<EOL><DEDENT><DEDENT>except IndexError:  <EOL><INDENT>result.append(element)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>result = self.main_list<EOL>for element in to_merge:<EOL><INDENT>if element not in result:<EOL><INDENT>result.append(element)<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>

Merge to_merge into the given main list.

:param to_merge: The list to merge.
:type to_merge: list

:param strict:
    Tell us if we have to respect index (True)
    or not (False).
:type strict: bool

:return: The merged list.
:rtype: list


pre_result = comp(self.regex)<EOL>return [x for x in self.data if not pre_result.search(str(x))]<EOL>

Return a list of string which don't match the
given regex.


pre_result = comp(self.regex)<EOL>return [x for x in self.data if pre_result.search(str(x))]<EOL>

Return a list of the string which match the given
regex.


<EOL>result = []<EOL>to_match = comp(self.regex)<EOL>if self.rematch:  <EOL><INDENT>pre_result = to_match.findall(self.data)<EOL><DEDENT>else:<EOL><INDENT>pre_result = to_match.search(self.data)<EOL><DEDENT>if self.return_data and pre_result:  <EOL><INDENT>if self.rematch:  <EOL><INDENT>for data in pre_result:<EOL><INDENT>if isinstance(data, tuple):<EOL><INDENT>result.extend(list(data))<EOL><DEDENT>else:<EOL><INDENT>result.append(data)<EOL><DEDENT><DEDENT>if self.group != <NUM_LIT:0>:  <EOL><INDENT>return result[self.group]  <EOL><DEDENT><DEDENT>else:<EOL><INDENT>result = pre_result.group(<EOL>self.group  <EOL>).strip()<EOL><DEDENT>return result<EOL><DEDENT>if not self.return_data and pre_result:  <EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Used to get exploitable result of re.search

:return: The data of the match status.
:rtype: mixed


if self.replace_with:  <EOL><INDENT>return substrings(<EOL>self.regex,<EOL>self.replace_with,  <EOL>self.data,<EOL>self.occurences,  <EOL>)<EOL><DEDENT>return self.data<EOL>

Used to replace a matched string with another.

:return: The data after replacement.
:rtype: str


try:<EOL><INDENT>req = requests.get(self.link, verify=self.verification)<EOL>if req.status_code == <NUM_LIT:200>:<EOL><INDENT>if self.return_data:<EOL><INDENT>return req.text<EOL><DEDENT>File(self.destination).write(req.text, overwrite=True)<EOL>return True<EOL><DEDENT>raise Exception("<STR_LIT>" % repr(self.link))<EOL><DEDENT>except requests.exceptions.ConnectionError:<EOL><INDENT>print(Fore.RED + "<STR_LIT>" + Style.RESET_ALL)<EOL>exit(<NUM_LIT:1>)<EOL><DEDENT>

Download the given link and return or save its :code:`requests.text`
at the given destination.

:rtype: mixed

:raises:
    :code:`Exception`
        If the status code is not :code:`200`.


if PyFunceble.path.isfile(file):<EOL><INDENT>return Dict().from_json(File(file).read())<EOL><DEDENT>return {}<EOL>

Get and return the content of the given log file.

:param file: The file we have to get the content from.
:type file: str

:return The content of the given file.
:rtype: dict


@classmethod<EOL><INDENT>def _write_content(cls, content, file):<DEDENT>

if not PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if not isinstance(content, dict):<EOL><INDENT>content = {}<EOL><DEDENT>Dict(content).to_json(file)<EOL><DEDENT>

Write the content into the given file.

:param content: The dict to write.
:type content: dict

:param file: The file to write.
:type file: str


if PyFunceble.CONFIGURATION["<STR_LIT>"] and PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>referer = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>referer = None<EOL><DEDENT>to_write = {<EOL>self.current_time: {<EOL>"<STR_LIT>": PyFunceble.INTERN["<STR_LIT>"],<EOL>"<STR_LIT>": record,<EOL>"<STR_LIT>": referer,<EOL>}<EOL>}<EOL>if self.output:<EOL><INDENT>output = self.output<EOL><DEDENT>else:<EOL><INDENT>output = PyFunceble.OUTPUT_DIRECTORY<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>current_content = self._get_content(output)<EOL>current_content.update(to_write)<EOL>self._write_content(current_content, output)<EOL><DEDENT>

Logs the WHOIS record if needed.

:param record: The record to log.
:type record: str


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>referer = PyFunceble.INTERN["<STR_LIT>"]<EOL><DEDENT>else:<EOL><INDENT>referer = None<EOL><DEDENT>to_write = {<EOL>self.current_time: {<EOL>"<STR_LIT>": PyFunceble.INTERN["<STR_LIT>"],<EOL>"<STR_LIT>": extracted,<EOL>"<STR_LIT>": referer,<EOL>}<EOL>}<EOL>if self.output:<EOL><INDENT>output = self.output<EOL><DEDENT>else:<EOL><INDENT>output = PyFunceble.OUTPUT_DIRECTORY<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>current_content = self._get_content(output)<EOL>current_content.update(to_write)<EOL>self._write_content(current_content, output)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>PyFunceble.requests.post(<EOL>PyFunceble.LINKS["<STR_LIT>"],<EOL>data=to_write[self.current_time],<EOL>)<EOL><DEDENT><DEDENT>

Logs the extracted expiration date.

:param extracted: The extracted expiration date (from WHOIS record).
:type extracted: str


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>to_write = {<EOL>self.current_time: {<EOL>"<STR_LIT>": PyFunceble.INTERN["<STR_LIT>"],<EOL>"<STR_LIT>": extension,<EOL>}<EOL>}<EOL>if self.output:<EOL><INDENT>output = self.output<EOL><DEDENT>else:<EOL><INDENT>output = PyFunceble.OUTPUT_DIRECTORY<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL>output += PyFunceble.OUTPUTS["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"]<EOL><DEDENT>current_content = self._get_content(output)<EOL>current_content.update(to_write)<EOL>self._write_content(current_content, output)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>PyFunceble.requests.post(<EOL>PyFunceble.LINKS["<STR_LIT>"], data=to_write[self.current_time]<EOL>)<EOL><DEDENT><DEDENT>

Logs the case that the referer was not found.

:param extension: The extension of the domain we are testing.
:type extension: str


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>data_to_backup = {}<EOL>configuration_counter = PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]<EOL>data_to_backup[PyFunceble.INTERN["<STR_LIT>"]] = {<EOL>"<STR_LIT>": configuration_counter["<STR_LIT>"],<EOL>"<STR_LIT>": configuration_counter["<STR_LIT>"],<EOL>"<STR_LIT>": configuration_counter["<STR_LIT>"],<EOL>"<STR_LIT>": configuration_counter["<STR_LIT>"],<EOL>}<EOL>to_save = {}<EOL>to_save.update(self.backup_content)<EOL>to_save.update(data_to_backup)<EOL>Dict(to_save).to_json(self.autocontinue_log_file)<EOL><DEDENT>


if PyFunceble.CONFIGURATION["<STR_LIT>"] and self.backup_content:<EOL><INDENT>file_to_restore = PyFunceble.INTERN["<STR_LIT>"]<EOL>if file_to_restore in self.backup_content:<EOL><INDENT>to_initiate = ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]<EOL>alternatives = {<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>}<EOL>for string in to_initiate:<EOL><INDENT>try:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"].update(<EOL>{string: self.backup_content[file_to_restore][string]}<EOL>)<EOL><DEDENT>except KeyError:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"].update(<EOL>{<EOL>string: self.backup_content[file_to_restore][<EOL>alternatives[string]<EOL>]<EOL>}<EOL>)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>try:<EOL><INDENT>history = PyFunceble.requests.get(<EOL>self.to_get,<EOL>timeout=PyFunceble.CONFIGURATION["<STR_LIT>"],<EOL>headers=self.headers,<EOL>).history<EOL>mined = {self.to_get_bare: []}<EOL>for element in history:<EOL><INDENT>element = element.url<EOL>if PyFunceble.INTERN["<STR_LIT>"] == "<STR_LIT:url>":<EOL><INDENT>to_append = Check().is_url_valid(element, return_base=False)<EOL><DEDENT>elif PyFunceble.INTERN["<STR_LIT>"] == "<STR_LIT>":<EOL><INDENT>to_append = Check().is_url_valid(element, return_base=True)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>if to_append:<EOL><INDENT>if to_append.endswith("<STR_LIT>"):<EOL><INDENT>to_append = to_append[:-<NUM_LIT:3>]<EOL><DEDENT>if to_append != self.to_get_bare:<EOL><INDENT>mined[self.to_get_bare].append(to_append)<EOL><DEDENT><DEDENT><DEDENT>if mined[self.to_get_bare]:<EOL><INDENT>return mined<EOL><DEDENT>return None<EOL><DEDENT>except (<EOL>PyFunceble.requests.ConnectionError,<EOL>PyFunceble.requests.exceptions.Timeout,<EOL>PyFunceble.requests.exceptions.InvalidURL,<EOL>PyFunceble.socket.timeout,<EOL>urllib3_exceptions.InvalidHeader,<EOL>UnicodeDecodeError,  <EOL>):<EOL><INDENT>return None<EOL><DEDENT><DEDENT>return None<EOL>

Search for domain or URL related to the original URL or domain.

:return: The mined domains or URL.
:rtype: dict


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if "<STR_LIT>" not in PyFunceble.INTERN:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = {}<EOL><DEDENT>if PyFunceble.path.isfile(self.file):<EOL><INDENT>data = Dict().from_json(File(self.file).read())<EOL>for file_path in data:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][file_path] = {}<EOL>for element in data[file_path]:<EOL><INDENT>if data[file_path][element]:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][file_path][element] = data[<EOL>file_path<EOL>][element]<EOL><DEDENT><DEDENT><DEDENT>return<EOL><DEDENT><DEDENT>PyFunceble.INTERN["<STR_LIT>"] = {}<EOL>return<EOL>


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Dict(PyFunceble.INTERN["<STR_LIT>"]).to_json(self.file)<EOL><DEDENT>


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.INTERN["<STR_LIT>"] not in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]] = {}<EOL><DEDENT>for element in to_add:<EOL><INDENT>if (<EOL>element<EOL>in PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]]<EOL>):<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>].extend(to_add[element])<EOL><DEDENT>else:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>] = to_add[element]<EOL><DEDENT>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>] = List(<EOL>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>]<EOL>).format()<EOL><DEDENT>self._backup()<EOL><DEDENT>

Add the currently mined information to the
mined "database".

:param to_add: The element to add.
:type to_add: dict


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.INTERN["<STR_LIT>"] in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>for element in PyFunceble.INTERN["<STR_LIT>"][<EOL>PyFunceble.INTERN["<STR_LIT>"]<EOL>]:<EOL><INDENT>if (<EOL>self.to_get_bare<EOL>in PyFunceble.INTERN["<STR_LIT>"][<EOL>PyFunceble.INTERN["<STR_LIT>"]<EOL>][element]<EOL>):<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>].remove(self.to_get_bare)<EOL><DEDENT><DEDENT>self._backup()<EOL><DEDENT><DEDENT>

Remove the currently tested element from the mining
data.


<EOL>result = []<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.INTERN["<STR_LIT>"] in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>for element in PyFunceble.INTERN["<STR_LIT>"][<EOL>PyFunceble.INTERN["<STR_LIT>"]<EOL>]:<EOL><INDENT>result.extend(<EOL>PyFunceble.INTERN["<STR_LIT>"][PyFunceble.INTERN["<STR_LIT>"]][<EOL>element<EOL>]<EOL>)<EOL><DEDENT>result = List(result).format()<EOL><DEDENT><DEDENT>return result<EOL>

Provide the list of mined so they can be added to the list
queue.

:return: The list of mined domains or URL.
:rtype: list


if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>mined = self.mine()<EOL>if mined:<EOL><INDENT>self._add(mined)<EOL>self._backup()<EOL><DEDENT><DEDENT>

Process the logic and structuration of the mining database.


if passed and self.checker.is_url_valid(passed):<EOL><INDENT>file_to_test = passed.split("<STR_LIT:/>")[-<NUM_LIT:1>]<EOL>if (<EOL>not PyFunceble.path.isfile(file_to_test)<EOL>or PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] == <NUM_LIT:0><EOL>):<EOL><INDENT>Download(passed, file_to_test).text()<EOL><DEDENT>PyFunceble.INTERN["<STR_LIT>"] = file_to_test<EOL>return True<EOL><DEDENT>return False<EOL>

Check if the given information is a URL.
If it is the case, it download and update the location of file to test.

:param passed: The url passed to the system.
:type passed: str

:return: The state of the check.
:rtype: bool


if (<EOL>self.url_file  <EOL>and not self._entry_management_url_download(<EOL>self.url_file  <EOL>)<EOL>):  <EOL><INDENT>PyFunceble.INTERN[<EOL>"<STR_LIT>"<EOL>] = self.url_file<EOL><DEDENT>


if not self.modulo_test:  <EOL><INDENT>PyFunceble.INTERN[<EOL>"<STR_LIT>"<EOL>] = self.file_path  <EOL>self._entry_management_url()<EOL>AutoSave().travis_permissions()<EOL>self.bypass()<EOL>ExecutionTime("<STR_LIT:start>")<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>PyFunceble.HTTP_CODE["<STR_LIT>"] = False<EOL><DEDENT>if self.domain_or_ip_to_test:  <EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT>"<EOL>ExecutionTime("<STR_LIT:start>")<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"] = False<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"] = False<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>domain_or_ip_to_test = domain2idna(<EOL>self.domain_or_ip_to_test.lower()  <EOL>)<EOL><DEDENT>else:<EOL><INDENT>domain_or_ip_to_test = (<EOL>self.domain_or_ip_to_test.lower()  <EOL>)  <EOL><DEDENT>self.domain(domain_or_ip_to_test)<EOL><DEDENT>elif self.url_to_test and not self.file_path:  <EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT:url>"<EOL>ExecutionTime("<STR_LIT:start>")<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"] = False<EOL>self.url(<EOL>self.checker.is_url_valid(<EOL>self.url_to_test,  <EOL>return_formatted=True,<EOL>)<EOL>)<EOL><DEDENT>elif (<EOL>self._entry_management_url_download(<EOL>self.url_file  <EOL>)<EOL>or self.url_file  <EOL>):<EOL><INDENT>PyFunceble.CONFIGURATION["<STR_LIT>"] = PyFunceble.CONFIGURATION[<EOL>"<STR_LIT>"<EOL>] = PyFunceble.CONFIGURATION["<STR_LIT>"] = True<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"] = False<EOL>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT:url>"<EOL>self.file_url()<EOL><DEDENT>elif (<EOL>self._entry_management_url_download(<EOL>self.link_to_test  <EOL>)<EOL>or self._entry_management_url_download(<EOL>self.file_path  <EOL>)  <EOL>or self.file_path  <EOL>):<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT>"<EOL>self.file()<EOL><DEDENT>else:<EOL><INDENT>print(<EOL>PyFunceble.Fore.CYAN + PyFunceble.Style.BRIGHT + "<STR_LIT>"<EOL>)<EOL><DEDENT>if (<EOL>self.domain_or_ip_to_test  <EOL>or self.url_to_test  <EOL>):<EOL><INDENT>ExecutionTime("<STR_LIT>", last=True)<EOL>self.percentage.log()<EOL>self.colorify_logo()<EOL><DEDENT>PyFunceble.stay_safe()<EOL><DEDENT>else:<EOL><INDENT>PyFunceble.CONFIGURATION["<STR_LIT>"] = PyFunceble.CONFIGURATION[<EOL>"<STR_LIT>"<EOL>] = PyFunceble.CONFIGURATION["<STR_LIT>"] = True<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"] = PyFunceble.CONFIGURATION[<EOL>"<STR_LIT>"<EOL>] = PyFunceble.CONFIGURATION["<STR_LIT>"] = PyFunceble.CONFIGURATION[<EOL>"<STR_LIT>"<EOL>] = False<EOL>if self.domain_or_ip_to_test:  <EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT>"<EOL>PyFunceble.INTERN[<EOL>"<STR_LIT>"<EOL>] = self.domain_or_ip_to_test.lower()  <EOL><DEDENT>elif self.url_to_test:  <EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = "<STR_LIT:url>"<EOL>PyFunceble.INTERN[<EOL>"<STR_LIT>"<EOL>] = self.url_to_test<EOL><DEDENT><DEDENT>

Avoid to have 1 millions line into self.__init__()


<EOL>regex_bypass = r"<STR_LIT>"<EOL>if (<EOL>PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>and Regex(<EOL>Command("<STR_LIT>").execute(), regex_bypass, return_data=False<EOL>).match()<EOL>):<EOL><INDENT>AutoSave(True, is_bypass=True)<EOL><DEDENT>

Exit the script if :code:`[PyFunceble skip]` is matched into the latest
commit message.


if (<EOL>not PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>and not PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>):<EOL><INDENT>print("<STR_LIT:\n>")<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>Prints(None, "<STR_LIT>").header()<EOL><DEDENT>else:<EOL><INDENT>Prints(None, "<STR_LIT>").header()<EOL><DEDENT>PyFunceble.CONFIGURATION["<STR_LIT>"] = True<EOL><DEDENT>


def _file_decision(self, current, last, status=None):

if (<EOL>status<EOL>and not PyFunceble.CONFIGURATION["<STR_LIT>"]<EOL>and PyFunceble.INTERN["<STR_LIT>"]<EOL>):<EOL><INDENT>self.mining.process()<EOL>self.mining.remove()<EOL>if (<EOL>status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]<EOL>or status.lower() in PyFunceble.STATUS["<STR_LIT:list>"]["<STR_LIT>"]<EOL>):<EOL><INDENT>if self.inactive_database.is_present():<EOL><INDENT>Generate(PyFunceble.STATUS["<STR_LIT>"]["<STR_LIT>"]).analytic_file(<EOL>"<STR_LIT>"<EOL>)<EOL>self.inactive_database.remove()<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.inactive_database.add()<EOL><DEDENT>self.auto_continue.backup()<EOL>if current != last:<EOL><INDENT>AutoSave()<EOL><DEDENT>else:<EOL><INDENT>ExecutionTime("<STR_LIT>", last=True)<EOL>self.percentage.log()<EOL>self.reset_counters()<EOL>self.auto_continue.backup()<EOL>self.colorify_logo()<EOL>AutoSave(True)<EOL><DEDENT><DEDENT>for index in ["<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>if index in PyFunceble.INTERN:<EOL><INDENT>PyFunceble.INTERN[index] = "<STR_LIT>"<EOL><DEDENT><DEDENT>

Manage the database, autosave and autocontinue systems for the case that we are reading
a file.

:param current: The currently tested element.
:type current: str

:param last: The last element of the list.
:type last: str

:param status: The status of the currently tested element.
:type status: str


def domain(self, domain=None, last_domain=None):

<EOL>self._print_header()<EOL>if domain:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = self._format_domain(domain)<EOL><DEDENT>else:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"] = None<EOL><DEDENT>if PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>status = self.syntax_status.get()<EOL><DEDENT>else:<EOL><INDENT>status, _ = self.status.get()<EOL><DEDENT>self._file_decision(PyFunceble.INTERN["<STR_LIT>"], last_domain, status)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>print(PyFunceble.INTERN["<STR_LIT>"], status)<EOL><DEDENT>return PyFunceble.INTERN["<STR_LIT>"], status<EOL><DEDENT>return None<EOL>

Manage the case that we want to test only a domain.

:param domain: The domain or IP to test.
:type domain: str

:param last_domain:
    The last domain to test if we are testing a file.
:type last_domain: str

:param return_status: Tell us if we need to return the status.
:type return_status: bool


for string in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"].update({string: <NUM_LIT:0>})<EOL><DEDENT>


if not PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>to_print = []<EOL>if home:<EOL><INDENT>for line in PyFunceble.ASCII_PYFUNCEBLE.split("<STR_LIT:\n>"):<EOL><INDENT>to_print.append(<EOL>PyFunceble.Fore.YELLOW + line + PyFunceble.Fore.RESET<EOL>)<EOL><DEDENT><DEDENT>elif PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] >= <NUM_LIT:50>:<EOL><INDENT>for line in PyFunceble.ASCII_PYFUNCEBLE.split("<STR_LIT:\n>"):<EOL><INDENT>to_print.append(<EOL>PyFunceble.Fore.GREEN + line + PyFunceble.Fore.RESET<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>for line in PyFunceble.ASCII_PYFUNCEBLE.split("<STR_LIT:\n>"):<EOL><INDENT>to_print.append(PyFunceble.Fore.RED + line + PyFunceble.Fore.RESET)<EOL><DEDENT><DEDENT>print("<STR_LIT:\n>".join(to_print))<EOL><DEDENT>

Print the colored logo based on global results.

:param home: Tell us if we have to print the initial coloration.
:type home: bool


if not extracted_domain.startswith("<STR_LIT:#>"):<EOL><INDENT>if "<STR_LIT:#>" in extracted_domain:<EOL><INDENT>extracted_domain = extracted_domain[<EOL>: extracted_domain.find("<STR_LIT:#>")<EOL>].strip()<EOL><DEDENT>if "<STR_LIT:U+0020>" in extracted_domain or "<STR_LIT:\t>" in extracted_domain:<EOL><INDENT>splited_line = extracted_domain.split()<EOL>index = <NUM_LIT:1><EOL>while index < len(splited_line):<EOL><INDENT>if splited_line[index]:<EOL><INDENT>break<EOL><DEDENT>index += <NUM_LIT:1><EOL><DEDENT>return splited_line[index]<EOL><DEDENT>return extracted_domain<EOL><DEDENT>return "<STR_LIT>"<EOL>

Format the extracted domain before passing it to the system.

:param extracted_domain: The extracted domain.
:type extracted_domain: str

:return: The formatted domain or IP to test.
:rtype: str

.. note:
    Understand by formating the fact that we get rid
    of all the noises around the domain we want to test.


<EOL>result = []<EOL>if PyFunceble.path.isfile(PyFunceble.INTERN["<STR_LIT>"]):<EOL><INDENT>try:<EOL><INDENT>with open(PyFunceble.INTERN["<STR_LIT>"]) as file:<EOL><INDENT>for line in file:<EOL><INDENT>if not line.startswith("<STR_LIT:#>"):<EOL><INDENT>result.append(line.rstrip("<STR_LIT:\n>").strip())<EOL><DEDENT><DEDENT><DEDENT><DEDENT>except UnicodeDecodeError:<EOL><INDENT>with open(PyFunceble.INTERN["<STR_LIT>"], encoding="<STR_LIT:utf-8>") as file:<EOL><INDENT>for line in file:<EOL><INDENT>if not line.startswith("<STR_LIT:#>"):<EOL><INDENT>result.append(line.rstrip("<STR_LIT:\n>").strip())<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>raise FileNotFoundError(PyFunceble.INTERN["<STR_LIT>"])<EOL><DEDENT>return result<EOL>

Extract all non commented lines from the file we are testing.

:return: The elements to test.
:rtype: list


<EOL>list_to_test = self._file_list_to_test_filtering()<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>list_to_test = domain2idna(list_to_test)<EOL>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>list_to_test = List(list_to_test).custom_format(Sort.hierarchical)<EOL><DEDENT>else:<EOL><INDENT>list_to_test = List(list_to_test).custom_format(Sort.standard)<EOL><DEDENT><DEDENT>not_filtered = list_to_test<EOL>try:<EOL><INDENT>list_to_test = List(<EOL>list(<EOL>set(<EOL>list_to_test[PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] :]<EOL>)<EOL>- set(PyFunceble.INTERN["<STR_LIT>"])<EOL>)<EOL>).format()<EOL>_ = list_to_test[-<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>list_to_test = not_filtered[<EOL>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] :<EOL>]<EOL>del not_filtered<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>list_to_test = List(list(list_to_test)).custom_format(Sort.hierarchical)<EOL><DEDENT>try:<EOL><INDENT>return [self.domain(x, list_to_test[-<NUM_LIT:1>]) for x in list_to_test if x]<EOL><DEDENT>except IndexError:<EOL><INDENT>print(PyFunceble.Fore.CYAN + PyFunceble.Style.BRIGHT + "<STR_LIT>")<EOL><DEDENT>

Manage the case that need to test each domain of a given file path.

.. note::
    1 domain per line.


<EOL>list_to_test = self._file_list_to_test_filtering()<EOL>not_filtered = list_to_test<EOL>try:<EOL><INDENT>list_to_test = List(<EOL>list(<EOL>set(<EOL>list_to_test[PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] :]<EOL>)<EOL>- set(PyFunceble.INTERN["<STR_LIT>"])<EOL>)<EOL>).format()<EOL>_ = list_to_test[-<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>list_to_test = not_filtered[<EOL>PyFunceble.INTERN["<STR_LIT>"]["<STR_LIT>"]["<STR_LIT>"] :<EOL>]<EOL>del not_filtered<EOL><DEDENT>if PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>list_to_test = List(list(list_to_test)).custom_format(Sort.hierarchical)<EOL><DEDENT>try:<EOL><INDENT>return [self.url(x, list_to_test[-<NUM_LIT:1>]) for x in list_to_test if x]<EOL><DEDENT>except IndexError:<EOL><INDENT>print(PyFunceble.Fore.CYAN + PyFunceble.Style.BRIGHT + "<STR_LIT>")<EOL><DEDENT>

Manage the case that we have to test a file

.. note::
    1 URL per line.


@classmethod<EOL><INDENT>def switch(<EOL>cls, variable, custom=False<EOL>):  <DEDENT>

if not custom:<EOL><INDENT>current_state = dict.get(PyFunceble.CONFIGURATION, variable)<EOL><DEDENT>else:<EOL><INDENT>current_state = variable<EOL><DEDENT>if isinstance(current_state, bool):<EOL><INDENT>if current_state:<EOL><INDENT>return False<EOL><DEDENT>return True<EOL><DEDENT>to_print = "<STR_LIT>"<EOL>raise Exception(<EOL>to_print % (repr(variable), PyFunceble.LINKS["<STR_LIT>"] + "<STR_LIT>")<EOL>)<EOL>

Switch PyFunceble.CONFIGURATION variables to their opposite.

:param variable:
    The variable name to switch.
    The variable should be an index our configuration system.
    If we want to switch a bool variable, we should parse
    it here.
:type variable: str|bool

:param custom:
    Let us know if have to switch the parsed variable instead
    of our configuration index.
:type custom: bool

:return:
    The opposite of the configuration index or the given variable.
:rtype: bool

:raises:
    :code:`Exception`
        When the configuration is not valid. In other words,
        if the PyFunceble.CONFIGURATION[variable_name] is not a bool.


if not PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>if self.domain_extension not in self.ignored_extension:<EOL><INDENT>referer = None<EOL>if self.domain_extension in PyFunceble.INTERN["<STR_LIT>"]:<EOL><INDENT>if not PyFunceble.CONFIGURATION["<STR_LIT>"]:<EOL><INDENT>referer = PyFunceble.INTERN["<STR_LIT>"][self.domain_extension]<EOL>if not referer:<EOL><INDENT>Logs().referer_not_found(self.domain_extension)<EOL>return None<EOL><DEDENT>return referer<EOL><DEDENT>return None<EOL><DEDENT>return False<EOL><DEDENT>return None<EOL><DEDENT>return None<EOL>

Return the referer aka the WHOIS server of the current domain extension.


to_ignore = ["<STR_LIT>", "<STR_LIT>"]<EOL>for root, _, files in PyFunceble.walk(<EOL>PyFunceble.CURRENT_DIRECTORY<EOL>+ PyFunceble.directory_separator<EOL>+ "<STR_LIT>"<EOL>+ PyFunceble.directory_separator<EOL>):<EOL><INDENT>for file in files:<EOL><INDENT>if file not in to_ignore and "<STR_LIT>" not in root:<EOL><INDENT>if root.endswith(PyFunceble.directory_separator):<EOL><INDENT>self._update_docs(root + file)<EOL><DEDENT>else:<EOL><INDENT>self._update_docs(root + PyFunceble.directory_separator + file)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for root, _, files in PyFunceble.walk(<EOL>PyFunceble.CURRENT_DIRECTORY<EOL>+ PyFunceble.directory_separator<EOL>+ "<STR_LIT>"<EOL>+ PyFunceble.directory_separator<EOL>):<EOL><INDENT>for file in files:<EOL><INDENT>if file not in to_ignore and "<STR_LIT>" not in root:<EOL><INDENT>if root.endswith(PyFunceble.directory_separator):<EOL><INDENT>self._update_docs(root + file)<EOL><DEDENT>else:<EOL><INDENT>self._update_docs(root + PyFunceble.directory_separator + file)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>


return Dict().from_yaml(<EOL>File(PyFunceble.CURRENT_DIRECTORY + "<STR_LIT>").read()<EOL>)<EOL>

Get and return the content of version.yaml


<EOL>checked = Version(True).check_versions(<EOL>self.current_version[<NUM_LIT:0>], self.version_yaml<EOL>)<EOL>if checked is not None and not checked:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Check if the current version is greater as the older older one.


<EOL>command = "<STR_LIT>"<EOL>command_result = Command(command).execute()<EOL>for branch in command_result.split("<STR_LIT:\n>"):<EOL><INDENT>if branch.startswith("<STR_LIT:*>") and "<STR_LIT>" in branch:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>


Check if the current branch is `master`.


for index, version_number in enumerate(self.current_version[<NUM_LIT:0>][:<NUM_LIT:2>]):<EOL><INDENT>if version_number > self.version_yaml[index]:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Check if we have to put the previous version into the deprecated list.


if self.current_version[<NUM_LIT:0>][<NUM_LIT:0>] > self.version_yaml[<NUM_LIT:0>]:<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Check if we have to put the previsous verion into the list of minimal version
for force_update.


if self.is_dev_version():<EOL><INDENT>regexes = {<EOL>"<STR_LIT>" % "<STR_LIT>": r"<STR_LIT>" % "<STR_LIT>",<EOL>"<STR_LIT>" % "<STR_LIT>": "<STR_LIT>" % "<STR_LIT>",<EOL>}<EOL><DEDENT>elif self.is_master_version():<EOL><INDENT>regexes = {<EOL>"<STR_LIT>" % "<STR_LIT>": r"<STR_LIT>" % "<STR_LIT>",<EOL>"<STR_LIT>" % "<STR_LIT>": "<STR_LIT>" % "<STR_LIT>",<EOL>}<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>")<EOL><DEDENT>to_update = File(file_to_update).read()<EOL>for replacement, regex in regexes.items():<EOL><INDENT>to_update = Regex(to_update, regex, replace_with=replacement).replace()<EOL><DEDENT>File(file_to_update).write(to_update, overwrite=True)<EOL>

Update the given documentation file or :code:`README.rst` so that
it always gives branch related URL and informations.

.. note::
    This only apply to :code:`dev` and :code:`master` branch.

:param file_to_update: The file to update.
:type file_to_update: str