parameters: (self, **kwargs)
return_statement: return res
docstring: ---
          get:
            tags: ["Vulnerability"]
            summary: "Group vulnerabilities by the field set in the group_by GET parameter."
            responses:
              200:
                description: Ok
                content:
                  application/json:
                    schema: VulnerabilityWeb
              404:
                description: group_by is not specified
          tags: ["Vulnerability"]
          responses:
            200:
              description: Ok
docstring_summary: ---
          get:
            tags: ["Vulnerability"]
            summary: "Group vulnerabilities by the field set in the group_by GET parameter."
            responses:
              200:
                description: Ok
                content:
                  application/json:
                    schema: VulnerabilityWeb
              404:
                description: group_by is not specified
          tags: ["Vulnerability"]
          responses:
            200:
              description: Ok
docstring_tokens: --- get : tags : [ Vulnerability ] summary : Group vulnerabilities by the field set in the group_by GET parameter . responses : 200 : description : Ok content : application / json : schema : VulnerabilityWeb 404 : description : group_by is not specified tags : [ Vulnerability ] responses : 200 : description : Ok
function: def count(self, **kwargs):
          """
          ---
          get:
            tags: ["Vulnerability"]
            summary: "Group vulnerabilities by the field set in the group_by GET parameter."
            responses:
              200:
                description: Ok
                content:
                  application/json:
                    schema: VulnerabilityWeb
              404:
                description: group_by is not specified
          tags: ["Vulnerability"]
          responses:
            200:
              description: Ok
          """
          res = super().count(**kwargs)
  
          def convert_group(group):
              group = group.copy()
              severity_map = {
                  "informational": "info",
                  "medium": "med"
              }
              severity = group['severity']
              group['severity'] = group['name'] = severity_map.get(
                  severity, severity)
              return group
  
          if request.args.get('group_by') == 'severity':
              res['groups'] = [convert_group(group) for group in res['groups']]
          return res
function_tokens: def count ( self , * * kwargs ) : res = super ( ) . count ( * * kwargs ) def convert_group ( group ) : group = group . copy ( ) severity_map = { "informational" : "info" , "medium" : "med" } severity = group [ 'severity' ] group [ 'severity' ] = group [ 'name' ] = severity_map . get ( severity , severity ) return group if request . args . get ( 'group_by' ) == 'severity' : res [ 'groups' ] = [ convert_group ( group ) for group in res [ 'groups' ] ] return res