PK!f@@flake8_if_expr/__init__.pyfrom .checker import IfExprChecker __all__ = ['IfExprChecker'] PK!Iflake8_if_expr/checker.pyimport ast from typing import List, Tuple import pycodestyle IF_EXPR_ERROR_MSG = ( 'K100 don`t use "[on_true] if [expression] else [on_false]" syntax' ) class IfExprFinder(ast.NodeVisitor): def __init__(self): self.entries: List[Tuple[int, int]] = [] def visit_IfExp(self, node: ast.AST): # noqa self.entries.append((node.lineno, node.col_offset)) class IfExprChecker: name = 'flake8-if-expr' version = '0.1.0' def __init__(self, tree: ast.AST, filename: str): self.tree: ast.AST = tree self.filename: str = filename self.lines: List[str] = [] def load_file(self): if self.filename in ('stdin', '-', None): self.filename = 'stdin' self.lines = pycodestyle.stdin_get_value().splitlines(True) else: self.lines = pycodestyle.readlines(self.filename) if not self.tree: self.tree = ast.parse(''.join(self.lines)) def run(self): if not self.tree or not self.lines: self.load_file() visitor = IfExprFinder() visitor.visit(self.tree) for lineno, col_offset in visitor.entries: if not pycodestyle.noqa(self.lines[lineno - 1]): yield lineno, col_offset, IF_EXPR_ERROR_MSG, IfExprChecker PK!Hse26/flake8_if_expr-0.1.0.dist-info/entry_points.txtNINK(I+ϋ640gŧVYy)"..PK!611&flake8_if_expr-0.1.0.dist-info/LICENSEMIT License Copyright (c) 2019 Afonasev Evgeniy Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTU$flake8_if_expr-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H;b'flake8_if_expr-0.1.0.dist-info/METADATAU]w8}ׯ>4l%')>(){@OݗU-*[ZIgd-4OtםG 2Ayeb> SXjyϹZr\[nc1cvTtm 콩[YIi*a\Xgb-a7r?xӪaJR8\Zz\Uj7+t ( Jdbg_z~~u/|Lϴ^-&HS|~ "^a)&NV 8uP{{[15t [IRfU^'$=}PK!f@@flake8_if_expr/__init__.pyPK!Ixflake8_if_expr/checker.pyPK!Hse26/flake8_if_expr-0.1.0.dist-info/entry_points.txtPK!611&Iflake8_if_expr-0.1.0.dist-info/LICENSEPK!HڽTU$ flake8_if_expr-0.1.0.dist-info/WHEELPK!H;b'T flake8_if_expr-0.1.0.dist-info/METADATAPK!Hƺ^hK%flake8_if_expr-0.1.0.dist-info/RECORDPK:I