Skip to content

Commit

Permalink
fix: Support inequality nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Nov 28, 2021
1 parent 15ab876 commit b0ed247
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/griffe/agents/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
from ast import Expr as NodeExpr
from ast import FormattedValue as NodeFormattedValue
from ast import GeneratorExp as NodeGeneratorExp
from ast import Gt as NodeGt
from ast import GtE as NodeGtE
from ast import IfExp as NodeIfExp
from ast import JoinedStr as NodeJoinedStr
from ast import Lambda as NodeLambda
from ast import List as NodeList
from ast import ListComp as NodeListComp
from ast import Lt as NodeLt
from ast import LtE as NodeLtE
from ast import Mult as NodeMult
from ast import Name as NodeName
from ast import Not as NodeNot
Expand Down Expand Up @@ -735,6 +739,22 @@ def _get_noteq_value(node: NodeNotEq) -> str:
return "!="


def _get_gte_value(node: NodeNotEq) -> str:
return ">="


def _get_gt_value(node: NodeNotEq) -> str:
return ">"


def _get_lte_value(node: NodeNotEq) -> str:
return "<="


def _get_lt_value(node: NodeNotEq) -> str:
return "<"


def _get_generatorexp_value(node: NodeGeneratorExp) -> str:
element = get_value(node.elt)
generators = [get_value(gen) for gen in node.generators]
Expand Down Expand Up @@ -807,6 +827,10 @@ def _get_call_value(node: NodeCall) -> str:
NodeComprehension: _get_comprehension_value,
NodeCompare: _get_compare_value,
NodeNotEq: _get_noteq_value,
NodeGtE: _get_gte_value,
NodeGt: _get_gt_value,
NodeLtE: _get_lte_value,
NodeLt: _get_lt_value,
NodeBitOr: _get_bitor_value,
NodeMult: _get_mult_value,
NodeListComp: _get_listcomp_value,
Expand Down

0 comments on commit b0ed247

Please sign in to comment.