Construct a string wrapper. This constructor accepts the following args: 1) A bare string. 2) A ComputedObject returning a string. Args: string: The string to wrap.
(self, string: _arg_types.String)
| 23 | _HAS_DYNAMIC_ATTRIBUTES = True |
| 24 | |
| 25 | def __init__(self, string: _arg_types.String): |
| 26 | """Construct a string wrapper. |
| 27 | |
| 28 | This constructor accepts the following args: |
| 29 | 1) A bare string. |
| 30 | 2) A ComputedObject returning a string. |
| 31 | |
| 32 | Args: |
| 33 | string: The string to wrap. |
| 34 | """ |
| 35 | self.initialize() |
| 36 | |
| 37 | if isinstance(string, str): |
| 38 | super().__init__(None, None) |
| 39 | self._string = string |
| 40 | elif isinstance(string, computedobject.ComputedObject): |
| 41 | if self.is_func_returning_same(string): |
| 42 | # If it's a call that's already returning a String, just cast. |
| 43 | super().__init__(string.func, string.args, string.varName) |
| 44 | else: |
| 45 | # Wrap some other ComputedObject. |
| 46 | super().__init__( |
| 47 | apifunction.ApiFunction(self.name()), {'input': string} |
| 48 | ) |
| 49 | self._string = None |
| 50 | else: |
| 51 | raise ee_exception.EEException( |
| 52 | f'Invalid argument specified for ee.String(): {string}') |
| 53 | |
| 54 | @classmethod |
| 55 | def initialize(cls) -> None: |
nothing calls this directly
no test coverage detected