Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatted code with black=24.3.0 in codebase #3242

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: pyupgrade
args: ["--py38-plus"]
- repo: https://github.com/ambv/black
rev: 23.12.0
rev: 24.3.0
hooks:
- id: black
- repo: local
Expand Down
8 changes: 3 additions & 5 deletions nltk/corpus/reader/framenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,10 @@ def _pretty_frame(frame):


class FramenetError(Exception):

"""An exception class for framenet-related errors."""


class AttrDict(dict):

"""A class that wraps a dict and allows accessing the keys of the
dict as if they were attributes. Taken from here:
https://stackoverflow.com/a/14620633/8879
Expand Down Expand Up @@ -1248,9 +1246,9 @@ def _buildluindex(self):
self.abspath("luIndex.xml"), "luIndex/lu", self._handle_elt
) as view:
for lu in view:
self._lu_idx[
lu["ID"]
] = lu # populate with LU index entries. if any of these
self._lu_idx[lu["ID"]] = (
lu # populate with LU index entries. if any of these
)
# are looked up they will be replaced by full LU objects.

def _buildrelationindex(self):
Expand Down
1 change: 1 addition & 0 deletions nltk/corpus/reader/mte.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
A reader for corpora whose documents are in MTE format.
"""

import os
import re
from functools import reduce
Expand Down
1 change: 0 additions & 1 deletion nltk/corpus/reader/plaintext.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def __init__(self, *args, **kwargs):


class EuroparlCorpusReader(PlaintextCorpusReader):

"""
Reader for Europarl corpora that consist of plaintext documents.
Documents are divided into chapters instead of paragraphs as
Expand Down
1 change: 0 additions & 1 deletion nltk/lazyimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class LazyModule:

"""Lazy module class.

Lazy modules are imported into the given namespaces whenever a
Expand Down
1 change: 0 additions & 1 deletion nltk/parse/stanford.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ def _make_tree(self, result):


class StanfordDependencyParser(GenericStanfordParser):

"""
>>> dep_parser=StanfordDependencyParser(
... model_path="edu/stanford/nlp/models/lexparser/englishPCFG.ser.gz"
Expand Down
1 change: 0 additions & 1 deletion nltk/parse/transitionparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ def shift(self, conf):


class TransitionParser(ParserI):

"""
Class for transition based parser. Implement 2 algorithms which are "arc-standard" and "arc-eager"
"""
Expand Down
8 changes: 5 additions & 3 deletions nltk/stem/porter.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,11 @@ def original_condition(stem):
(
"y",
"i",
nltk_condition
if self.mode == self.NLTK_EXTENSIONS
else original_condition,
(
nltk_condition
if self.mode == self.NLTK_EXTENSIONS
else original_condition
),
)
],
)
Expand Down
18 changes: 0 additions & 18 deletions nltk/stem/snowball.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@


class SnowballStemmer(StemmerI):

"""
Snowball Stemmer

Expand Down Expand Up @@ -114,7 +113,6 @@ def stem(self, token):


class _LanguageSpecificStemmer(StemmerI):

"""
This helper subclass offers the possibility
to invoke a specific stemmer directly.
Expand Down Expand Up @@ -172,7 +170,6 @@ def __init__(self, ignore_stopwords=False):


class _ScandinavianStemmer(_LanguageSpecificStemmer):

"""
This subclass encapsulates a method for defining the string region R1.
It is used by the Danish, Norwegian, and Swedish stemmer.
Expand Down Expand Up @@ -215,7 +212,6 @@ def _r1_scandinavian(self, word, vowels):


class _StandardStemmer(_LanguageSpecificStemmer):

"""
This subclass encapsulates two methods for defining the standard versions
of the string regions R1, R2, and RV.
Expand Down Expand Up @@ -910,7 +906,6 @@ def stem(self, word):


class DanishStemmer(_ScandinavianStemmer):

"""
The Danish Snowball stemmer.

