original_docstring: Add a threat.
  
          A threat represents an potential attack against the system and can be defined
          using an @alias tag, or when using one of the threat tags. You can use the alias
          tag to group together threats into an attack library that can be shared between
          projects. For example:
  
              @alias threat @cwe_123_information_disclosure to CWE123 Information Disclosure
              @transfer @cwe_123_information_disclosure to @external:@user with acceptance of terms
  
          Args:
              threat: A threat id or name string.
              threat_id: An optional string containing a threat identifier. If this is set, then threat must contain a name and not an identifier.
  
          Returns:
              A threat identifier.
          
docstring: Add a threat.
  A threat represents an potential attack against the system and can be defined
  using an @alias tag, or when using one of the threat tags. You can use the alias
  tag to group together threats into an attack library that can be shared between
  projects. For example.
  
  
docstring_tokens: Add a threat . A threat represents an potential attack against the system and can be defined using an @alias tag or when using one of the threat tags . You can use the alias tag to group together threats into an attack library that can be shared between projects . For example .
code: def add_threat(self, threat, threat_id=None):
          """Add a threat.
  
          A threat represents an potential attack against the system and can be defined
          using an @alias tag, or when using one of the threat tags. You can use the alias
          tag to group together threats into an attack library that can be shared between
          projects. For example:
  
              @alias threat @cwe_123_information_disclosure to CWE123 Information Disclosure
              @transfer @cwe_123_information_disclosure to @external:@user with acceptance of terms
  
          Args:
              threat: A threat id or name string.
              threat_id: An optional string containing a threat identifier. If this is set, then threat must contain a name and not an identifier.
  
          Returns:
              A threat identifier.
          """
  
          if threat_id and is_identifier(threat):
              raise ValueError("threat_id has been set, but threat contains an identifier")
  
          if not threat_id and is_identifier(threat):
              return threat
  
          if not threat_id:
              threat_id = text_to_identifier(threat)
  
          if threat_id not in self.threats:
              self.threats[threat_id] = PTSThreat(threat)
          return threat_id
code_tokens: def add_threat ( self , threat , threat_id = None ) : if threat_id and is_identifier ( threat ) : raise ValueError ( "threat_id has been set, but threat contains an identifier" ) if not threat_id and is_identifier ( threat ) : return threat if not threat_id : threat_id = text_to_identifier ( threat ) if threat_id not in self . threats : self . threats [ threat_id ] = PTSThreat ( threat ) return threat_id
short_docstring: Add a threat.
short_docstring_tokens: Add a threat .
comment: """Add a threat.
  
          A threat represents an potential attack against the system and can be defined
          using an @alias tag, or when using one of the threat tags. You can use the alias
          tag to group together threats into an attack library that can be shared between
          projects. For example:
  
              @alias threat @cwe_123_information_disclosure to CWE123 Information Disclosure
              @transfer @cwe_123_information_disclosure to @external:@user with acceptance of terms
  
          Args:
              threat: A threat id or name string.
              threat_id: An optional string containing a threat identifier. If this is set, then threat must contain a name and not an identifier.
  
          Returns:
              A threat identifier.
          """