from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes traceback lines from a string (if any). It has no effect when
    no 'Traceback' pattern has been found.

    Returns: raws before the 'Traceback' pattern
    """
    return Path(path).name

from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes parent path from a relative or absolute filename

    Returns: the filename
    """
    return Path(path).name

Fix filename template tag docstring
Fix filename template tag docstring

  from pathlib import Path
  
  from django import template
  from django.template.defaultfilters import stringfilter
  
  register = template.Library()
  
  
  @register.filter
  @stringfilter
  def filename(path):
+     """Removes parent path from a relative or absolute filename
-     """Removes traceback lines from a string (if any). It has no effect when
-     no 'Traceback' pattern has been found.
  
-     Returns: raws before the 'Traceback' pattern
+     Returns: the filename
      """
      return Path(path).name
  
Fix filename template tag docstring
## Code Before:
from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes traceback lines from a string (if any). It has no effect when
    no 'Traceback' pattern has been found.

    Returns: raws before the 'Traceback' pattern
    """
    return Path(path).name

## Instruction:
Fix filename template tag docstring
## Code After:
from pathlib import Path

from django import template
from django.template.defaultfilters import stringfilter

register = template.Library()


@register.filter
@stringfilter
def filename(path):
    """Removes parent path from a relative or absolute filename

    Returns: the filename
    """
    return Path(path).name
