Skip to content

Commit

Permalink
Compatibility w/Python 3.7.
Browse files Browse the repository at this point in the history
Positional-only arguments (PEP 570) were introduced with Python 3.8
  • Loading branch information
thvitt committed Jun 27, 2021
1 parent cdde7d8 commit 01d6c5d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion delta/corpus.py
Expand Up @@ -277,7 +277,7 @@ class Corpus(pd.DataFrame):

_metadata = ['metadata']

def __init__(self, source=None, /, *, subdir=None, file=None, corpus=None,
def __init__(self, source=None, *, subdir=None, file=None, corpus=None,
feature_generator=None,
document_describer=DefaultDocumentDescriber(),
metadata=None, **kwargs):
Expand All @@ -304,6 +304,8 @@ def __init__(self, source=None, /, *, subdir=None, file=None, corpus=None,
Args:
source: Positional variant of either subdir, file, or corpus
Keyword Args:
subdir (str): Path to a subdirectory containing the (unprocessed) corpus data.
file (str): Path to a CSV file containing the feature vectors.
corpus (pandas.DataFrame): A dataframe or :class:`Corpus` from which to create a new corpus, as a copy.
Expand All @@ -312,6 +314,10 @@ def __init__(self, source=None, /, *, subdir=None, file=None, corpus=None,
**kwargs: Additionally, if feature_generator is None and subdir is not None, you can pass FeatureGenerator
arguments and they will be used when instantiating the feature generator
Additional keyword arguments will be set in the metadata record of the new corpus.
Warning:
You should either use a single positional argument (source) or one of subdir, file, or corpus as
keyword arguments. In future versions, source will be positional-only.
"""
logger = logging.getLogger(__name__)

Expand Down

0 comments on commit 01d6c5d

Please sign in to comment.