Skip to content

Commit

Permalink
style: apply linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytelife26 committed Jul 6, 2021
1 parent 5509ccd commit 4fa2c3d
Show file tree
Hide file tree
Showing 121 changed files with 267 additions and 242 deletions.
22 changes: 20 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion proselint/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# flake8: noqa

"""Proselint applies advice from great writers to your writing."""
from . import tools

__all__ = ('tools')
__all__ = ("tools")
2 changes: 1 addition & 1 deletion proselint/checks/cliches/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

u"""Cliches are cliché."""

from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/dates_times/am_pm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
---
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
3 changes: 2 additions & 1 deletion proselint/checks/dates_times/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
Dates.
"""
from proselint.tools import existence_check, memoize
import calendar

from proselint.tools import existence_check, memoize


@memoize
def check_decade_apostrophes_short(text):
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/jargon/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Cliches are cliché.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/lgbtq/offensive_terms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Associated Press have also adopted this style guide.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
12 changes: 6 additions & 6 deletions proselint/checks/links/broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
Check that links are not broken.
"""
from proselint.tools import memoize
from future import standard_library
import re
try:
import urllib.request as urllib_request # for Python 3
except ImportError:
import urllib2 as urllib_request # for Python 2
import urllib.request as urllib_request # for Python 3
from socket import error as SocketError

from future import standard_library

from proselint.tools import memoize

standard_library.install_aliases()


Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/apologizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Points out excessive apologizing.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/but.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Paragraphs should not start with certain bad words.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/false_plurals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Using the incorrect form of the plural.
"""
from proselint.tools import memoize, preferred_forms_check, existence_check
from proselint.tools import existence_check, memoize, preferred_forms_check


@memoize
Expand Down
3 changes: 2 additions & 1 deletion proselint/checks/misc/greylist.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
"""
from proselint.tools import memoize
import re

from proselint.tools import memoize


@memoize
def check(text):
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/metadiscourse.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Points out metadiscourse.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/narcissism.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Points out academic narcissism.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/phrasal_adjectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Phrasal adjectives.
"""
from proselint.tools import existence_check, preferred_forms_check, memoize
from proselint.tools import existence_check, memoize, preferred_forms_check


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/scare_quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Points out misuse of scare quotes.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/misc/suddenly.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
anymore,” the “suddenly” substantially changes the way we think about the
shift in emotional calibration.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
3 changes: 2 additions & 1 deletion proselint/checks/misc/tense_present.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
Archaism.
"""
from proselint.tools import memoize
import re

from proselint.tools import memoize


@memoize
def check(text):
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/mixed_metaphors/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

"""Mixed metaphors."""

from proselint.tools import memoize, existence_check, preferred_forms_check
from proselint.tools import existence_check, memoize, preferred_forms_check


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/psychology/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Psychological and psychiatric terms to avoid.
"""
from proselint.tools import preferred_forms_check, existence_check, memoize
from proselint.tools import existence_check, memoize, preferred_forms_check


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/terms/venery.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Names for groups of animals.
"""
from proselint.tools import preferred_forms_check, memoize
from proselint.tools import memoize, preferred_forms_check


@memoize
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/typography/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
source_url: http://practicaltypography.com/
"""

from proselint.tools import memoize, existence_check, preferred_forms_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
4 changes: 2 additions & 2 deletions proselint/checks/uncomparables/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
One axiom of Standard Written English is that your reader is paying close
attention and expects you to have done the same.
"""
import re
from proselint.tools import existence_check, memoize
import itertools

from proselint.tools import existence_check, memoize


@memoize
def check(text):
Expand Down
2 changes: 1 addition & 1 deletion proselint/checks/weasel_words/very.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
delete it and the writing will be just as it should be.
"""
from proselint.tools import memoize, existence_check
from proselint.tools import existence_check, memoize


@memoize
Expand Down
19 changes: 7 additions & 12 deletions proselint/command_line.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
# -*- coding: utf-8 -*-

"""Command line utility for proselint."""
from __future__ import print_function
from __future__ import absolute_import
from builtins import str

from __future__ import absolute_import, print_function

import click
import os
from .tools import (
close_cache_shelves_after,
close_cache_shelves,
errors_to_json,
lint,
)
import shutil
import subprocess
import sys
from .version import __version__
import traceback
from builtins import str

import click

from .tools import (close_cache_shelves, close_cache_shelves_after,
errors_to_json, lint)
from .version import __version__

CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
base_url = "proselint.com/"
Expand Down
5 changes: 2 additions & 3 deletions proselint/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
"""Compute the lintscore on the corpus."""

from __future__ import print_function
from builtins import input
from builtins import int

import os
import subprocess
import re
import subprocess
from builtins import input, int

proselint_path = os.path.dirname(os.path.realpath(__file__))

Expand Down
26 changes: 13 additions & 13 deletions proselint/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

"""General-purpose tools shared across linting checks."""

from __future__ import print_function
from __future__ import unicode_literals
import sys
import traceback
import os
import shelve
import inspect
from __future__ import print_function, unicode_literals

import copy
import dbm
import functools
import re
import hashlib
import json
import importlib
import copy
import inspect
import json
import os
import re
import shelve
import sys
import traceback

import dbm
_cache_shelves = dict()
proselint_path = os.path.dirname(os.path.realpath(__file__))
home_dir = os.path.expanduser("~")
Expand All @@ -25,7 +25,7 @@

def close_cache_shelves():
"""Close previously opened cache shelves."""
for pth, cache in _cache_shelves.items():
for _, cache in _cache_shelves.items():
cache.close()
_cache_shelves.clear()

Expand Down Expand Up @@ -331,7 +331,7 @@ def preferred_forms_check(text, list, err, msg, ignore_case=True, offset=0,
def existence_check(text, list, err, msg, ignore_case=True,
str=False, max_errors=float("inf"), offset=0,
require_padding=True, dotall=False,
excluded_topics=None, exceptions=[], join=False):
excluded_topics=None, exceptions=(), join=False):
"""Build a checker that prohibits certain words or phrases."""
flags = 0

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ include = ["proselint", "demo.md", ".proselintrc"]
exclude = ["tests"]

[tool.poetry.dependencies]
python = "^3.6"
python = "^3.6.1"
click = "^8.0.0"
future = "^0.18.2"
six = "^1.15.0"
Expand All @@ -37,6 +37,7 @@ twine = "^3.4.1"
flake8 = "^3.9.2"
flake8-bugbear = "^21.4.3"
flake8-import-order = "^0.18.1"
isort = "^5.9.1"

[tool.poetry.scripts]
proselint = "proselint.command_line:proselint"
Expand Down
Loading

0 comments on commit 4fa2c3d

Please sign in to comment.