Expand Down Expand Up @@ -1072,7 +1067,6 @@ def stem(self, word):


class DutchStemmer(_StandardStemmer):

"""
The Dutch Snowball stemmer.

Expand Down Expand Up @@ -1264,7 +1258,6 @@ def stem(self, word):


class EnglishStemmer(_StandardStemmer):

"""
The English Snowball stemmer.

Expand Down Expand Up @@ -1781,7 +1774,6 @@ def stem(self, word):


class FinnishStemmer(_StandardStemmer):

"""
The Finnish Snowball stemmer.

Expand Down Expand Up @@ -2124,7 +2116,6 @@ def stem(self, word):


class FrenchStemmer(_StandardStemmer):

"""
The French Snowball stemmer.

Expand Down Expand Up @@ -2618,7 +2609,6 @@ def __rv_french(self, word, vowels):


class GermanStemmer(_StandardStemmer):

"""
The German Snowball stemmer.

Expand Down Expand Up @@ -2774,7 +2764,6 @@ def stem(self, word):


class HungarianStemmer(_LanguageSpecificStemmer):

"""
The Hungarian Snowball stemmer.

Expand Down Expand Up @@ -3187,7 +3176,6 @@ def __r1_hungarian(self, word, vowels, digraphs):


class ItalianStemmer(_StandardStemmer):

"""
The Italian Snowball stemmer.

Expand Down Expand Up @@ -3563,7 +3551,6 @@ def stem(self, word):


class NorwegianStemmer(_ScandinavianStemmer):

"""
The Norwegian Snowball stemmer.

Expand Down Expand Up @@ -3685,7 +3672,6 @@ def stem(self, word):


class PortugueseStemmer(_StandardStemmer):

"""
The Portuguese Snowball stemmer.

Expand Down Expand Up @@ -4031,7 +4017,6 @@ def stem(self, word):


class RomanianStemmer(_StandardStemmer):

"""
The Romanian Snowball stemmer.

Expand Down Expand Up @@ -4513,7 +4498,6 @@ def stem(self, word):


class RussianStemmer(_LanguageSpecificStemmer):

"""
The Russian Snowball stemmer.

Expand Down Expand Up @@ -5354,7 +5338,6 @@ def __roman_to_cyrillic(self, word):


class SpanishStemmer(_StandardStemmer):

"""
The Spanish Snowball stemmer.

Expand Down Expand Up @@ -5752,7 +5735,6 @@ def __replace_accented(self, word):


class SwedishStemmer(_ScandinavianStemmer):

"""
The Swedish Snowball stemmer.

Expand Down
2 changes: 0 additions & 2 deletions nltk/tag/perceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

@jsontags.register_tag
class AveragedPerceptron:

"""An averaged perceptron, as implemented by Matthew Honnibal.

See more implementation details here:
Expand Down Expand Up @@ -121,7 +120,6 @@ def decode_json_obj(cls, obj):

@jsontags.register_tag
class PerceptronTagger(TaggerI):

"""
Greedy Averaged Perceptron tagger, as implemented by Matthew Honnibal.
See more implementation details here:
Expand Down
8 changes: 5 additions & 3 deletions nltk/tbl/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,11 @@ def nonempty_powerset(xs): # xs is a list
combrange = (
(1, len(xs) + 1)
if k is None
else (k, k + 1) # n over 1 .. n over n (all non-empty combinations)
if isinstance(k, int)
else (k[0], k[1] + 1) # n over k (only
else (
(k, k + 1) # n over 1 .. n over n (all non-empty combinations)
if isinstance(k, int)
else (k[0], k[1] + 1)
) # n over k (only
) # n over k1, n over k1+1... n over k2
return it.chain.from_iterable(
it.combinations(xs, r) for r in range(*combrange)
Expand Down
1 change: 1 addition & 0 deletions nltk/test/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
test harness.

"""

import doctest
import os.path
import unittest
Expand Down