aboutsummaryrefslogtreecommitdiff
path: root/venv/lib/python3.8/site-packages/dash/dcc/Geolocation.py
blob: 9d87af8cdccb4df012491f02af1e9a7dae7b996f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# AUTO GENERATED FILE - DO NOT EDIT

import typing  # noqa: F401
from typing_extensions import TypedDict, NotRequired, Literal  # noqa: F401
from dash.development.base_component import Component, _explicitize_args

ComponentType = typing.Union[
    str,
    int,
    float,
    Component,
    None,
    typing.Sequence[typing.Union[str, int, float, Component, None]],
]

NumberType = typing.Union[
    typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
]


class Geolocation(Component):
    """A Geolocation component.
    The CurrentLocation component gets geolocation of the device from the web browser.  See more info here:
    https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API

    Keyword arguments:

    - id (string; optional):
        The ID used to identify this component in Dash callbacks.

    - high_accuracy (boolean; default False):
        If True and if the device is able to provide a more accurate
        position,  it will do so. Note that this can result in slower
        response times or increased power consumption (with a GPS  chip on
        a mobile device for example). If False (the default value), the
        device can save resources by  responding more quickly and/or using
        less power.

    - local_date (string; optional):
        The local date and time when the device position was updated.
        Format:  MM/DD/YYYY, hh:mm:ss p   where p is AM or PM.

    - maximum_age (number; default 0):
        The maximum age in milliseconds of a possible cached position that
        is acceptable to return. If set to 0, it means that the device
        cannot use a cached position and must attempt to retrieve the real
        current position. If set to Infinity the device must return a
        cached position regardless of its age. Default: 0.

    - position (dict; optional):
        The position of the device.  `lat`, `lon`, and `accuracy` will
        always be returned.  The other data will be included when
        available, otherwise it will be NaN.        `lat` is latitude in
        degrees.       `lon` is longitude in degrees.       `accuracy` is
        the accuracy of the lat/lon in meters.    *        `alt` is
        altitude above mean sea level in meters.       `alt_accuracy` is
        the accuracy of the altitude  in meters.       `heading` is the
        compass heading in degrees.       `speed` is the  speed in meters
        per second.

        `position` is a dict with keys:

        - lat (number; optional)

        - lon (number; optional)

        - accuracy (number; optional)

        - alt (number; optional)

        - alt_accuracy (number; optional)

        - heading (number; optional)

        - speed (number; optional)

    - position_error (dict; optional):
        Position error.

        `position_error` is a dict with keys:

        - code (number; optional)

        - message (string; optional)

    - show_alert (boolean; default False):
        If True, error messages will be displayed as an alert.

    - timeout (number; default Infinity):
        The maximum length of time (in milliseconds) the device is allowed
        to take in order to return a position. The default value is
        Infinity, meaning that data will not be return until the position
        is available.

    - timestamp (number; optional):
        The Unix timestamp from when the position was updated.

    - update_now (boolean; default False):
        Forces a one-time update of the position data.   If set to True in
        a callback, the browser   will update the position data and reset
        update_now back to False.  This can, for example, be used to
        update the  position with a button or an interval timer."""

    _children_props = []
    _base_nodes = ["children"]
    _namespace = "dash_core_components"
    _type = "Geolocation"
    Position = TypedDict(
        "Position",
        {
            "lat": NotRequired[NumberType],
            "lon": NotRequired[NumberType],
            "accuracy": NotRequired[NumberType],
            "alt": NotRequired[NumberType],
            "alt_accuracy": NotRequired[NumberType],
            "heading": NotRequired[NumberType],
            "speed": NotRequired[NumberType],
        },
    )

    PositionError = TypedDict(
        "PositionError", {"code": NotRequired[NumberType], "message": NotRequired[str]}
    )

    def __init__(
        self,
        id: typing.Optional[typing.Union[str, dict]] = None,
        local_date: typing.Optional[str] = None,
        timestamp: typing.Optional[NumberType] = None,
        position: typing.Optional["Position"] = None,
        position_error: typing.Optional["PositionError"] = None,
        show_alert: typing.Optional[bool] = None,
        update_now: typing.Optional[bool] = None,
        high_accuracy: typing.Optional[bool] = None,
        maximum_age: typing.Optional[NumberType] = None,
        timeout: typing.Optional[NumberType] = None,
        **kwargs
    ):
        self._prop_names = [
            "id",
            "high_accuracy",
            "local_date",
            "maximum_age",
            "position",
            "position_error",
            "show_alert",
            "timeout",
            "timestamp",
            "update_now",
        ]
        self._valid_wildcard_attributes = []
        self.available_properties = [
            "id",
            "high_accuracy",
            "local_date",
            "maximum_age",
            "position",
            "position_error",
            "show_alert",
            "timeout",
            "timestamp",
            "update_now",
        ]
        self.available_wildcard_properties = []
        _explicit_args = kwargs.pop("_explicit_args")
        _locals = locals()
        _locals.update(kwargs)  # For wildcard attrs and excess named props
        args = {k: _locals[k] for k in _explicit_args}

        super(Geolocation, self).__init__(**args)


setattr(Geolocation, "__init__", _explicitize_args(Geolocation.__init__))