Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#467)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.9.1](astral-sh/ruff-pre-commit@v0.5.6...v0.9.1)
- [github.com/python-jsonschema/check-jsonschema: 0.29.1 → 0.31.0](python-jsonschema/check-jsonschema@0.29.1...0.31.0)
- [github.com/asottile/blacken-docs: 1.18.0 → 1.19.1](adamchainz/blacken-docs@1.18.0...1.19.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Steven Loria <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and sloria authored Jan 13, 2025
1 parent e2b3add commit 05ce48f
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
rev: v0.9.1
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.29.1
rev: 0.31.0
hooks:
- id: check-github-workflows
- repo: https://github.com/asottile/blacken-docs
rev: 1.18.0
rev: 1.19.1
hooks:
- id: blacken-docs
additional_dependencies: [black==23.12.1]
9 changes: 4 additions & 5 deletions src/textblob/classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def _read_data(self, dataset, format=None):
format_class = formats.detect(dataset)
if not format_class:
raise FormatError(
"Could not automatically detect format for the given "
"data source."
"Could not automatically detect format for the given data source."
)
else:
registry = formats.get_registry()
Expand Down Expand Up @@ -230,7 +229,7 @@ def classifier(self):
return self.train()
except AttributeError as error: # nltk_class has not been defined
raise ValueError(
"NLTKClassifier must have a nltk_class" " variable that is not None."
"NLTKClassifier must have a nltk_class variable that is not None."
) from error

def train(self, *args, **kwargs):
Expand All @@ -251,7 +250,7 @@ def train(self, *args, **kwargs):
return self.classifier
except AttributeError as error:
raise ValueError(
"NLTKClassifier must have a nltk_class" " variable that is not None."
"NLTKClassifier must have a nltk_class variable that is not None."
) from error

def labels(self):
Expand Down Expand Up @@ -298,7 +297,7 @@ def update(self, new_data, *args, **kwargs):
)
except AttributeError as error: # Descendant has not defined nltk_class
raise ValueError(
"NLTKClassifier must have a nltk_class" " variable that is not None."
"NLTKClassifier must have a nltk_class variable that is not None."
) from error
return True

Expand Down
8 changes: 4 additions & 4 deletions tests/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def test_invalid_comparison(self):

def test_words(self):
blob = tb.TextBlob(
"Beautiful is better than ugly. " "Explicit is better than implicit."
"Beautiful is better than ugly. Explicit is better than implicit."
)
assert isinstance(blob.words, tb.WordList)
assert blob.words == tb.WordList(
Expand Down Expand Up @@ -418,7 +418,7 @@ def test_words_includes_apostrophes_in_contractions(self):

def test_pos_tags(self):
blob = tb.TextBlob(
"Simple is better than complex. " "Complex is better than complicated."
"Simple is better than complex. Complex is better than complicated."
)
assert blob.pos_tags == [
("Simple", "NN"),
Expand Down Expand Up @@ -664,7 +664,7 @@ def test_sentences_after_concatenation(self):

def test_sentiment(self):
positive = tb.TextBlob(
"This is the best, most amazing " "text-processing library ever!"
"This is the best, most amazing text-processing library ever!"
)
assert positive.sentiment[0] > 0.0
negative = tb.TextBlob("bad bad bitches that's my muthufuckin problem.")
Expand Down Expand Up @@ -722,7 +722,7 @@ def test_words_are_word_objects(self):

def test_words_have_pos_tags(self):
blob = tb.TextBlob(
"Simple is better than complex. " "Complex is better than complicated."
"Simple is better than complex. Complex is better than complicated."
)
first_word, first_tag = blob.pos_tags[0]
assert isinstance(first_word, tb.Word)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_classifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def setUp(self):
"They lost the ball",
"The game was intense",
"The goalkeeper catched the ball",
"The other team controlled the ball" "The ball went off the court",
"The other team controlled the ballThe ball went off the court",
"They had the ball for the whole game",
]

Expand Down
8 changes: 2 additions & 6 deletions tests/test_taggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@

class TestPatternTagger(unittest.TestCase):
def setUp(self):
self.text = (
"Simple is better than complex. " "Complex is better than complicated."
)
self.text = "Simple is better than complex. Complex is better than complicated."
self.tagger = textblob.taggers.PatternTagger()

def test_init(self):
Expand Down Expand Up @@ -43,9 +41,7 @@ def test_tag(self):
@pytest.mark.numpy
class TestNLTKTagger(unittest.TestCase):
def setUp(self):
self.text = (
"Simple is better than complex. " "Complex is better than complicated."
)
self.text = "Simple is better than complex. Complex is better than complicated."
self.tagger = textblob.taggers.NLTKTagger()

def test_tag(self):
Expand Down

0 comments on commit 05ce48f

Please sign in to comment.