Files
Dawid Małecki 756203cb27 Split member definitions into smaller files (#56072)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56072

Changelog: [Internal]

Splits `member.py` into multiple smaller files, each containing single member definition.

Reviewed By: cipolleschi

Differential Revision: D96282653

fbshipit-source-id: 25956dccaf266bf2be5b216ba554991f1bb221b8
2026-03-18 09:29:02 -07:00

32 lines
925 B
Python

# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import annotations
from .base import Member, MemberKind, STORE_INITIALIZERS_IN_SNAPSHOT
class EnumMember(Member):
def __init__(self, name: str, value: str | None) -> None:
super().__init__(name, "public")
self.value: str | None = value
@property
def member_kind(self) -> MemberKind:
return MemberKind.CONSTANT
def to_string(
self,
indent: int = 0,
qualification: str | None = None,
hide_visibility: bool = False,
) -> str:
name = self._get_qualified_name(qualification)
if not STORE_INITIALIZERS_IN_SNAPSHOT or self.value is None:
return " " * indent + f"{name}"
return " " * indent + f"{name} = {self.value}"