Config

Problematic

  • How can we make personalization more simple?
  • How can we automaticaly merge the new configuration with the local one?
  • How can we link some configuration endpoints with the real logic.

Documentation

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

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

Provides the configuration logics.

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

License:

MIT License

Copyright (c) 2017, 2018, 2019, 2020 Nissar Chababy

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

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

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

Load()

class PyFunceble.config.load.Load(path_to_config, custom=None)[source]

Loads the configuration(s) file(s).

Parameters:
  • path_to_config (str) – The possible path to the configuration to load.
  • custom (dict) – The custom index, this is what we overwrite.
classmethod _Load__download_them_all()

Download everything that needs to be downloaded.

_Load__fix_paths()

Fixes all paths.

_Load__load_it()

Loads the configuration and everything needed around it.

Note

“Everything needed around it” is meant to be all files which are needed by other part of the project.

_Load__set_it(custom)

Sets the configuration at its final location and load the complementary infos.

Parameters:custom (dict) – The custom index, this is what we overwrite.
_install_production_config()[source]

Downloads the production configuration and install it in the given configuration directory.

_load_config_file()[source]

Loads :code.`.PyFunceble.yaml` into the system.

classmethod _set_path_to_configs(path_to_config)[source]

Sets the paths to the configuration files.

Parameters:path_to_config (str) – The possible path to the config to load.
Returns:The path to the config to read (0), the path to the default configuration to read as fallback.(1)
Return type:tuple
get()[source]

Returns the loaded config

Merge()

class PyFunceble.config.merge.Merge(configuration_path)[source]

Merges the old (local) into the new (upstream) configuration file.

Parameters:configuration_path (str) – The path to the configuration file to update.
_is_local_version_different_from_upstream()[source]

Checks if we have to merge.

_load()[source]

Executes the logic behind the merging.

Simply merge the new links.

_merge_user_agent()[source]

Simply merge the new user agent layout.

_merge_values()[source]

Simply merge the older into the new one.

_save()[source]

Saves the new configuration inside the configuration file.

Checks if we have to update the links.

_should_we_update_user_agent()[source]

Checks if we have to update the user agent index.

Preset()

class PyFunceble.config.preset.Preset[source]

Checks or update the global configuration based on some events.

classmethod _Preset__are_we_allowed_to_overwrite(index)

Checks if we are allowed to overwrite an index.

api()[source]

Prepares the global configuration for a test from the API.

complements()[source]

Prepares the global configuration for a complements generation.

cooldown_time()[source]

Ensures that we always have a correct cooldown time.

classmethod disable(indexes)[source]

Sets the given configuration index to False.

classmethod dns_lookup_over_tcp()[source]

Ensures that the DNS lookup over tcp is proprely set.

classmethod dns_nameserver()[source]

Ensures that the DNS nameserver is proprely set.

classmethod enable(indexes)[source]

Sets the given configuration index to True.

file_url()[source]

Prepares the global configuration for a list of URL to test.

init_all()[source]

Initiate all presets which are independent from others.

classmethod maximal_processes()[source]

Ensures that the number of maximal processes is alway >= 1.

multiprocess()[source]

Prepares the global configuration for a test with multiple processes.

classmethod multiprocess_merging_mode()[source]

Ensures that a valid merging mode is given.

reputation_data()[source]

Ensures that the usage of reputation data is activated when needed.

classmethod reset_counters()[source]

Resets the counters.

simple_domain()[source]

Prepares the global configuration for a domain test.

simple_url()[source]

Prepares the global configuration for an URL test.

classmethod switch(variable, custom=False)[source]

Switches PyFunceble.CONFIGURATION variables to their opposite.

Parameters:
  • variable (str|bool) – 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.
  • custom (bool) – Let us know if have to switch the parsed variable instead of our configuration index.
Returns:

The opposite of the configuration index or the given variable.

Return type:

bool

Raises:
Exception

When the configuration is not valid. In other words, if the PyFunceble.CONFIGURATION[variable_name] is not a bool.

syntax_test()[source]

Disables the HTTP status code if we are testing for syntax

classmethod timeout()[source]

Ensures that the timeout is always correct.