Flutter Engine
The Flutter Engine
Functions | Variables
compatibility_helper Namespace Reference

Functions

def byte_str_decode (str_or_bytes)
 

Variables

string ENCODING = 'UTF-8'
 

Function Documentation

◆ byte_str_decode()

def compatibility_helper.byte_str_decode (   str_or_bytes)
Returns a string if given either a string or bytes.

  TODO: This function should be removed when the supported python
  version is only python 3.

  Args:
      str_or_bytes (string or bytes) we want to convert or return as
      the possible value changes depending on the version of python
      used.

Definition at line 13 of file compatibility_helper.py.

13def byte_str_decode(str_or_bytes):
14 """Returns a string if given either a string or bytes.
15
16 TODO: This function should be removed when the supported python
17 version is only python 3.
18
19 Args:
20 str_or_bytes (string or bytes) we want to convert or return as
21 the possible value changes depending on the version of python
22 used.
23 """
24 return str_or_bytes if isinstance(str_or_bytes, str) else str_or_bytes.decode(ENCODING)
def byte_str_decode(str_or_bytes)

Variable Documentation

◆ ENCODING

string compatibility_helper.ENCODING = 'UTF-8'

Definition at line 10 of file compatibility_helper.py.