mirror of
https://github.com/react/react-native.git
synced 2026-09-28 13:23:09 +08:00
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
32 lines
925 B
Python
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}"
|