Skip to content

Commit

Permalink
Fixed: description for deprecated fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mnot committed Dec 14, 2023
1 parent b686c70 commit 151df8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion httplint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from httplint.field.finder import get_field_description
from httplint.field.description import get_field_description
from httplint.message import HttpRequestLinter, HttpResponseLinter
from httplint.note import Notes

Expand Down
14 changes: 14 additions & 0 deletions httplint/field/description.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from typing import Optional

from httplint.field.finder import HttpFieldFinder
from httplint.message import HttpMessageLinter

_linter = HttpMessageLinter()


def get_field_description(field_name: str) -> Optional[str]:
"""Return the description for the named field, or None if not found."""
handler_class = HttpFieldFinder.find_handler_class(field_name)
if handler_class is not None:
return handler_class(field_name, _linter).description
return None
8 changes: 0 additions & 8 deletions httplint/field/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,3 @@ def parse(self, field_value: str, add_note: AddNoteMethodType) -> Any:

def evaluate(self, add_note: AddNoteMethodType) -> None:
return


def get_field_description(field_name: str) -> Optional[str]:
"""Return the description for the named field, or None if not found."""
handler_class = HttpFieldFinder.find_handler_class(field_name)
if handler_class is not None and handler_class.description:
return handler_class.description
return None

0 comments on commit 151df8a

Please sign in to comment.