INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library.
async def contains_tracks(self, *tracks: Sequence[Union[str, Track]]) -> List[bool]: """Check if one or more tracks is already saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- tracks : Union[Track, str] A sequence of track objects or spotify ID...
Get a list of the songs saved in the current Spotify user’s ‘Your Music’ library.
async def get_tracks(self, *, limit=20, offset=0) -> List[Track]: """Get a list of the songs saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. ...
Get a list of the albums saved in the current Spotify user’s ‘Your Music’ library.
async def get_albums(self, *, limit=20, offset=0) -> List[Album]: """Get a list of the albums saved in the current Spotify user’s ‘Your Music’ library. Parameters ---------- limit : Optional[int] The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. ...
Remove one or more albums from the current user’s ‘Your Music’ library.
async def remove_albums(self, *albums): """Remove one or more albums from the current user’s ‘Your Music’ library. Parameters ---------- albums : Sequence[Union[Album, str]] A sequence of artist objects or spotify IDs """ _albums = [(obj if isinstance(obj, st...
Remove one or more tracks from the current user’s ‘Your Music’ library.
async def remove_tracks(self, *tracks): """Remove one or more tracks from the current user’s ‘Your Music’ library. Parameters ---------- tracks : Sequence[Union[Track, str]] A sequence of track objects or spotify IDs """ _tracks = [(obj if isinstance(obj, str...
Save one or more albums to the current user’s ‘Your Music’ library.
async def save_albums(self, *albums): """Save one or more albums to the current user’s ‘Your Music’ library. Parameters ---------- albums : Sequence[Union[Album, str]] A sequence of artist objects or spotify IDs """ _albums = [(obj if isinstance(obj, str) els...
Save one or more tracks to the current user’s ‘Your Music’ library.
async def save_tracks(self, *tracks): """Save one or more tracks to the current user’s ‘Your Music’ library. Parameters ---------- tracks : Sequence[Union[Track, str]] A sequence of track objects or spotify IDs """ _tracks = [(obj if isinstance(obj, str) else...
Get a spotify ID from a URI or open. spotify URL.
def to_id(string: str) -> str: """Get a spotify ID from a URI or open.spotify URL. Paramters --------- string : str The string to operate on. Returns ------- id : str The Spotify ID from the string. """ string = string.strip() match = _URI_RE.match(string) ...
decorator to assert an object has an attribute when run.
def assert_hasattr(attr: str, msg: str, tp: BaseException = SpotifyException) -> Callable: """decorator to assert an object has an attribute when run.""" def decorator(func: Callable) -> Callable: @functools.wraps(func) def decorated(self, *args, **kwargs): if not hasattr(self, attr)...
Construct a OAuth2 object from a spotify. Client.
def from_client(cls, client, *args, **kwargs): """Construct a OAuth2 object from a `spotify.Client`.""" return cls(client.http.client_id, *args, **kwargs)
Construct a OAuth2 URL instead of an OAuth2 object.
def url_(client_id: str, redirect_uri: str, *, scope: str = None, state: str = None, secure: bool = True) -> str: """Construct a OAuth2 URL instead of an OAuth2 object.""" attrs = { 'client_id': client_id, 'redirect_uri': quote(redirect_uri) } if scope is not Non...
Attributes used when constructing url parameters.
def attrs(self): """Attributes used when constructing url parameters.""" data = { 'client_id': self.client_id, 'redirect_uri': quote(self.redirect_uri), } if self.scope is not None: data['scope'] = quote(self.scope) if self.state is not None:...
URL parameters used.
def parameters(self) -> str: """URL parameters used.""" return '&'.join('{0}={1}'.format(*item) for item in self.attrs.items())
get the track object for each link in the partial tracks data
async def build(self): """get the track object for each link in the partial tracks data Returns ------- tracks : List[Track] The tracks """ data = await self.__func() return list(PlaylistTrack(self.__client, track) for track in data['items'])
Get all playlist tracks from the playlist.
async def get_all_tracks(self) -> List[PlaylistTrack]: """Get all playlist tracks from the playlist. Returns ------- tracks : List[PlaylistTrack] The playlists tracks. """ if isinstance(self._tracks, PartialTracks): return await self._tracks.build...
Pause playback on the user’s account.
async def pause(self, *, device: Optional[SomeDevice] = None): """Pause playback on the user’s account. Parameters ---------- device : Optional[:obj:`SomeDevice`] The Device object or id of the device this command is targeting. If not supplied, the user’s current...
Resume playback on the user s account.
async def resume(self, *, device: Optional[SomeDevice] = None): """Resume playback on the user's account. Parameters ---------- device : Optional[:obj:`SomeDevice`] The Device object or id of the device this command is targeting. If not supplied, the user’s curre...
Seeks to the given position in the user’s currently playing track.
async def seek(self, pos, *, device: Optional[SomeDevice] = None): """Seeks to the given position in the user’s currently playing track. Parameters ---------- pos : int The position in milliseconds to seek to. Must be a positive number. Passing in a p...
Set the repeat mode for the user’s playback.
async def set_repeat(self, state, *, device: Optional[SomeDevice] = None): """Set the repeat mode for the user’s playback. Parameters ---------- state : str Options are repeat-track, repeat-context, and off device : Optional[:obj:`SomeDevice`] The Device ...
Set the volume for the user’s current playback device.
async def set_volume(self, volume: int, *, device: Optional[SomeDevice] = None): """Set the volume for the user’s current playback device. Parameters ---------- volume : int The volume to set. Must be a value from 0 to 100 inclusive. device : Optional[:obj:`SomeDevic...
Skips to next track in the user’s queue.
async def next(self, *, device: Optional[SomeDevice] = None): """Skips to next track in the user’s queue. Parameters ---------- device : Optional[:obj:`SomeDevice`] The Device object or id of the device this command is targeting. If not supplied, the user’s curre...
Skips to previous track in the user’s queue.
async def previous(self, *, device: Optional[SomeDevice] = None): """Skips to previous track in the user’s queue. Note that this will ALWAYS skip to the previous track, regardless of the current track’s progress. Returning to the start of the current track should be performed using :meth:`seek`...
Start a new context or resume current playback on the user’s active device.
async def play(self, *uris: SomeURIs, offset: Optional[Offset] = 0, device: Optional[SomeDevice] = None): """Start a new context or resume current playback on the user’s active device. The method treats a single argument as a Spotify context, such as a Artist, Album and playlist objects/URI. Wh...
shuffle on or off for user’s playback.
async def shuffle(self, state: Optional[bool] = None, *, device: Optional[SomeDevice] = None): """shuffle on or off for user’s playback. Parameters ---------- state : Optional[bool] if `True` then Shuffle user’s playback. else if `False` do not shuffle user’s pla...
Transfer playback to a new device and determine if it should start playing.
async def transfer(self, device: SomeDevice, ensure_playback: bool = False): """Transfer playback to a new device and determine if it should start playing. Parameters ---------- device : :obj:`SomeDevice` The device on which playback should be started/transferred. en...
Get the full object from spotify with a href attribute.
async def from_href(self): """Get the full object from spotify with a `href` attribute.""" if not hasattr(self, 'href'): raise TypeError('Spotify object has no `href` attribute, therefore cannot be retrived') elif hasattr(self, 'http'): return await self.http.request(('G...
Execute the logic behind the meaning of ExpirationDate + return the matched status.
def get(self): # pragma: no cover """ Execute the logic behind the meaning of ExpirationDate + return the matched status. :return: The status of the tested domain. Can be one of the official status. :rtype: str """ # We get the status of the dom...
Convert a given month into our unified format.
def _convert_or_shorten_month(cls, data): """ Convert a given month into our unified format. :param data: The month to convert or shorten. :type data: str :return: The unified month name. :rtype: str """ # We map the different month and their possible r...
A little internal helper of self. format. ( Avoiding of nested loops )
def _cases_management(self, regex_number, matched_result): """ A little internal helper of self.format. (Avoiding of nested loops) .. note:: Please note that the second value of the case represent the groups in order :code:`[day,month,year]`. This means that...
Format the expiration date into an unified format ( 01 - jan - 1970 ).
def _format(self, date_to_convert=None): """ Format the expiration date into an unified format (01-jan-1970). :param date_to_convert: The date to convert. In other words, the extracted date. :type date_to_convert: str :return: The formatted expiration date. ...
Extract the expiration date from the whois record.
def _extract(self): # pragma: no cover """ Extract the expiration date from the whois record. :return: The status of the domain. :rtype: str """ # We try to get the expiration date from the database. expiration_date_from_database = Whois().get_expiration_date()...
Read the code and update all links.
def _update_code_urls(self): """ Read the code and update all links. """ to_ignore = [".gitignore", ".keep"] for root, _, files in PyFunceble.walk( PyFunceble.CURRENT_DIRECTORY + PyFunceble.directory_separator + "PyFunceble" + PyF...
Check if the current version is greater as the older older one.
def _is_version_greater(self): """ Check if the current version is greater as the older older one. """ # we compare the 2 versions. checked = Version(True).check_versions( self.current_version[0], self.version_yaml ) if checked is not None and not ch...
Check if the current branch is dev.
def is_dev_version(cls): """ Check if the current branch is `dev`. """ # We initiate the command we have to run in order to # get the branch we are currently working with. command = "git branch" # We execute and get the command output. command_result = C...
Check if we have to put the previous version into the deprecated list.
def _does_require_deprecation(self): """ Check if we have to put the previous version into the deprecated list. """ for index, version_number in enumerate(self.current_version[0][:2]): # We loop through the 2 last elements of the version. if version_number > sel...
Update the given documentation file or: code: README. rst so that it always gives branch related URL and informations.
def _update_docs(self, file_to_update): """ 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: code: setup. py so that it always have the right name.
def _update_setup_py(self): """ Update :code:`setup.py` so that it always have the right name. """ # We initiate the path to the file we have to filter. setup_py_path = PyFunceble.CURRENT_DIRECTORY + "setup.py" if self.is_dev_version(): # The current version...
Update: code:. travis. yml according to current branch.
def _update_travis_yml(self): """ Update :code:`.travis.yml` according to current branch. """ # We initiate the file we have to filter/update. travis_yml_path = PyFunceble.CURRENT_DIRECTORY + ".travis.yml" if self.is_dev_version(): # The current version is t...
Backup the current execution state.
def backup(self): """ Backup the current execution state. """ if PyFunceble.CONFIGURATION["auto_continue"]: # The auto_continue subsystem is activated. # We initiate the location where we are going to save the data to backup. data_to_backup = {} ...
Restore data from the given path.
def restore(self): """ Restore data from the given path. """ if PyFunceble.CONFIGURATION["auto_continue"] and self.backup_content: # The auto_continue subsystem is activated and the backup_content # is not empty. # We get the file we have to restore....
Check if we have to ignore the given line.
def _is_to_ignore(cls, line): """ Check if we have to ignore the given line. :param line: The line from the file. :type line: str """ # We set the list of regex to match to be # considered as ignored. to_ignore = [r"(^!|^@@|^\/|^\[|^\.|^-|^_|^\?|^&)"] #...
Handle the data from the options.
def _handle_options(self, options): """ 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 """ # We initiate a variable which will save o...
Extract the base of the given element.
def _extract_base(self, element): """ 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 """ if isinstance(element, list): ...
Decode/ extract the domains to test from the adblock formated file.
def decode(self): """ Decode/extract the domains to test from the adblock formated file. :return: The list of domains to test. :rtype: list """ # We initiate a variable which will save what we are going to return. result = [] # We initiate the first reg...
Format the exctracted adblock line before passing it to the system.
def _format_decoded(self, to_format, result=None): # pragma: no cover """ 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. :t...
Get the HTTP code status.
def _access(self): # pragma: no cover """ Get the HTTP code status. :return: The matched HTTP status code. :rtype: int|None """ try: # We try to get the HTTP status code. if PyFunceble.INTERN["to_test_type"] == "url": # We are g...
Return the HTTP code status.
def get(self): """ Return the HTTP code status. :return: The matched and formatted status code. :rtype: str|int|None """ if PyFunceble.HTTP_CODE["active"]: # The http status code extraction is activated. # We get the http status code. ...
Check the syntax of the given domain.
def syntax_check(domain): # pragma: no cover """ 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...
Check if the given domain is a subdomain.
def is_subdomain(domain): # pragma: no cover """ 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:`No...
Check the syntax of the given IPv4.
def ipv4_syntax_check(ip): # pragma: no cover """ 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`. ""...
Check if the given IP is an IP range.
def is_ipv4_range(ip): # pragma: no cover """ 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 i...
Check the syntax of the given URL.
def url_syntax_check(url): # pragma: no cover """ 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`. "...
Load the configuration.
def load_config(under_test=False, custom=None): # pragma: no cover """ Load the configuration. :param under_test: Tell us if we only have to load the configuration file (True) or load the configuration file and initate the output directory if it does not exist (False). :type un...
Print a friendly message.
def stay_safe(): # pragma: no cover """ Print a friendly message. """ random = int(choice(str(int(time())))) if not CONFIGURATION["quiet"] and random % 3 == 0: print("\n" + Fore.GREEN + Style.BRIGHT + "Thanks for using PyFunceble!") print( Fore.YELLOW + Sty...
Provide the command line interface.
def _command_line(): # pragma: no cover pylint: disable=too-many-branches,too-many-statements """ Provide the command line interface. """ if __name__ == "PyFunceble": # We initiate the end of the coloration at the end of each line. initiate(autoreset=True) # We load the config...
Check if the given information is a URL. If it is the case it download and update the location of file to test.
def _entry_management_url_download(self, passed): """ 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. ...
Manage the loading of the url system.
def _entry_management_url(self): """ Manage the loading of the url system. """ if ( self.url_file # pylint: disable=no-member and not self._entry_management_url_download( self.url_file # pylint: disable=no-member ) ): # pyli...
Avoid to have 1 millions line into self. __init__ ()
def _entry_management(self): # pylint: disable=too-many-branches """ Avoid to have 1 millions line into self.__init__() """ if not self.modulo_test: # pylint: disable=no-member # We are not in a module usage. # We set the file_path as the file we have to test....
Exit the script if: code: [ PyFunceble skip ] is matched into the latest commit message.
def bypass(cls): """ Exit the script if :code:`[PyFunceble skip]` is matched into the latest commit message. """ # We set the regex to match in order to bypass the execution of # PyFunceble. regex_bypass = r"\[PyFunceble\sskip\]" if ( PyFunce...
Decide if we print or not the header.
def _print_header(cls): """ Decide if we print or not the header. """ if ( not PyFunceble.CONFIGURATION["quiet"] and not PyFunceble.CONFIGURATION["header_printed"] ): # * The quiet mode is not activated. # and # * The h...
Manage the database autosave and autocontinue systems for the case that we are reading a file.
def _file_decision(self, current, last, status=None): """ 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. ...
Manage the case that we want to test only a domain.
def domain(self, domain=None, last_domain=None): """ 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 ...
Manage the case that we want to test only a given url.
def url(self, url_to_test=None, last_url=None): """ Manage the case that we want to test only a given url. :param url_to_test: The url to test. :type url_to_test: str :param last_url: The last url of the file we are testing (if exist) :type last_...
Print the colored logo based on global results.
def colorify_logo(cls, home=False): """ 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 PyFunceble.CONFIGURATION["quiet"]: # The quiet mode is not activated. ...
Format the extracted domain before passing it to the system.
def _format_domain(cls, extracted_domain): """ 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: ...
Extract all non commented lines from the file we are testing.
def _extract_domain_from_file(cls): """ Extract all non commented lines from the file we are testing. :return: The elements to test. :rtype: list """ # We initiate the variable which will save what we are going to return. result = [] if PyFunceble.path....
Manage the case that need to test each domain of a given file path.
def file(self): """ Manage the case that need to test each domain of a given file path. .. note:: 1 domain per line. """ # We get, format, filter, clean the list to test. list_to_test = self._file_list_to_test_filtering() if PyFunceble.CONFIGURATION...
Manage the case that we have to test a file
def file_url(self): """ Manage the case that we have to test a file .. note:: 1 URL per line. """ # We get, format, clean the list of URL to test. list_to_test = self._file_list_to_test_filtering() # We initiate a local variable which will save the ...
Switch PyFunceble. CONFIGURATION variables to their opposite.
def switch( cls, variable, custom=False ): # pylint: disable=inconsistent-return-statements """ Switch PyFunceble.CONFIGURATION variables to their opposite. :param variable: The variable name to switch. The variable should be an index our configuration syste...
Get the status while testing for an IP or domain.
def get(cls): """ Get the status while testing for an IP or domain. .. note:: We consider that the domain or IP we are currently testing is into :code:`PyFunceble.INTERN["to_test"]`. """ if "to_test" in PyFunceble.INTERN and PyFunceble.INTERN["to_test"]:...
Handle the lack of WHOIS and expiration date.: smile_cat:
def handle(cls, status, invalid_source="IANA"): """ Handle the lack of WHOIS and expiration date. :smile_cat: :param matched_status: The status that we have to handle. :type status: str :param invalid_source: The source to set when we handle INVALID element. ...
Handle the backend of the given status.
def handle(self): """ Handle the backend of the given status. """ # We initiate the source we are going to parse to the Generate class. source = "URL" if self.catched.lower() not in PyFunceble.STATUS["list"]["invalid"]: # The parsed status is not in the list...
Backup the developer state of output/ in order to make it restorable and portable for user.
def backup(self): """ Backup the developer state of `output/` in order to make it restorable and portable for user. """ # We set the current output directory path. output_path = self.base + PyFunceble.OUTPUTS["parent_directory"] # We initiate the structure b...
Check if we need to replace. gitignore to. keep.
def _restore_replace(self): """ Check if we need to replace ".gitignore" to ".keep". :return: The replacement status. :rtype: bool """ if PyFunceble.path.isdir(self.base + ".git"): # The `.git` directory exist. if "PyFunceble" not in Command("gi...
Update the paths according to configs.
def _update_structure_from_config(self, structure): """ Update the paths according to configs. :param structure: The read structure. :type structure: dict """ # We initiate a variable which will map what we have to replace `ouput` to. # Indeed, as we allow the u...
Get the structure we are going to work with.
def _get_structure(self): """ Get the structure we are going to work with. :return: The structure we have to work with. :rtype: dict """ # We initiate an empty variable which is going to save the location of # file we are going to download. structure_fil...
Creates the given directory if it does not exists.
def _create_directory(cls, directory, loop=False): """ 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 """ if...
Restore the output/ directory structure based on the dir_structure. json file.
def restore(self): """ Restore the 'output/' directory structure based on the `dir_structure.json` file. """ # We get the structure we have to create/apply. structure = self._get_structure() # We get the list of key which is implicitly the list of directory to recreate....
Delete the directory which are not registered into our structure.
def delete_uneeded(self): """ Delete the directory which are not registered into our structure. """ # We get the structure we have to apply. structure = self._get_structure() # We get the list of key which is implicitly the list of directory we do not bave to delete. ...
Set the paths to the configuration files.
def _set_path_to_configs(cls, path_to_config): """ Set the paths to the configuration files. :param path_to_config: The possible path to the config to load. :type path_to_config: str :return: The path to the config to read (0), the path to the default co...
Load. PyFunceble. yaml into the system.
def _load_config_file(self): """ Load .PyFunceble.yaml into the system. """ try: # We try to load the configuration file. PyFunceble.CONFIGURATION.update( Dict.from_yaml(File(self.path_to_config).read()) ) # We install th...
Download the production configuration and install it in the current directory.
def _install_production_config(self): """ Download the production configuration and install it in the current directory. """ # We initiate the link to the production configuration. # It is not hard coded because this method is called only if we # are sure that th...
Download iana - domains - db. json if not present.
def _install_iana_config(cls): """ Download `iana-domains-db.json` if not present. """ # We initiate the link to the iana configuration. # It is not hard coded because this method is called only if we # are sure that the configuration file exist. iana_link = PyFu...
Download public - suffix. json if not present.
def _install_psl_config(cls): """ Download `public-suffix.json` if not present. """ # We initiate the link to the public suffix configuration. # It is not hard coded because this method is called only if we # are sure that the configuration file exist. psl_link =...
Download the latest version of dir_structure_production. json.
def _install_directory_structure_file(cls): """ Download the latest version of `dir_structure_production.json`. """ # We initiate the link to the public suffix configuration. # It is not hard coded because this method is called only if we # are sure that the configuratio...
Simply merge the older into the new one.
def _merge_values(self): """ Simply merge the older into the new one. """ to_remove = [] self.new_config = Dict( Dict(self.upstream_config).merge(PyFunceble.CONFIGURATION) ).remove_key(to_remove)
Execute the logic behind the merging.
def _load(self): """ Execute the logic behind the merging. """ if "PYFUNCEBLE_AUTO_CONFIGURATION" not in PyFunceble.environ: # The auto configuration environment variable is not set. while True: # We infinitly loop until we get a reponse which is...
Convert the versions to a shorter one.
def split_versions(cls, version, return_non_digits=False): """ Convert the versions to a shorter one. :param version: The version to split. :type version: str :param return_non_digits: Activate the return of the non-digits parts of the splitted version. ...
Compare the given versions.
def check_versions(cls, local, upstream): """ Compare the given versions. :param local: The local version converted by split_versions(). :type local: list :param upstream: The upstream version converted by split_versions(). :type upstream: list :return: ...
Compare the current version with the upstream saved version.
def compare(self): """ Compare the current version with the upstream saved version. """ if self.upstream_data["force_update"]["status"]: # The force_update status is set to True. for minimal in self.upstream_data["force_update"]["minimal_version"]: ...
Let us know if we are currently in the cloned version of PyFunceble which implicitly mean that we are in developement mode.
def is_cloned(cls): """ Let us know if we are currently in the cloned version of PyFunceble which implicitly mean that we are in developement mode. """ if not PyFunceble.path.isdir(".git"): # The git directory does not exist. # We return False, the curre...
Handle and check that some configuration index exists.
def _handle_non_existant_index(cls): """ Handle and check that some configuration index exists. """ try: # We try to call the http code. PyFunceble.INTERN["http_code"] except KeyError: # If it is not found. # We initiate an empty ...
Return the analytic directory to write depending of the matched status.
def _analytic_host_file_directory(self): """ Return the analytic directory to write depending of the matched status. """ # We construct the path to the analytic directory. output_dir = ( self.output_parent_dir + PyFunceble.OUTPUTS["analytic"]["dir...
Generate the hosts file the plain list and the splitted lists.
def info_files(self): # pylint: disable=inconsistent-return-statements """ Generate the hosts file, the plain list and the splitted lists. """ if self._do_not_produce_file(): # We do not have to produce file. # We return false. return False ...
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 unified_file(self): """ 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. """ if ( "file_to_test" in PyFunceble.INTERN and PyFunceble....
Generate: code: Analytic/ * files based on the given old and new statuses.
def analytic_file(self, new_status, old_status=None): """ 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...
Logic behind the printing ( in file ) when generating status file.
def _prints_status_file(self): # pylint: disable=too-many-branches """ Logic behind the printing (in file) when generating status file. """ if PyFunceble.INTERN["file_to_test"]: # We are testing a file. output = ( self.output_parent_dir ...
Logic behind the printing ( on screen ) when generating status file.
def _prints_status_screen(self): """ Logic behind the printing (on screen) when generating status file. """ if not PyFunceble.CONFIGURATION["quiet"]: # The quiet mode is not activated. if PyFunceble.CONFIGURATION["less"]: # We have to print less ...
Generate a file according to the domain status.
def status_file(self): # pylint: disable=inconsistent-return-statements """ Generate a file according to the domain status. """ if "file_to_test" in PyFunceble.INTERN: # We are not testing as an imported module. # We generate the hosts file. Generat...
Check if we are allowed to produce a file based from the given information.
def _do_not_produce_file(self): """ 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 """ if...