How to use stop_sync method in Playwright Python

Best Python code snippet using playwright-python

Run Playwright Python automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

web.py

Source: web.py Github

copy
1import eel
2import os
3import sys
4import json
5import sims.acc as acc
6import sims.iracing as iracing
7import sims.ac as ac
8from external.phue import Bridge
9from external.modified.rgbxy import Converter
10
11
12# GUI Theme Customization
13GUI_COLOR_NO_FLAG = '#000000'
14GUI_COLOR_BLUE_FLAG = '#0D47A1'
15GUI_COLOR_YELLOW_FLAG = '#FFEB3B'
16GUI_COLOR_BLACK_FLAG = '#000000'
17GUI_COLOR_WHITE_FLAG = '#ffffff'
18GUI_COLOR_CHECKERED_FLAG = '#000000'
19GUI_COLOR_PENALTY_FLAG = '#b71c1c'
20GUI_COLOR_GREEN_FLAG = '#388E3C'
21GUI_COLOR_ORANGE_FLAG = '#FF6F00'
22
23SAVE_FILE_PATH = './prf-save.json'
24HUE_CONNECTION = {
25    'ip': '',
26    'lights': [],
27    'brightness': 255,
28    'sim': 'AC',
29    'colors': {
30        'No_Flag': '',
31        'Blue_Flag': GUI_COLOR_BLUE_FLAG,
32        'Yellow_Flag': GUI_COLOR_YELLOW_FLAG,
33        'Black_Flag': '',
34        'White_Flag': GUI_COLOR_WHITE_FLAG,
35        'Checkered_Flag': '',
36        'Penalty_Flag': GUI_COLOR_PENALTY_FLAG,
37        'Green_Flag': GUI_COLOR_GREEN_FLAG,
38        'Orange_Flag': GUI_COLOR_ORANGE_FLAG
39    },
40    'auto_sync': False
41}
42STOP_SYNC = True
43
44
45@eel.expose
46def init_bridge_connection():
47    load_hue_connection_from_file()
48    eel.mutate_connection_works(bridge_connection_works())
49    eel.mutate_hue_connection(HUE_CONNECTION)
50    eel.mutate_available_lights(get_lights_from_bridge(Bridge(HUE_CONNECTION['ip'])))
51    if HUE_CONNECTION['auto_sync']:
52        eel.mutate_live_sync_running(True)
53        start_sync()
54
55
56@eel.expose
57def connect(ip: str):
58    HUE_CONNECTION['ip'] = ip
59    save_hue_connection_to_file()
60    init_bridge_connection()
61
62
63@eel.expose
64def sync_and_save_hue_connection(hueConnection):
65    global HUE_CONNECTION
66    HUE_CONNECTION = hueConnection
67    save_hue_connection_to_file()
68
69
70@eel.expose
71def test_light(key: str):
72    color_hex = HUE_CONNECTION['colors'][key]
73    raise_color(color_hex)
74
75
76@eel.expose
77def start_sync():
78    global STOP_SYNC
79    if STOP_SYNC:
80        STOP_SYNC = False
81        while True:
82            if HUE_CONNECTION['sim'] == 'AC':
83                sync_ac_color()
84                eel.sleep(0.1)
85
86            if HUE_CONNECTION['sim'] == 'ACC':
87                sync_acc_color()
88                eel.sleep(0.1)
89
90            if HUE_CONNECTION['sim'] == 'iRacing':
91                sync_iracing_color()
92                eel.sleep(0.1)
93
94            if STOP_SYNC:
95                break
96
97
98@eel.expose
99def stop_sync():
100    global STOP_SYNC
101    STOP_SYNC = True
102
103
104def save_hue_connection_to_file():
105    save_file = open(SAVE_FILE_PATH, 'w')
106    json.dump(HUE_CONNECTION, save_file)
107
108
109def load_hue_connection_from_file():
110    try:
111        save_file = open(SAVE_FILE_PATH, 'r')
112        data = json.load(save_file)
113        HUE_CONNECTION['ip'] = data['ip']
114        HUE_CONNECTION['lights'] = data['lights']
115        HUE_CONNECTION['brightness'] = data['brightness']
116        HUE_CONNECTION['sim'] = data['sim'] or 'AC'
117        HUE_CONNECTION['colors'] = data['colors']
118        HUE_CONNECTION['auto_sync'] = data['auto_sync']
119    except (FileNotFoundError, KeyError) as error:
120        print(error)
121        HUE_CONNECTION['ip'] = ''
122        HUE_CONNECTION['lights'] = []
123        HUE_CONNECTION['brightness'] = 255
124        HUE_CONNECTION['sim'] = 'AC'
125        HUE_CONNECTION['colors'] = {
126            'No_Flag': '',
127            'Blue_Flag': GUI_COLOR_BLUE_FLAG,
128            'Yellow_Flag': GUI_COLOR_YELLOW_FLAG,
129            'Black_Flag': '',
130            'White_Flag': GUI_COLOR_WHITE_FLAG,
131            'Checkered_Flag': '',
132            'Penalty_Flag': GUI_COLOR_PENALTY_FLAG,
133            'Green_Flag': GUI_COLOR_GREEN_FLAG,
134            'Orange_Flag': GUI_COLOR_ORANGE_FLAG
135        }
136        HUE_CONNECTION['auto_sync'] = False
137
138
139def bridge_connection_works() -> bool:
140    if HUE_CONNECTION['ip'] == '':
141        return False
142    else:
143        try:
144            Bridge(HUE_CONNECTION['ip'])
145            return True
146        except:
147            return False
148
149
150def get_lights_from_bridge(bridge: Bridge) -> []:
151    light_options = []
152    for light in bridge.get_light_objects():
153        light_options.append(light.name)
154    return light_options
155
156
157def raise_color(color_hex: str):
158    if color_hex == '' or color_hex == '#000000':
159        for light in HUE_CONNECTION['lights']:
160            Bridge(HUE_CONNECTION['ip']).set_light(light, {'transitiontime': 0, 'on': False})
161    else:
162        converter = Converter()
163        color_xy = converter.hex_to_xy(color_hex.replace('#', ''))
164        for light in HUE_CONNECTION['lights']:
165            Bridge(HUE_CONNECTION['ip']).set_light(light, {'transitiontime': 0, 'on': True, 'bri': int(HUE_CONNECTION['brightness']),
166                                                           'xy': color_xy})
167
168
169def raise_ac_flag(flag: ac.ACFlagType):
170    if flag == ac.ACFlagType.AC_NO_FLAG:
171        raise_color(HUE_CONNECTION['colors']['No_Flag'])
172    if flag == ac.ACFlagType.AC_BLUE_FLAG:
173        raise_color(HUE_CONNECTION['colors']['Blue_Flag'])
174    if flag == ac.ACFlagType.AC_YELLOW_FLAG:
175        raise_color(HUE_CONNECTION['colors']['Yellow_Flag'])
176    if flag == ac.ACFlagType.AC_BLACK_FLAG:
177        raise_color(HUE_CONNECTION['colors']['Black_Flag'])
178    if flag == ac.ACFlagType.AC_WHITE_FLAG:
179        raise_color(HUE_CONNECTION['colors']['White_Flag'])
180    if flag == ac.ACFlagType.AC_CHECKERED_FLAG:
181        raise_color(HUE_CONNECTION['colors']['Checkered_Flag'])
182    if flag == ac.ACFlagType.AC_PENALTY_FLAG:
183        raise_color(HUE_CONNECTION['colors']['Penalty_Flag'])
184
185
186def raise_acc_flag(flag: acc.ACCFlagType):
187    if flag == acc.ACCFlagType.ACC_NO_FLAG:
188        raise_color(HUE_CONNECTION['colors']['No_Flag'])
189    if flag == acc.ACCFlagType.ACC_BLUE_FLAG:
190        raise_color(HUE_CONNECTION['colors']['Blue_Flag'])
191    if flag == acc.ACCFlagType.ACC_YELLOW_FLAG:
192        raise_color(HUE_CONNECTION['colors']['Yellow_Flag'])
193    if flag == acc.ACCFlagType.ACC_BLACK_FLAG:
194        raise_color(HUE_CONNECTION['colors']['Black_Flag'])
195    if flag == acc.ACCFlagType.ACC_WHITE_FLAG:
196        raise_color(HUE_CONNECTION['colors']['White_Flag'])
197    if flag == acc.ACCFlagType.ACC_CHECKERED_FLAG:
198        raise_color(HUE_CONNECTION['colors']['Checkered_Flag'])
199    if flag == acc.ACCFlagType.ACC_PENALTY_FLAG:
200        raise_color(HUE_CONNECTION['colors']['Penalty_Flag'])
201    if flag == acc.ACCFlagType.ACC_GREEN_FLAG:
202        raise_color(HUE_CONNECTION['colors']['Green_Flag'])
203    if flag == acc.ACCFlagType.ACC_ORANGE_FLAG:
204        raise_color(HUE_CONNECTION['colors']['Orange_Flag'])
205
206
207def raise_iracing_flag(flag: iracing.IRacingGUIFlagType):
208    if flag == iracing.IRacingGUIFlagType.IRACING_NO_FLAG:
209        raise_color(HUE_CONNECTION['colors']['No_Flag'])
210    if flag == iracing.IRacingGUIFlagType.IRACING_BLUE_FLAG:
211        raise_color(HUE_CONNECTION['colors']['Blue_Flag'])
212    if flag == iracing.IRacingGUIFlagType.IRACING_YELLOW_FLAG:
213        raise_color(HUE_CONNECTION['colors']['Yellow_Flag'])
214    if flag == iracing.IRacingGUIFlagType.IRACING_BLACK_FLAG:
215        raise_color(HUE_CONNECTION['colors']['Black_Flag'])
216    if flag == iracing.IRacingGUIFlagType.IRACING_WHITE_FLAG:
217        raise_color(HUE_CONNECTION['colors']['White_Flag'])
218    if flag == iracing.IRacingGUIFlagType.IRACING_CHEQUERED_FLAG:
219        raise_color(HUE_CONNECTION['colors']['Checkered_Flag'])
220    if flag == iracing.IRacingGUIFlagType.IRACING_RED_FLAG:
221        raise_color(HUE_CONNECTION['colors']['Penalty_Flag'])
222    if flag == iracing.IRacingGUIFlagType.IRACING_GREEN_FLAG:
223        raise_color(HUE_CONNECTION['colors']['Green_Flag'])
224    if flag == iracing.IRacingGUIFlagType.IRACING_MEATBALL_FLAG:
225        raise_color(HUE_CONNECTION['colors']['Orange_Flag'])
226
227
228def sync_ac_color():
229    flag = ac.get_flag()
230    raise_ac_flag(flag)
231
232
233def sync_acc_color():
234    flag = acc.get_flag()
235    raise_acc_flag(flag)
236
237
238def sync_iracing_color():
239    flag = iracing.get_flag()
240    raise_iracing_flag(flag)
241
242
243def close_callback(route, websockets):
244    if not websockets:
245        stop_sync()
246        exit()
247
248
249def resource_path(rel_path):
250    """ Get absolute path to resource, works for dev and for PyInstaller """
251    try:
252        base_path = sys._MEIPASS
253    except Exception:
254        base_path = os.path.abspath(".")
255    return os.path.join(base_path, rel_path)
256
257
258if __name__ == '__main__':
259    eel.init('web')
260    eel.browsers.set_path('electron', resource_path('node_modules\electron\dist\electron.exe'))
261    eel.start('index.html', mode='electron')
262
Full Screen

