Module Expr Str Import alias Import alias Import alias Import alias Import alias ImportFrom alias identifier ImportFrom alias identifier ImportFrom alias Import alias Import alias Import alias Import alias ClassDef bases NameLoad body Expr Str Pass decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str TryExcept body Assign NameStore Str Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Raise Call NameLoad Call AttributeLoad NameLoad attr NameLoad ExceptHandler type AttributeLoad NameLoad attr name NameStore body Raise Call NameLoad Call AttributeLoad NameLoad attr NameLoad TryExcept body With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad handlers ExceptHandler type NameLoad name NameStore body Raise Call NameLoad Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call NameLoad Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore ListLoad Assign NameStore Call NameLoad NameLoad For NameStore Call AttributeLoad NameLoad attr Str body TryExcept body Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str attr Str Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str attr Str Assign NameStore Call AttributeLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str attr Str Assign NameStore Call AttributeLoad NameLoad attr Str Str handlers ExceptHandler type NameLoad body Continue TryExcept body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad keyword AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Continue Assign NameStore Dict Str Str Str Str NameLoad NameLoad NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr Str Call NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str NameLoad With Call NameLoad NameLoad Str NameStore body Assign NameStore Call AttributeLoad NameLoad attr Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str If UnaryOpNot NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad BinOpMod Str NameLoad If UnaryOpNot NameLoad body Assign NameStore BinOpMod Str NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr keyword Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If NameLoad body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return Call AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword Str keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword NameLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword ListLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword NameLoad keyword Str keyword ListLoad keyword Str Expr Call AttributeLoad NameLoad attr Str keyword Str keyword NameLoad keyword ListLoad keyword Str Return TupleLoad NameLoad Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Assign NameStore ListLoad If NameLoad body TryExcept body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad handlers ExceptHandler type NameLoad body Expr Call AttributeLoad NameLoad attr Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore ListLoad If NameLoad body AugAssignAdd NameStore NameLoad For NameStore NameLoad body If NameLoad body For NameStore NameLoad body AugAssignAdd NameStore Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad NameLoad NameLoad orelse AugAssignAdd NameStore Call AttributeLoad NameLoad attr BinOpMod Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Num For NameStore NameLoad body If CompareIn Call AttributeLoad NameLoad attr Str NameLoad body Continue Expr Call AttributeLoad NameLoad attr Str NameLoad Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Assign TupleStore NameStore NameStore Call AttributeLoad Call AttributeLoad NameLoad attr Str attr Call AttributeLoad NameLoad attr Str NameLoad If CompareGt NameLoad Num body Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad Call AttributeLoad NameLoad attr Str AugAssignAdd NameStore NameLoad Assign NameStore NameLoad Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign TupleStore NameStore NameStore Call NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Num If AttributeLoad NameLoad attr body TryExcept body Expr Call NameLoad AttributeLoad NameLoad attr handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Num If BoolOpAnd UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Assign NameStore Num If BoolOpAnd UnaryOpNot NameLoad UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Assign NameStore Num If UnaryOpNot NameLoad body Assign NameStore Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Call NameLoad AttributeLoad NameLoad attr Assign NameStore Num For NameStore NameLoad body If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Continue Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareGt NameLoad Num body AugAssignAdd NameStore NameLoad Expr Call AttributeLoad NameLoad attr Str NameLoad NameLoad If BoolOpAnd CompareGt NameLoad Num AttributeLoad NameLoad attr body Expr Call NameLoad NameLoad NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareGt NameLoad Num body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign NameStore Num Return NameLoad decorator_list If CompareEq NameLoad Str body Expr Call AttributeLoad NameLoad attr Call NameLoad
N/A N/A This script applies a set of regular expressions onto a set of files
to automatically identify and fix typographical errors.
 N/A argparse N/A logging N/A os N/A shutil N/A sys six.moves.urllib error urlerr six.moves.urllib request urlreq bs4 BeautifulSoup N/A glob2 N/A regex N/A six N/A yaml DownloadRetfListingFailed N/A Exception N/A N/A Exception for failed downloads of the RETF listing.

    Exception will be raised when the download of the RETF
    listing failed or the destination file could not be written.

     N/A N/A download_listing N/A N/A dest N/A N/A N/A Download the latest RETF listing from Wikipedia. N/A logger N/A N/A logging getLogger retf N/A N/A N/A url https://en.wikipedia.org/wiki/Wikipedia:AutoWikiBrowser/Typos?action=raw N/A N/A N/A logger debug Downloading latest RETF listing from %s into %s. url dest N/A response N/A N/A urlreq urlopen url N/A data N/A N/A response read N/A N/A N/A logger info Downloading latest RETF listing from %s succeeded. url N/A N/A N/A N/A urlerr HTTPError N/A ex N/A N/A N/A DownloadRetfListingFailed N/A N/A six text_type ex N/A N/A N/A urlerr URLError N/A ex N/A N/A N/A DownloadRetfListingFailed N/A N/A six text_type ex N/A N/A N/A N/A open dest w+ write N/A N/A N/A N/A write write data N/A N/A N/A logger info Writing RETF listing to file %s succeeded. dest N/A N/A N/A IOError N/A ex N/A N/A N/A DownloadRetfListingFailed N/A N/A six text_type ex N/A soupify_listing N/A N/A src N/A N/A N/A Parse a RETF listing. N/A N/A BeautifulSoup N/A open src N/A generate_listing N/A N/A src N/A N/A N/A Compile all regular expressions in a RETF listing. N/A logger N/A N/A logging getLogger retf N/A result N/A N/A soup N/A soupify_listing src N/A typo N/A N/A soup findAll typo N/A N/A N/A N/A word N/A N/A N/A N/A N/A typo attrs get word encode utf8 N/A find N/A N/A N/A N/A N/A typo attrs get find encode utf8 N/A replace N/A N/A N/A N/A N/A typo attrs get replace encode utf8 N/A replace N/A N/A replace replace $ \ N/A N/A N/A AttributeError N/A N/A N/A N/A N/A N/A N/A logger debug Compiling regular expression: %s. find N/A compiled N/A N/A regex compile find flags N/A regex V1 N/A N/A N/A Exception N/A N/A N/A N/A logger error Compilation of regular expression %f failed. find N/A N/A entry N/A description find replace regex word find replace compiled N/A N/A N/A result append entry N/A N/A N/A logger debug Compiled %d regular expression(s). N/A len result N/A result N/A load_text_from_file N/A N/A src N/A N/A N/A Load content from a file. N/A logger N/A N/A logging getLogger retf N/A N/A N/A logger debug Loading text from file %s. src N/A N/A open src rb fpointer N/A N/A text N/A N/A fpointer read N/A text N/A write_text_to_file N/A N/A dest text no_backup in_place N/A N/A N/A Write content into a file. N/A logger N/A N/A logging getLogger retf N/A N/A no_backup N/A N/A N/A N/A logger debug Copying %s to backup file %s.orig. dest dest N/A N/A N/A shutil copy2 dest N/A %s.orig dest N/A N/A in_place N/A N/A dest N/A %s.retf dest N/A N/A N/A logger debug Writing text to file %s. dest N/A N/A open dest wb fpointer N/A N/A N/A N/A fpointer write text N/A initialize_logging N/A N/A debug less_verbose N/A N/A N/A Initialize the Logger. N/A logger N/A N/A logging getLogger name retf N/A formatter N/A N/A logging Formatter %(asctime)s %(levelname)-8s %(message)s N/A handler N/A N/A logging StreamHandler N/A N/A N/A handler setFormatter formatter N/A N/A N/A logger addHandler handler N/A N/A N/A logger setLevel N/A logging INFO N/A less_verbose N/A N/A N/A N/A logger setLevel N/A logging WARN N/A debug N/A N/A N/A N/A logger setLevel N/A logging DEBUG N/A N/A N/A logging getLogger retf N/A parse_command_line_arguments N/A N/A N/A N/A N/A Parse the command line arguments. N/A parser N/A N/A argparse ArgumentParser N/A N/A N/A parser add_argument --debug help Print debugging messages. action store_true default False N/A N/A N/A parser add_argument --download help Download the latest RETF listing. action store_true default False N/A N/A N/A parser add_argument --less-verbose help Be less verbose. action store_true default False N/A N/A N/A parser add_argument --no-backup help Don't backup files. action store_true default False N/A N/A N/A parser add_argument --in-place help Resolve found errors in place. action store_true default False N/A N/A N/A parser add_argument --write-changes action store_true default False help Write resolved findings back to files. N/A N/A N/A parser add_argument --disabled type str default None help File containing the disabled rules. N/A N/A N/A parser add_argument --listing help File containing the RETF listing. type str default N/A N/A N/A os path join N/A N/A N/A os path dirname N/A N/A N/A os path realpath __file__ retf.lst N/A N/A N/A parser add_argument --path type str nargs * default N/A help Path(s) that should be checked. N/A N/A N/A parser add_argument --extension type str nargs * default N/A help Only check files with specified extension(s). N/A N/A N/A parser add_argument --file nargs * type str default N/A help File(s) to check for typographical errors. N/A N/A parser N/A N/A parser parse_args N/A load_disabled_rules N/A N/A src N/A N/A N/A Load disabled rules from YAML file. N/A logger N/A N/A logging getLogger retf N/A listing N/A N/A src N/A N/A N/A N/A listing N/A N/A yaml safe_load N/A open src N/A rule listing N/A N/A N/A N/A logger debug Rule '%s' is disabled. rule N/A N/A N/A IOError N/A N/A N/A N/A logger error loading disabled rules from file %s failed src N/A listing N/A get_file_listing N/A N/A paths files extensions N/A N/A N/A Generate listing with all files that should be check. N/A result N/A N/A files N/A N/A result files N/A path paths N/A N/A extensions N/A N/A extension extensions N/A N/A result N/A N/A glob2 glob N/A %s/**/*.%s N/A path extension N/A N/A result N/A N/A glob2 glob N/A %s/**/* path N/A result N/A check_file N/A N/A src rules disabled N/A N/A N/A Applies a set of rules on a file. N/A logger N/A N/A logging getLogger retf N/A N/A N/A logger info Checking file %s for typographical errors. src N/A content N/A load_text_from_file src N/A findings 0 N/A rule rules N/A N/A N/A N/A N/A rule get description disabled N/A N/A N/A N/A N/A logger debug %s: checking rule '%s'. src N/A N/A rule get description N/A N/A N/A logger debug N/A N/A rule get find N/A N/A newcontent count N/A N/A N/A N/A rule get regex subn N/A N/A rule get replace content N/A N/A count 0 N/A N/A N/A N/A logger warning %d match(s) in file %s : %s. count src N/A N/A rule get description N/A findings count N/A content newcontent N/A N/A findings content N/A main N/A N/A N/A N/A N/A Entry point for this script. N/A N/A parser args N/A parse_command_line_arguments N/A logger N/A initialize_logging N/A args debug N/A args less_verbose N/A result 0 N/A N/A args download N/A N/A N/A N/A N/A download_listing N/A args listing N/A N/A N/A DownloadRetfListingFailed N/A ex N/A N/A N/A N/A logger error Downloading latest RETF listing failed: %s. ex N/A result 1 N/A N/A N/A N/A args path N/A N/A args file N/A N/A args download N/A N/A N/A N/A parser print_help N/A result 2 N/A N/A N/A result N/A N/A N/A N/A os path isfile N/A args listing N/A N/A N/A N/A logger error RETF listing not found at %s. N/A args listing N/A N/A N/A logger info Please download the RETF listing first by using the parameter --download. N/A result 1 N/A N/A result N/A N/A files N/A get_file_listing N/A args path N/A args file N/A args extension N/A rules N/A generate_listing N/A args listing N/A disabled N/A load_disabled_rules N/A args disabled N/A all_findings 0 N/A check files N/A N/A N/A N/A N/A N/A os path isfile check N/A N/A N/A N/A findings content N/A check_file check rules disabled N/A N/A findings 0 N/A N/A all_findings findings N/A N/A N/A logger warning %s finding(s) in file %s. findings check N/A N/A N/A findings 0 N/A args write_changes N/A N/A N/A write_text_to_file check content N/A args no_backup N/A args in_place N/A N/A all_findings 0 N/A N/A N/A N/A logger warning %s finding(s) in all checked files. all_findings N/A result 1 N/A result N/A N/A N/A __name__ __main__ N/A N/A N/A N/A sys exit N/A main