Skip to content

Commit

Permalink
add deprecation warning for Emitter.indention
Browse files Browse the repository at this point in the history
  • Loading branch information
nitzmahone committed Aug 29, 2023
1 parent 0067beb commit 3831f83
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/yaml/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@

__all__ = ['Emitter', 'EmitterError']

import warnings

from .error import YAMLError
from .events import *


class EmitterError(YAMLError):
pass


class ScalarAnalysis:
def __init__(self, scalar, empty, multiline,
allow_flow_plain, allow_block_plain,
Expand All @@ -28,6 +32,7 @@ def __init__(self, scalar, empty, multiline,
self.allow_double_quoted = allow_double_quoted
self.allow_block = allow_block


class Emitter:

DEFAULT_TAG_PREFIXES = {
Expand Down Expand Up @@ -103,6 +108,17 @@ def __init__(self, stream, canonical=None, indent=None, width=None,
self.analysis = None
self.style = None

# backward-compatibility
@property
def indention(self):
warnings.warn("Emitter.indention attribute is deprecated and will be removed in a future release; use Emitter.indentation instead", DeprecationWarning)
return self.indentation

@indention.setter
def indention(self, value):
warnings.warn("Emitter.indention attribute is deprecated and will be removed in a future release; use Emitter.indentation instead", DeprecationWarning)
self.indentation = value

def dispose(self):
# Reset the state attributes (to clear self-references)
self.states = []
Expand Down

0 comments on commit 3831f83

Please sign in to comment.