base_transfomer.py

Source: base_transfomer.py Github

copy
1# -*- coding: utf-8 -*-
2
3import logging
4
5from ...models_access import (
6    OdooProductAccess, ProductSyncAccess, AmazonProductAccess
7)
8from ...model_names.shared_names import (
9    MODEL_NAME_FIELD, RECORD_ID_FIELD,
10)
11from ...model_names.product_sync import (
12    SYNC_TYPE_FIELD,
13    SYNC_DELETE, SYNC_CREATE, SYNC_DEACTIVATE,
14)
15from ..amazon_names import AMAZON_ID_FIELD, AMAZON_SKU_FIELD
16
17_logger = logging.getLogger(__name__)
18
19
20class BaseTransformer(object):
21    """
22    This is the base transform
23    """
24    def __init__(self, env):
25        self._odoo_product = OdooProductAccess(env)
26        self._product_sync = ProductSyncAccess(env)
27        self._amazon_product = AmazonProductAccess(env)
28        self._product = None
29
30    @staticmethod
31    def _raise_exception(field_name):
32        template = "Invalid {} value in Sync transformation"
33        raise ValueError(template.format(field_name))
34
35    @staticmethod
36    def _check_string(sync_value, field_name, field_value):
37        # add field to sync value, raise an exception if the value is invalid
38        if field_value:
39            field_value = field_value.strip()
40            if field_value:
41                sync_value[field_name] = field_value
42                return
43
44        # otherwise raise an exception for required field
45        BaseTransformer._raise_exception(field_name)
46
47    @staticmethod
48    def _add_string(sync_value, field_name, field_value):
49        # add valid field value to sync value
50        if field_value:
51            field_value = field_value.strip()
52            if field_value:
53                sync_value[field_name] = field_value
54
55    @staticmethod
56    def _remove_syncs(sync_ops, removing_ops):
57        for sync_op in removing_ops:
58            sync_ops = sync_ops - sync_op
59        return sync_ops
60
61    def _merge_others(self, sync_op, sync_ops):
62        """
63        This is stub that to be implement in a child class if
64        it needs to do other work
65        """
66        pass
67
68    # the default implementation, update transform should combine values
69    def _check_redundant(self, sync_ops):
70        _logger.debug("check and remove redundant syncs.")
71        processed = set()
72        redundant = []
73        for sync_op in sync_ops:
74            sync_key = (sync_op[MODEL_NAME_FIELD], sync_op[RECORD_ID_FIELD])
75            if sync_key in processed:
76                self._product_sync.set_sync_redundant(sync_op)
77                redundant.append(sync_op)
78            else:
79                processed.add(sync_key)
80                # a hook method that might be implemented in a subclass
81                self._merge_others(sync_op, sync_ops)
82
83        _logger.debug("Found {} redundant syncs.".format(len(redundant)))
84        return BaseTransformer._remove_syncs(sync_ops, redundant)
85
86    def _convert_sync(self, sync_op):
87        """
88        To be called and extended in subclass to convert more fields
89        """
90        sync_value = {AMAZON_ID_FIELD: sync_op.id}
91        sku = OdooProductAccess.get_sku(self._product)
92        BaseTransformer._check_string(sync_value, AMAZON_SKU_FIELD, sku)
93        return sync_value
94
95    def _check_stop(self, sync_op):
96        stop_sync = False
97        self._product = self._odoo_product.get_existed_product(sync_op)
98        # for all but delete, we want to make sure the product exists
99        # no need to check Amazon Product table because both
100        # waiting syncs are checked before switch to new
101        if sync_op[SYNC_TYPE_FIELD] != SYNC_DELETE:
102            if self._product:
103                if self._odoo_product.is_sync_active_product(
104                        self._product):
105                    # may be unnecessary but does not hurt
106                    if sync_op[SYNC_TYPE_FIELD] == SYNC_DEACTIVATE:
107                        stop_sync = True
108                else:
109                    if sync_op[SYNC_TYPE_FIELD] != SYNC_DEACTIVATE:
110                        stop_sync = True
111
112            else:
113                stop_sync = True
114        return stop_sync
115
116    def _transform_sync(self, sync_op, invalid_ops, sync_values):
117        if self._check_stop(sync_op):
118            log_template = "Product not found or sync disabled " \
119                           "for sync id {0}. Skip it."
120            _logger.debug(log_template.format(sync_op.id))
121            ProductSyncAccess.set_sync_no_product(sync_op)
122            invalid_ops.append(sync_op)
123        else:
124            sync_value = self._convert_sync(sync_op)
125            if sync_value:
126                sync_values.append(sync_value)
127            else:
128                log_template = "Sync id {0} has empty value. Skip it."
129                _logger.debug(log_template.format(sync_op.id))
130                ProductSyncAccess.update_sync_new_empty_value(sync_op)
131                invalid_ops.append(sync_op)
132
133    def transform(self, sync_ops):
134        # we change sync_ops record set because making a copy
135        # creates a new record set that is saved in table.
136        sync_ops = self._check_redundant(sync_ops)
137
138        sync_values = []
139        invalid_ops = []
140        for sync_op in sync_ops:
141            try:
142                self._transform_sync(sync_op, invalid_ops, sync_values)
143                # some pending write syncs or newly-switched new
144                # write syncs are made redundant by delete and create
145                if sync_op[SYNC_TYPE_FIELD] in [SYNC_CREATE, SYNC_DELETE]:
146                    self._product_sync.find_set_redundant(sync_op)
147            except Exception as ex:
148                log_template = "Sync transform error for sync id {0}  " \
149                               "Exception: {1}."
150                _logger.debug(log_template.format(sync_op.id, ex.message))
151
152                ProductSyncAccess.update_sync_new_exception(sync_op, ex)
153                invalid_ops.append(sync_op)
154
155        sync_ops = BaseTransformer._remove_syncs(sync_ops, invalid_ops)
156
157        assert(len(sync_ops) == len(sync_values))
158        return sync_ops, sync_values
159
Full Screen

