PK!WNU U flake8_eradicate.py# -*- coding: utf-8 -*- from typing import Any, Iterable, Tuple import attr import pkg_resources from eradicate import filter_commented_out_code from flake8.options.manager import OptionManager pkg_name = 'flake8-eradicate' #: We store the version number inside the `pyproject.toml`: pkg_version: str = pkg_resources.get_distribution(pkg_name).version STDIN = 'stdin' @attr.attrs(frozen=True, auto_attribs=True, slots=True) class _Options(object): """Represents ``eradicate`` option object.""" aggressive: bool = False in_place: bool = False class Checker(object): """Flake8 plugin to find commented out code.""" name = pkg_name version = pkg_version _error_template = 'E800: Found commented out code' options: Any # type: ignore def __init__(self, physical_line) -> None: """ Creates new checker instance. When performance will be an issue - we can refactor it. """ self._physical_line = physical_line self._options = _Options(aggressive=self.options.eradicate_aggressive) def _error(self, traceback: str) -> str: return self._error_template.format(traceback) @classmethod def add_options(cls, parser: OptionManager) -> None: """ ``flake8`` api method to register new plugin options. See :class:`.Configuration` docs for detailed options reference. Arguments: parser: ``flake8`` option parser instance. """ parser.add_option( '--eradicate-aggressive', default=False, help=( 'Enables aggressive mode for eradicate; ' 'this may result in false positives' ), action='store_true', type=None, parse_from_config=True, ) @classmethod def parse_options(cls, options) -> None: """Parses registered options for providing them to each visitor.""" cls.options = options def __iter__(self) -> Iterable[Tuple[int, str]]: """Runs on each step of flake8.""" if not self._is_equal_source(): yield (1, self._error_template) def _is_equal_source(self) -> bool: filtered_source = ''.join(filter_commented_out_code( self._physical_line, self._options, )) return self._physical_line == filtered_source PK!HIGD.01flake8_eradicate-0.2.2.dist-info/entry_points.txtNINK(I+ϋrƧ%d&'Z9g&gqqPK!#)//(flake8_eradicate-0.2.2.dist-info/LICENSEMIT License Copyright (c) 2018 Nikita Sobolev 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_eradicate-0.2.2.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H"ѝ )flake8_eradicate-0.2.2.dist-info/METADATAVks8_2 !m45)#mfgl˕dMxzs:^RE\qMd4@fװ#cznQm>dUuGJGX97@0e W1=E~Eлݼ;}_GggJ& q=Z2'(L9~Ȅ/nRG6 FyG ӇJ]WEk6<ȯYKEwo/c*yyߝu.ƨ~٭mV^ήh93yٽfiۃޝ]?7eZԏEmrl7GID?X nSذsA3i8{^(i&ZiH?«}YԠ (IW ՉBΥLN/g`3U<'yJS>YJRok~lDSL+FnؐjP/a.YN6尵K, 4β<_K0u)qҩDh3=+ c.=#S;E$^{oNᣴ#F)$FtW и|"oR!R:k !%Ba>c$3y# ~O~(SgF!'n,Dfr~Ti4*TX4NJ0H*syMI J\@>% Z+PgO^6M'M0ƆWxp>c$nVqӘ ⭢AX@T"P}u&`~'u+2kcRO7x >3͈C >_h~p>8`37L5ZXc}@B\ؿIUctzćַ6j]⽹zƿ 3V /-MoΟ A!a="sAGPK!H=}O/'flake8_eradicate-0.2.2.dist-info/RECORD͹0@oPLQ