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

deprecate: deprecate get and set node methods #2900

Merged
merged 6 commits into from Dec 6, 2021
Merged
Changes from 4 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
7 changes: 4 additions & 3 deletions nltk/tree/tree.py
Expand Up @@ -6,6 +6,7 @@
# Peter Ljunglöf <peter.ljunglof@gu.se>
# Nathan Bodenstab <bodenstab@cslu.ogi.edu> (tree transforms)
# Eric Kafe <kafe.eric@gmail.com> (Tree.fromlist())
# Mohaned mashaly<mohaned.mashaly12@gmail.com> (Deprecating methods)
# URL: <https://www.nltk.org/>
# For license information, see LICENSE.TXT

Expand All @@ -18,6 +19,7 @@
import sys

from nltk.grammar import Nonterminal, Production
from nltk.internals import deprecated

######################################################################
## Trees
Expand Down Expand Up @@ -200,14 +202,13 @@ def __delitem__(self, index):
# ////////////////////////////////////////////////////////////
# Basic tree operations
# ////////////////////////////////////////////////////////////

@deprecated("_get_node() is deprecated, use label() instead")
def _get_node(self):
"""Outdated method to access the node value; use the label() method instead."""
raise NotImplementedError("Use label() to access a node label.")

@deprecated("_set_node() is deprecated, use set_label() instead")
def _set_node(self, value):
"""Outdated method to set the node value; use the set_label() method instead."""
raise NotImplementedError("Use set_label() method to set a node label.")

node = property(_get_node, _set_node)

Expand Down