team_common.py

Source: team_common.py Github

copy
1# -*- coding: utf-8 -*-
2# Auto-generated by Stone, do not modify.
3# @generated
4# flake8: noqa
5# pylint: skip-file
6from __future__ import unicode_literals
7from stone.backends.python_rsrc import stone_base as bb
8from stone.backends.python_rsrc import stone_validators as bv
9
10from dropbox import common
11
12class GroupManagementType(bb.Union):
13    """
14    The group type determines how a group is managed.
15
16    This class acts as a tagged union. Only one of the ``is_*`` methods will
17    return true. To get the associated value of a tag (if one exists), use the
18    corresponding ``get_*`` method.
19
20    :ivar team_common.GroupManagementType.user_managed: A group which is managed
21        by selected users.
22    :ivar team_common.GroupManagementType.company_managed: A group which is
23        managed by team admins only.
24    :ivar team_common.GroupManagementType.system_managed: A group which is
25        managed automatically by Dropbox.
26    """
27
28    _catch_all = 'other'
29    # Attribute is overwritten below the class definition
30    user_managed = None
31    # Attribute is overwritten below the class definition
32    company_managed = None
33    # Attribute is overwritten below the class definition
34    system_managed = None
35    # Attribute is overwritten below the class definition
36    other = None
37
38    def is_user_managed(self):
39        """
40        Check if the union tag is ``user_managed``.
41
42        :rtype: bool
43        """
44        return self._tag == 'user_managed'
45
46    def is_company_managed(self):
47        """
48        Check if the union tag is ``company_managed``.
49
50        :rtype: bool
51        """
52        return self._tag == 'company_managed'
53
54    def is_system_managed(self):
55        """
56        Check if the union tag is ``system_managed``.
57
58        :rtype: bool
59        """
60        return self._tag == 'system_managed'
61
62    def is_other(self):
63        """
64        Check if the union tag is ``other``.
65
66        :rtype: bool
67        """
68        return self._tag == 'other'
69
70    def _process_custom_annotations(self, annotation_type, field_path, processor):
71        super(GroupManagementType, self)._process_custom_annotations(annotation_type, field_path, processor)
72
73GroupManagementType_validator = bv.Union(GroupManagementType)
74
75class GroupSummary(bb.Struct):
76    """
77    Information about a group.
78
79    :ivar team_common.GroupSummary.group_external_id: External ID of group. This
80        is an arbitrary ID that an admin can attach to a group.
81    :ivar team_common.GroupSummary.member_count: The number of members in the
82        group.
83    :ivar team_common.GroupSummary.group_management_type: Who is allowed to
84        manage the group.
85    """
86
87    __slots__ = [
88        '_group_name_value',
89        '_group_id_value',
90        '_group_external_id_value',
91        '_member_count_value',
92        '_group_management_type_value',
93    ]
94
95    _has_required_fields = True
96
97    def __init__(self,
98                 group_name=None,
99                 group_id=None,
100                 group_management_type=None,
101                 group_external_id=None,
102                 member_count=None):
103        self._group_name_value = bb.NOT_SET
104        self._group_id_value = bb.NOT_SET
105        self._group_external_id_value = bb.NOT_SET
106        self._member_count_value = bb.NOT_SET
107        self._group_management_type_value = bb.NOT_SET
108        if group_name is not None:
109            self.group_name = group_name
110        if group_id is not None:
111            self.group_id = group_id
112        if group_external_id is not None:
113            self.group_external_id = group_external_id
114        if member_count is not None:
115            self.member_count = member_count
116        if group_management_type is not None:
117            self.group_management_type = group_management_type
118
119    # Instance attribute type: str (validator is set below)
120    group_name = bb.Attribute("group_name")
121
122    # Instance attribute type: str (validator is set below)
123    group_id = bb.Attribute("group_id")
124
125    # Instance attribute type: str (validator is set below)
126    group_external_id = bb.Attribute("group_external_id", nullable=True)
127
128    # Instance attribute type: int (validator is set below)
129    member_count = bb.Attribute("member_count", nullable=True)
130
131    # Instance attribute type: GroupManagementType (validator is set below)
132    group_management_type = bb.Attribute("group_management_type", user_defined=True)
133
134    def _process_custom_annotations(self, annotation_type, field_path, processor):
135        super(GroupSummary, self)._process_custom_annotations(annotation_type, field_path, processor)
136
137GroupSummary_validator = bv.Struct(GroupSummary)
138
139class GroupType(bb.Union):
140    """
141    The group type determines how a group is created and managed.
142
143    This class acts as a tagged union. Only one of the ``is_*`` methods will
144    return true. To get the associated value of a tag (if one exists), use the
145    corresponding ``get_*`` method.
146
147    :ivar team_common.GroupType.team: A group to which team members are
148        automatically added. Applicable to `team folders
149        <https://www.dropbox.com/help/986>`_ only.
150    :ivar team_common.GroupType.user_managed: A group is created and managed by
151        a user.
152    """
153
154    _catch_all = 'other'
155    # Attribute is overwritten below the class definition
156    team = None
157    # Attribute is overwritten below the class definition
158    user_managed = None
159    # Attribute is overwritten below the class definition
160    other = None
161
162    def is_team(self):
163        """
164        Check if the union tag is ``team``.
165
166        :rtype: bool
167        """
168        return self._tag == 'team'
169
170    def is_user_managed(self):
171        """
172        Check if the union tag is ``user_managed``.
173
174        :rtype: bool
175        """
176        return self._tag == 'user_managed'
177
178    def is_other(self):
179        """
180        Check if the union tag is ``other``.
181
182        :rtype: bool
183        """
184        return self._tag == 'other'
185
186    def _process_custom_annotations(self, annotation_type, field_path, processor):
187        super(GroupType, self)._process_custom_annotations(annotation_type, field_path, processor)
188
189GroupType_validator = bv.Union(GroupType)
190
191class MemberSpaceLimitType(bb.Union):
192    """
193    The type of the space limit imposed on a team member.
194
195    This class acts as a tagged union. Only one of the ``is_*`` methods will
196    return true. To get the associated value of a tag (if one exists), use the
197    corresponding ``get_*`` method.
198
199    :ivar team_common.MemberSpaceLimitType.off: The team member does not have
200        imposed space limit.
201    :ivar team_common.MemberSpaceLimitType.alert_only: The team member has soft
202        imposed space limit - the limit is used for display and for
203        notifications.
204    :ivar team_common.MemberSpaceLimitType.stop_sync: The team member has hard
205        imposed space limit - Dropbox file sync will stop after the limit is
206        reached.
207    """
208
209    _catch_all = 'other'
210    # Attribute is overwritten below the class definition
211    off = None
212    # Attribute is overwritten below the class definition
213    alert_only = None
214    # Attribute is overwritten below the class definition
215    stop_sync = None
216    # Attribute is overwritten below the class definition
217    other = None
218
219    def is_off(self):
220        """
221        Check if the union tag is ``off``.
222
223        :rtype: bool
224        """
225        return self._tag == 'off'
226
227    def is_alert_only(self):
228        """
229        Check if the union tag is ``alert_only``.
230
231        :rtype: bool
232        """
233        return self._tag == 'alert_only'
234
235    def is_stop_sync(self):
236        """
237        Check if the union tag is ``stop_sync``.
238
239        :rtype: bool
240        """
241        return self._tag == 'stop_sync'
242
243    def is_other(self):
244        """
245        Check if the union tag is ``other``.
246
247        :rtype: bool
248        """
249        return self._tag == 'other'
250
251    def _process_custom_annotations(self, annotation_type, field_path, processor):
252        super(MemberSpaceLimitType, self)._process_custom_annotations(annotation_type, field_path, processor)
253
254MemberSpaceLimitType_validator = bv.Union(MemberSpaceLimitType)
255
256class TimeRange(bb.Struct):
257    """
258    Time range.
259
260    :ivar team_common.TimeRange.start_time: Optional starting time (inclusive).
261    :ivar team_common.TimeRange.end_time: Optional ending time (exclusive).
262    """
263
264    __slots__ = [
265        '_start_time_value',
266        '_end_time_value',
267    ]
268
269    _has_required_fields = False
270
271    def __init__(self,
272                 start_time=None,
273                 end_time=None):
274        self._start_time_value = bb.NOT_SET
275        self._end_time_value = bb.NOT_SET
276        if start_time is not None:
277            self.start_time = start_time
278        if end_time is not None:
279            self.end_time = end_time
280
281    # Instance attribute type: datetime.datetime (validator is set below)
282    start_time = bb.Attribute("start_time", nullable=True)
283
284    # Instance attribute type: datetime.datetime (validator is set below)
285    end_time = bb.Attribute("end_time", nullable=True)
286
287    def _process_custom_annotations(self, annotation_type, field_path, processor):
288        super(TimeRange, self)._process_custom_annotations(annotation_type, field_path, processor)
289
290TimeRange_validator = bv.Struct(TimeRange)
291
292GroupExternalId_validator = bv.String()
293GroupId_validator = bv.String()
294MemberExternalId_validator = bv.String(max_length=64)
295ResellerId_validator = bv.String()
296TeamId_validator = bv.String()
297TeamMemberId_validator = bv.String()
298GroupManagementType._user_managed_validator = bv.Void()
299GroupManagementType._company_managed_validator = bv.Void()
300GroupManagementType._system_managed_validator = bv.Void()
301GroupManagementType._other_validator = bv.Void()
302GroupManagementType._tagmap = {
303    'user_managed': GroupManagementType._user_managed_validator,
304    'company_managed': GroupManagementType._company_managed_validator,
305    'system_managed': GroupManagementType._system_managed_validator,
306    'other': GroupManagementType._other_validator,
307}
308
309GroupManagementType.user_managed = GroupManagementType('user_managed')
310GroupManagementType.company_managed = GroupManagementType('company_managed')
311GroupManagementType.system_managed = GroupManagementType('system_managed')
312GroupManagementType.other = GroupManagementType('other')
313
314GroupSummary.group_name.validator = bv.String()
315GroupSummary.group_id.validator = GroupId_validator
316GroupSummary.group_external_id.validator = bv.Nullable(GroupExternalId_validator)
317GroupSummary.member_count.validator = bv.Nullable(bv.UInt32())
318GroupSummary.group_management_type.validator = GroupManagementType_validator
319GroupSummary._all_field_names_ = set([
320    'group_name',
321    'group_id',
322    'group_external_id',
323    'member_count',
324    'group_management_type',
325])
326GroupSummary._all_fields_ = [
327    ('group_name', GroupSummary.group_name.validator),
328    ('group_id', GroupSummary.group_id.validator),
329    ('group_external_id', GroupSummary.group_external_id.validator),
330    ('member_count', GroupSummary.member_count.validator),
331    ('group_management_type', GroupSummary.group_management_type.validator),
332]
333
334GroupType._team_validator = bv.Void()
335GroupType._user_managed_validator = bv.Void()
336GroupType._other_validator = bv.Void()
337GroupType._tagmap = {
338    'team': GroupType._team_validator,
339    'user_managed': GroupType._user_managed_validator,
340    'other': GroupType._other_validator,
341}
342
343GroupType.team = GroupType('team')
344GroupType.user_managed = GroupType('user_managed')
345GroupType.other = GroupType('other')
346
347MemberSpaceLimitType._off_validator = bv.Void()
348MemberSpaceLimitType._alert_only_validator = bv.Void()
349MemberSpaceLimitType._stop_sync_validator = bv.Void()
350MemberSpaceLimitType._other_validator = bv.Void()
351MemberSpaceLimitType._tagmap = {
352    'off': MemberSpaceLimitType._off_validator,
353    'alert_only': MemberSpaceLimitType._alert_only_validator,
354    'stop_sync': MemberSpaceLimitType._stop_sync_validator,
355    'other': MemberSpaceLimitType._other_validator,
356}
357
358MemberSpaceLimitType.off = MemberSpaceLimitType('off')
359MemberSpaceLimitType.alert_only = MemberSpaceLimitType('alert_only')
360MemberSpaceLimitType.stop_sync = MemberSpaceLimitType('stop_sync')
361MemberSpaceLimitType.other = MemberSpaceLimitType('other')
362
363TimeRange.start_time.validator = bv.Nullable(common.DropboxTimestamp_validator)
364TimeRange.end_time.validator = bv.Nullable(common.DropboxTimestamp_validator)
365TimeRange._all_field_names_ = set([
366    'start_time',
367    'end_time',
368])
369TimeRange._all_fields_ = [
370    ('start_time', TimeRange.start_time.validator),
371    ('end_time', TimeRange.end_time.validator),
372]
373
374ROUTES = {
375}
376
377
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run Python Tests on LambdaTest Cloud Grid

Execute automation tests with Playwright Python on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)