def manifest_file(self, value): """ Sets the value of the hash Args: ----- value: a string representing the name of the manifest_file. Raises: ------- TypeError: whenever the value provided is not a string. """ if value is None or validations.isTypeCorrect(value, 'str'): self._manifest_file = value
def size(self, value): """ Sets the size of the extension Args: ----- value: an integer representing the number of bytes of the extension. Raises: ------- TypeError: whenever the value provided is not an integer. """ if value is None or validations.isTypeCorrect(value, 'int'): self._size = value
def features(self, value): """ Sets the value of the features dict Args: ----- value: a dict representing the features extracted. Raises: ------- TypeError: whenever the value provided is not a dictionary. """ if value is None or validations.isTypeCorrect(value, 'dict'): self._features = value
def manifest(self, value): """ Sets the value of the manifest dict Args: ----- value: a dict representing the data extracted from the manifest. Raises: ------- TypeError: whenever the value provided is not a dictionary. """ if value is None or validations.isTypeCorrect(value, 'dict'): self._manifest = value
def filename(self, value): """ Sets the filename value Args: ----- value: a string representing the filename. Raises: ------- TypeError: whenever the value provided is not a string. """ if value is None or validations.isTypeCorrect(value, 'str'): self._filename = value
def analyser_version(self, value): """ Sets the value of the analyser version Args: ----- value: a string representing the current version of the analyser. Raises: ------- TypeError: whenever the value provided is not a string. """ if validations.isTypeCorrect(value, 'str'): self._analyser_version = value
def headers(self, value): """ Sets the value for the headers. Args: ----- value: a dictionary representing the headers to be loaded. Raises: ------- ValueError: if the value is a dictionary. """ if validations.isTypeCorrect(value, "dict"): self._headers = value
def files(self, value): """ Sets the value of the dictionary of files found inside Args: ----- value: a dictionary representing the files found inside the extension, where the key is the relative path and the value is the hash of that given file. Raises: ------- TypeError: whenever the value provided is not a dictionary. """ if value is None or validations.isTypeCorrect(value, 'dict'): self._files = value
def date_analysis(self, value): """ Sets the value of the analysis date It receives a Datetime object and converts it to a string. If the object provided is not a date, it gets the current date with `utcnow()`. Args: ----- value: a datetime object with the date. """ try: if validations.isTypeCorrect(value, 'datetime'): self._date_analysis = str(value) + " UTC" except TypeError as e: self._date_analysis = str(dt.datetime.utcnow()) + "UTC"
def digest(self, value): """ Sets the value of the hash Args: ----- value: a dictionary representing the digests as MD5, SHA1 & SHA256. { "md5": "…", "sha1": "…", "sha256": "…", } Raises: ------- TypeError: whenever the value provided is not a dict. """ if value is None or validations.isTypeCorrect(value, 'dict'): self._digest = value
def headers(self, value): if validations.isTypeCorrect(value, "dict"): self._headers = value