repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/admin.py | tests/geopage/admin.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/models.py | tests/geopage/models.py | from django.contrib.gis.db import models
from django.utils.functional import cached_property
from django.utils.translation import gettext as _
from modelcluster.fields import ParentalKey
from wagtail import blocks
from wagtail.admin.panels import (
FieldPanel,
InlinePanel,
MultiFieldPanel,
ObjectList,
TabbedInterface,
)
from wagtail.fields import StreamField
from wagtail.models import Orderable, Page
from wagtailgeowidget import geocoders
from wagtailgeowidget.blocks import (
GeoAddressBlock,
GeoZoomBlock,
GoogleMapsBlock,
LeafletBlock,
)
from wagtailgeowidget.panels import GeoAddressPanel, GoogleMapsPanel, LeafletPanel
class GeoLocation(models.Model):
title = models.CharField(max_length=255)
address = models.CharField(max_length=250, blank=True, null=True)
zoom = models.SmallIntegerField(blank=True, null=True)
location = models.PointField(srid=4326, null=True, blank=True)
panels = [
FieldPanel("title"),
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS_PLACES_NEW),
FieldPanel("zoom"),
GoogleMapsPanel("location", address_field="address", zoom_field="zoom"),
],
_("Geo details"),
),
]
class GeoPageRelatedLocations(Orderable, GeoLocation):
page = ParentalKey(
"geopage.GeoPage", related_name="related_locations", on_delete=models.CASCADE
)
class GeoPage(Page):
page_description = "Google maps with google maps geocoder"
address = models.CharField(max_length=250, blank=True, null=True)
location = models.PointField(srid=4326, null=True, blank=True)
content_panels = Page.content_panels + [
InlinePanel("related_locations", label="Related locations"),
]
location_panels = [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS),
GoogleMapsPanel("location", address_field="address"),
],
heading="Location",
)
]
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading="Content"),
ObjectList(location_panels, heading="Location"),
ObjectList(Page.settings_panels, heading="Settings", classname="settings"),
]
)
class GeoPageWithPlacesNewGeocoderRelatedLocations(Orderable, GeoLocation):
page = ParentalKey(
"geopage.GeoPageWithPlacesNewGeocoder",
related_name="related_locations",
on_delete=models.CASCADE,
)
class GeoPageWithPlacesNewGeocoder(Page):
page_description = "Google maps with google maps geocoder"
address = models.CharField(max_length=250, blank=True, null=True)
location = models.PointField(srid=4326, null=True, blank=True)
content_panels = Page.content_panels + [
InlinePanel("related_locations", label="Related locations"),
]
location_panels = [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS_PLACES_NEW),
GoogleMapsPanel("location", address_field="address"),
],
heading="Location",
)
]
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading="Content"),
ObjectList(location_panels, heading="Location"),
ObjectList(Page.promote_panels, heading="Promote"),
ObjectList(Page.settings_panels, heading="Settings"),
]
)
class GeoLocationWithLeaflet(models.Model):
title = models.CharField(max_length=255)
address = models.CharField(
max_length=250,
help_text=_("Search powered by Nominatim"),
blank=True,
null=True,
)
zoom = models.SmallIntegerField(blank=True, null=True)
location = models.PointField(srid=4326, null=True, blank=True)
panels = [
FieldPanel("title"),
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.NOMINATIM),
FieldPanel("zoom"),
LeafletPanel("location", address_field="address", zoom_field="zoom"),
],
_("Geo details"),
),
]
class GeoPageWithLeafletRelatedLocations(Orderable, GeoLocationWithLeaflet):
page = ParentalKey(
"geopage.GeoPageWithLeaflet",
related_name="related_locations",
on_delete=models.CASCADE,
)
class GeoPageWithLeaflet(Page):
page_description = "Leaflet with nominatim geocoder"
address = models.CharField(
max_length=250,
help_text=_("Search powered by Nominatim"),
blank=True,
null=True,
)
location = models.PointField(srid=4326, null=True, blank=True)
content_panels = Page.content_panels + [
InlinePanel("related_locations", label="Related locations"),
]
location_panels = [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.NOMINATIM),
LeafletPanel("location", address_field="address"),
],
heading="Location",
)
]
edit_handler = TabbedInterface(
[
ObjectList(content_panels, heading="Content"),
ObjectList(location_panels, heading="Location"),
ObjectList(Page.settings_panels, heading="Settings", classname="settings"),
]
)
class GeoStreamPage(Page):
page_description = "All map blocks"
streamfield_params = {}
body = StreamField(
[
("map", GoogleMapsBlock()),
("map_with_leaflet", LeafletBlock()),
(
"map_struct",
blocks.StructBlock(
[
("address", GeoAddressBlock(required=True)),
("map", GoogleMapsBlock(address_field="address")),
],
icon="user",
),
),
(
"map_struct_with_deprecated_geocoder_places",
blocks.StructBlock(
[
(
"address",
GeoAddressBlock(
required=True, geocoder=geocoders.GOOGLE_MAPS_PLACES
),
),
("map", GoogleMapsBlock(address_field="address")),
],
icon="user",
),
),
(
"map_struct_with_geocoder_places_new",
blocks.StructBlock(
[
(
"address",
GeoAddressBlock(
required=True, geocoder=geocoders.GOOGLE_MAPS_PLACES_NEW
),
),
("map", GoogleMapsBlock(address_field="address")),
],
icon="user",
),
),
(
"map_struct_with_leaflet",
blocks.StructBlock(
[
("address", GeoAddressBlock(required=True)),
("map", LeafletBlock(address_field="address")),
],
icon="user",
),
),
(
"map_struct_with_zoom",
blocks.StructBlock(
[
("address", GeoAddressBlock(required=True)),
("zoom", GeoZoomBlock(required=False)),
(
"map",
GoogleMapsBlock(address_field="address", zoom_field="zoom"),
),
],
icon="user",
),
),
(
"map_struct_leaflet_with_zoom",
blocks.StructBlock(
[
("address", GeoAddressBlock(required=True)),
("zoom", GeoZoomBlock(required=False)),
(
"map",
LeafletBlock(address_field="address", zoom_field="zoom"),
),
],
icon="user",
),
),
],
**streamfield_params,
)
content_panels = Page.content_panels + [
FieldPanel("body"),
]
def get_context(self, request):
data = super(GeoStreamPage, self).get_context(request)
return data
class ClassicGeoPage(Page):
page_description = "Google maps with google maps places geocoder"
address = models.CharField(max_length=250, blank=True, null=True)
location = models.CharField(max_length=250, blank=True, null=True)
content_panels = Page.content_panels + [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS_PLACES),
GoogleMapsPanel("location", address_field="address", hide_latlng=True),
],
_("Geo details"),
),
]
def get_context(self, request):
data = super(ClassicGeoPage, self).get_context(request)
return data
@cached_property
def point(self):
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
return geosgeometry_str_to_struct(self.location)
@property
def lat(self):
return self.point["y"]
@property
def lng(self):
return self.point["x"]
class ClassicGeoPageWithLeaflet(Page):
page_description = "Leaflet with mapbox geocoder"
address = models.CharField(
max_length=250,
help_text=_("Search powered by MapBox"),
blank=True,
null=True,
)
location = models.CharField(max_length=250, blank=True, null=True)
content_panels = Page.content_panels + [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.MAPBOX),
LeafletPanel("location", address_field="address", hide_latlng=True),
],
_("Geo details"),
),
]
def get_context(self, request):
data = super().get_context(request)
return data
@cached_property
def point(self):
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
return geosgeometry_str_to_struct(self.location)
@property
def lat(self):
return self.point["y"]
@property
def lng(self):
return self.point["x"]
class ClassicGeoPageWithZoom(Page):
page_description = "Google maps with google maps geocoder"
address = models.CharField(max_length=250, blank=True, null=True)
location = models.CharField(max_length=250, blank=True, null=True)
zoom = models.SmallIntegerField(blank=True, null=True)
content_panels = Page.content_panels + [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.GOOGLE_MAPS),
FieldPanel("zoom"),
GoogleMapsPanel(
"location",
address_field="address",
zoom_field="zoom",
hide_latlng=True,
),
],
_("Geo details"),
),
]
def get_context(self, request):
data = super().get_context(request)
return data
@cached_property
def point(self):
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
return geosgeometry_str_to_struct(self.location)
@property
def lat(self):
return self.point["y"]
@property
def lng(self):
return self.point["x"]
class ClassicGeoPageWithLeafletAndZoom(Page):
page_description = "Leaflet with nominatim geocoder"
address = models.CharField(
max_length=250,
help_text=_("Search powered by Nominatim"),
blank=True,
null=True,
)
location = models.CharField(max_length=250, blank=True, null=True)
zoom = models.SmallIntegerField(blank=True, null=True)
content_panels = Page.content_panels + [
MultiFieldPanel(
[
GeoAddressPanel("address", geocoder=geocoders.NOMINATIM),
FieldPanel("zoom"),
LeafletPanel(
"location",
address_field="address",
zoom_field="zoom",
hide_latlng=True,
),
],
_("Geo details"),
),
]
def get_context(self, request):
data = super().get_context(request)
return data
@cached_property
def point(self):
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
return geosgeometry_str_to_struct(self.location)
@property
def lat(self):
return self.point["y"]
@property
def lng(self):
return self.point["x"]
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/__init__.py | tests/geopage/__init__.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/tests.py | tests/geopage/tests.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/apps.py | tests/geopage/apps.py | from django.apps import AppConfig
class GeopageConfig(AppConfig):
name = "tests.geopage"
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/migrations/0001_initial.py | tests/geopage/migrations/0001_initial.py | # Generated by Django 4.2.23 on 2025-08-14 04:41
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
import wagtail.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
("wagtailcore", "0094_alter_page_locale"),
]
operations = [
migrations.CreateModel(
name="ClassicGeoPage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
("address", models.CharField(blank=True, max_length=250, null=True)),
("location", models.CharField(blank=True, max_length=250, null=True)),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="ClassicGeoPageWithLeaflet",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"address",
models.CharField(
blank=True,
help_text="Search powered by MapBox",
max_length=250,
null=True,
),
),
("location", models.CharField(blank=True, max_length=250, null=True)),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="ClassicGeoPageWithLeafletAndZoom",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"address",
models.CharField(
blank=True,
help_text="Search powered by Nominatim",
max_length=250,
null=True,
),
),
("location", models.CharField(blank=True, max_length=250, null=True)),
("zoom", models.SmallIntegerField(blank=True, null=True)),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="ClassicGeoPageWithZoom",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
("address", models.CharField(blank=True, max_length=250, null=True)),
("location", models.CharField(blank=True, max_length=250, null=True)),
("zoom", models.SmallIntegerField(blank=True, null=True)),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="GeoLocation",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
("address", models.CharField(blank=True, max_length=250, null=True)),
("zoom", models.SmallIntegerField(blank=True, null=True)),
(
"location",
django.contrib.gis.db.models.fields.PointField(
blank=True, null=True, srid=4326
),
),
],
),
migrations.CreateModel(
name="GeoLocationWithLeaflet",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
(
"address",
models.CharField(
blank=True,
help_text="Search powered by Nominatim",
max_length=250,
null=True,
),
),
("zoom", models.SmallIntegerField(blank=True, null=True)),
(
"location",
django.contrib.gis.db.models.fields.PointField(
blank=True, null=True, srid=4326
),
),
],
),
migrations.CreateModel(
name="GeoPage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
("address", models.CharField(blank=True, max_length=250, null=True)),
(
"location",
django.contrib.gis.db.models.fields.PointField(
blank=True, null=True, srid=4326
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="GeoPageWithLeaflet",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"address",
models.CharField(
blank=True,
help_text="Search powered by Nominatim",
max_length=250,
null=True,
),
),
(
"location",
django.contrib.gis.db.models.fields.PointField(
blank=True, null=True, srid=4326
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="GeoPageWithPlacesNewGeocoder",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
("address", models.CharField(blank=True, max_length=250, null=True)),
(
"location",
django.contrib.gis.db.models.fields.PointField(
blank=True, null=True, srid=4326
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="GeoStreamPage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.page",
),
),
(
"body",
wagtail.fields.StreamField(
[
("map", 0),
("map_with_leaflet", 1),
("map_struct", 4),
("map_struct_with_deprecated_geocoder_places", 6),
("map_struct_with_geocoder_places_new", 8),
("map_struct_with_leaflet", 10),
("map_struct_with_zoom", 13),
("map_struct_leaflet_with_zoom", 15),
],
block_lookup={
0: ("wagtailgeowidget.blocks.GoogleMapsBlock", (), {}),
1: ("wagtailgeowidget.blocks.LeafletBlock", (), {}),
2: (
"wagtailgeowidget.blocks.GeoAddressBlock",
(),
{"required": True},
),
3: (
"wagtailgeowidget.blocks.GoogleMapsBlock",
(),
{"address_field": "address"},
),
4: (
"wagtail.blocks.StructBlock",
[[("address", 2), ("map", 3)]],
{"icon": "user"},
),
5: (
"wagtailgeowidget.blocks.GeoAddressBlock",
(),
{"geocoder": "google_maps_places", "required": True},
),
6: (
"wagtail.blocks.StructBlock",
[[("address", 5), ("map", 3)]],
{"icon": "user"},
),
7: (
"wagtailgeowidget.blocks.GeoAddressBlock",
(),
{
"geocoder": "google_maps_places_new",
"required": True,
},
),
8: (
"wagtail.blocks.StructBlock",
[[("address", 7), ("map", 3)]],
{"icon": "user"},
),
9: (
"wagtailgeowidget.blocks.LeafletBlock",
(),
{"address_field": "address"},
),
10: (
"wagtail.blocks.StructBlock",
[[("address", 2), ("map", 9)]],
{"icon": "user"},
),
11: (
"wagtailgeowidget.blocks.GeoZoomBlock",
(),
{"required": False},
),
12: (
"wagtailgeowidget.blocks.GoogleMapsBlock",
(),
{"address_field": "address", "zoom_field": "zoom"},
),
13: (
"wagtail.blocks.StructBlock",
[[("address", 2), ("zoom", 11), ("map", 12)]],
{"icon": "user"},
),
14: (
"wagtailgeowidget.blocks.LeafletBlock",
(),
{"address_field": "address", "zoom_field": "zoom"},
),
15: (
"wagtail.blocks.StructBlock",
[[("address", 2), ("zoom", 11), ("map", 14)]],
{"icon": "user"},
),
},
),
),
],
options={
"abstract": False,
},
bases=("wagtailcore.page",),
),
migrations.CreateModel(
name="GeoPageWithPlacesNewGeocoderRelatedLocations",
fields=[
(
"geolocation_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="geopage.geolocation",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"page",
modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="related_locations",
to="geopage.geopagewithplacesnewgeocoder",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
bases=("geopage.geolocation", models.Model),
),
migrations.CreateModel(
name="GeoPageWithLeafletRelatedLocations",
fields=[
(
"geolocationwithleaflet_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="geopage.geolocationwithleaflet",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"page",
modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="related_locations",
to="geopage.geopagewithleaflet",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
bases=("geopage.geolocationwithleaflet", models.Model),
),
migrations.CreateModel(
name="GeoPageRelatedLocations",
fields=[
(
"geolocation_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="geopage.geolocation",
),
),
(
"sort_order",
models.IntegerField(blank=True, editable=False, null=True),
),
(
"page",
modelcluster.fields.ParentalKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="related_locations",
to="geopage.geopage",
),
),
],
options={
"ordering": ["sort_order"],
"abstract": False,
},
bases=("geopage.geolocation", models.Model),
),
]
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/geopage/migrations/__init__.py | tests/geopage/migrations/__init__.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/search/views.py | tests/search/views.py | from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.shortcuts import render
from wagtail.contrib.search_promotions.models import Query
from wagtail.models import Page
def search(request):
search_query = request.GET.get("query", None)
page = request.GET.get("page", 1)
# Search
if search_query:
search_results = Page.objects.live().search(search_query)
query = Query.get(search_query)
# Record hit
query.add_hit()
else:
search_results = Page.objects.none()
# Pagination
paginator = Paginator(search_results, 10)
try:
search_results = paginator.page(page)
except PageNotAnInteger:
search_results = paginator.page(1)
except EmptyPage:
search_results = paginator.page(paginator.num_pages)
return render(
request,
"search/search.html",
{
"search_query": search_query,
"search_results": search_results,
},
)
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/tests/search/__init__.py | tests/search/__init__.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/panels.py | wagtailgeowidget/panels.py | from wagtail.admin.panels import FieldPanel
from wagtailgeowidget import geocoders
from wagtailgeowidget.app_settings import GEO_WIDGET_ZOOM
from wagtailgeowidget.widgets import GeocoderField, GoogleMapsField, LeafletField
class GoogleMapsPanel(FieldPanel):
def __init__(self, *args, **kwargs):
self.classname = kwargs.pop("classname", "")
self.address_field = kwargs.pop("address_field", "")
self.zoom_field = kwargs.pop("zoom_field", "")
self.hide_latlng = kwargs.pop("hide_latlng", False)
self.zoom = kwargs.pop("zoom", GEO_WIDGET_ZOOM)
super().__init__(*args, **kwargs)
def get_form_options(self):
opts = super().get_form_options()
opts["widgets"] = self.widget_overrides()
return opts
def widget_overrides(self):
field = self.model._meta.get_field(self.field_name)
srid = getattr(field, "srid", 4326)
return {
self.field_name: GoogleMapsField(
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
zoom=self.zoom,
srid=srid,
id_prefix="id_",
)
}
def clone(self):
return self.__class__(
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
zoom=self.zoom,
**self.clone_kwargs(),
)
class GeoAddressPanel(FieldPanel):
def __init__(self, *args, **kwargs):
self.geocoder = kwargs.pop("geocoder", geocoders.NOMINATIM)
super().__init__(*args, **kwargs)
def get_form_options(self):
opts = super().get_form_options()
opts["widgets"] = self.widget_overrides()
return opts
def widget_overrides(self):
return {
self.field_name: GeocoderField(
geocoder=self.geocoder,
)
}
def clone(self):
return self.__class__(
geocoder=self.geocoder,
**self.clone_kwargs(),
)
class LeafletPanel(FieldPanel):
def __init__(self, *args, **kwargs):
self.classname = kwargs.pop("classname", "")
self.address_field = kwargs.pop("address_field", "")
self.zoom_field = kwargs.pop("zoom_field", "")
self.hide_latlng = kwargs.pop("hide_latlng", False)
self.zoom = kwargs.pop("zoom", GEO_WIDGET_ZOOM)
super().__init__(*args, **kwargs)
def get_form_options(self):
opts = super().get_form_options()
opts["widgets"] = self.widget_overrides()
return opts
def widget_overrides(self):
field = self.model._meta.get_field(self.field_name)
srid = getattr(field, "srid", 4326)
return {
self.field_name: LeafletField(
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
zoom=self.zoom,
srid=srid,
id_prefix="id_",
)
}
def clone(self):
return self.__class__(
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
zoom=self.zoom,
**self.clone_kwargs(),
)
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/blocks.py | wagtailgeowidget/blocks.py | from django import forms
from django.utils.functional import cached_property
from wagtail.blocks import FieldBlock, IntegerBlock
from wagtailgeowidget import geocoders
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
from wagtailgeowidget.widgets import GeocoderField, GoogleMapsField, LeafletField
class GeoAddressBlock(FieldBlock):
class Meta:
classname = "geo-address-block"
def __init__(
self,
geocoder=geocoders.NOMINATIM,
required=True,
help_text=None,
**kwargs,
):
super().__init__(**kwargs)
self.field_options = {
"required": required,
"help_text": help_text,
}
self.geocoder = geocoder
@cached_property
def field(self):
field_kwargs = {
"widget": GeocoderField(
geocoder=self.geocoder,
)
}
field_kwargs.update(self.field_options)
return forms.CharField(**field_kwargs)
class GeoZoomBlock(IntegerBlock):
class Meta:
classname = "geo-zoom-block"
class GoogleMapsBlock(FieldBlock):
class Meta:
icon = "site"
def __init__(
self,
address_field=None,
zoom_field=None,
required=True,
help_text=None,
hide_latlng=False,
**kwargs,
):
self.field_options = {}
self.address_field = address_field
self.zoom_field = zoom_field
self.hide_latlng = hide_latlng
super().__init__(**kwargs)
@cached_property
def field(self):
field_kwargs = {
"widget": GoogleMapsField(
srid=4326,
id_prefix="",
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
)
}
field_kwargs.update(self.field_options)
return forms.CharField(**field_kwargs)
def render_form(self, value, prefix="", errors=None):
if value and isinstance(value, dict):
value = "SRID={};POINT({} {})".format(
value["srid"],
value["lng"],
value["lat"],
)
return super().render_form(value, prefix, errors)
def value_from_form(self, value):
return value
def value_for_form(self, value):
if not value:
return None
if value and isinstance(value, str):
return value
val = "SRID={};POINT({} {})".format(
4326,
value["lng"],
value["lat"],
)
return val
def to_python(self, value):
if isinstance(value, dict):
return value
value = geosgeometry_str_to_struct(value)
if not value:
raise Exception("Error: Cannot parse '{}' into struct".format(value))
value = {
"lat": value["y"],
"lng": value["x"],
"srid": value["srid"],
}
return super().to_python(value)
class LeafletBlock(FieldBlock):
class Meta:
icon = "site"
def __init__(
self,
address_field=None,
zoom_field=None,
required=True,
help_text=None,
hide_latlng=False,
**kwargs,
):
self.field_options = {}
self.address_field = address_field
self.zoom_field = zoom_field
self.hide_latlng = hide_latlng
super().__init__(**kwargs)
@cached_property
def field(self):
field_kwargs = {
"widget": LeafletField(
srid=4326,
id_prefix="",
address_field=self.address_field,
zoom_field=self.zoom_field,
hide_latlng=self.hide_latlng,
)
}
field_kwargs.update(self.field_options)
return forms.CharField(**field_kwargs)
def render_form(self, value, prefix="", errors=None):
if value and isinstance(value, dict):
value = "SRID={};POINT({} {})".format(
value["srid"],
value["lng"],
value["lat"],
)
return super().render_form(value, prefix, errors)
def value_from_form(self, value):
return value
def value_for_form(self, value):
if not value:
return None
if value and isinstance(value, str):
return value
val = "SRID={};POINT({} {})".format(
4326,
value["lng"],
value["lat"],
)
return val
def to_python(self, value):
if isinstance(value, dict):
return value
value = geosgeometry_str_to_struct(value)
value = {
"lat": value["y"],
"lng": value["x"],
"srid": value["srid"],
}
return super().to_python(value)
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/widgets.py | wagtailgeowidget/widgets.py | import json
import uuid
from django import forms
from django.forms import widgets
from django.utils.functional import cached_property
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
from wagtail import VERSION as WAGTAIL_VERSION
if WAGTAIL_VERSION >= (7, 1):
from wagtail.admin.telepath import register
from wagtail.admin.telepath.widgets import WidgetAdapter
else:
from wagtail.telepath import register
from wagtail.widget_adapters import WidgetAdapter
try:
from django.contrib.gis.geos.point import Point
except: # NOQA
Point = None
from wagtailgeowidget import geocoders
from wagtailgeowidget.app_settings import (
GEO_WIDGET_DEFAULT_LOCATION,
GEO_WIDGET_EMPTY_LOCATION,
GEO_WIDGET_LEAFLET_TILE_LAYER,
GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS,
GEO_WIDGET_ZOOM,
)
from wagtailgeowidget.helpers import geosgeometry_str_to_struct
translations = {
"error_message_invalid_location": _(
"Invalid location coordinate, use Latitude and Longitude (example: 59.329,18.06858)"
),
"success_address_geocoded": _("Address has been successfully geo-coded"),
"error_could_not_geocode_address": _(
"Could not geocode address '%s'. The map may not be in sync with the address entered."
),
"enter_location": _("Enter a location"),
"initialize_map": _("Click here to initialize map"),
}
class GoogleMapsField(forms.HiddenInput):
address_field = None
zoom_field = None
id_prefix = "id_"
srid = None
hide_latlng = False
def __init__(self, *args, **kwargs):
self.address_field = kwargs.pop("address_field", self.address_field)
self.zoom_field = kwargs.pop("zoom_field", self.zoom_field)
self.srid = kwargs.pop("srid", self.srid)
self.hide_latlng = kwargs.pop("hide_latlng", self.hide_latlng)
self.id_prefix = kwargs.pop("id_prefix", self.id_prefix)
self.zoom = kwargs.pop("zoom", GEO_WIDGET_ZOOM)
self.map_id = str(uuid.uuid4())
# Keeps a reference to the value data from the render method
self.value_data = None
super().__init__(*args, **kwargs)
def build_attrs(self, *args, **kwargs):
attrs = super().build_attrs(*args, **kwargs)
# Don't add Stimulus controller attributes if this widget is being used
# in a StreamField/StructBlock context (id_prefix=""). In that context,
# Telepath handles initialization. For FieldPanel (id_prefix="id_"),
# Stimulus is still needed even though Telepath is used for serialization.
if self.id_prefix == "":
return attrs
data = {
"defaultLocation": GEO_WIDGET_DEFAULT_LOCATION,
"addressField": self.address_field,
"zoomField": self.zoom_field,
"zoom": self.zoom,
"srid": self.srid,
"showEmptyLocation": GEO_WIDGET_EMPTY_LOCATION,
"translations": translations,
"mapId": self.map_id,
}
if self.value_data and isinstance(self.value_data, str):
result = geosgeometry_str_to_struct(self.value_data)
if result:
data["defaultLocation"] = {
"lat": result["y"],
"lng": result["x"],
}
if self.value_data and Point and isinstance(self.value_data, Point):
data["defaultLocation"] = {
"lat": self.value_data.y,
"lng": self.value_data.x,
}
attrs["data-controller"] = "google-maps-field"
attrs["data-google-maps-field-options-value"] = json.dumps(data)
return attrs
@cached_property
def media(self):
from django.utils.module_loading import import_string
from wagtailgeowidget.app_settings import (
GOOGLE_MAPS_V3_APIKEY,
GOOGLE_MAPS_V3_APIKEY_CALLBACK,
GOOGLE_MAPS_V3_LANGUAGE,
)
google_maps_apikey = GOOGLE_MAPS_V3_APIKEY
if GOOGLE_MAPS_V3_APIKEY_CALLBACK:
if isinstance(GOOGLE_MAPS_V3_APIKEY_CALLBACK, str):
callback = import_string(GOOGLE_MAPS_V3_APIKEY_CALLBACK)
else:
callback = GOOGLE_MAPS_V3_APIKEY_CALLBACK
google_maps_apikey = callback()
return forms.Media(
css={"all": ("wagtailgeowidget/css/google-maps-field.css",)},
js=(
"wagtailgeowidget/js/google-maps-field.js",
"wagtailgeowidget/js/google-maps-field-controller.js",
"https://maps.google.com/maps/api/js?key={}&libraries=places,marker&language={}".format(
google_maps_apikey,
GOOGLE_MAPS_V3_LANGUAGE,
),
),
)
def render(self, name, value, attrs=None, renderer=None):
try:
id_ = attrs["id"]
except (KeyError, TypeError):
raise TypeError(
"GoogleMapsField cannot be rendered without an 'id' attribute"
)
self.value_data = value
widget_html = super().render(name, self.value_data, attrs)
input_classes = "google-maps-location"
if self.hide_latlng:
input_classes = "{} {}".format(
input_classes,
"google-maps-field-location--hide",
)
location = format_html(
'<div class="input">'
'<input id="{0}_latlng" class="{1}" maxlength="250" type="text">'
"</div>",
id_,
input_classes,
)
return mark_safe(
widget_html
+ location
+ '<div id="{0}_map" class="google-maps-field"></div>'.format(id_)
)
class GeocoderField(widgets.TextInput):
geocoder = geocoders.NOMINATIM
def __init__(self, *args, **kwargs):
self.geocoder = kwargs.pop("geocoder", geocoders.NOMINATIM)
super().__init__(*args, **kwargs)
def build_attrs(self, *args, **kwargs):
options = {"translations": translations}
params = {}
if self.geocoder == geocoders.MAPBOX:
from wagtailgeowidget.app_settings import (
MAPBOX_ACCESS_TOKEN,
MAPBOX_LANGUAGE,
)
params["accessToken"] = MAPBOX_ACCESS_TOKEN
params["language"] = MAPBOX_LANGUAGE
options["params"] = params
attrs = super().build_attrs(*args, **kwargs)
attrs["data-controller"] = "geocoder-field"
attrs["data-geocoder-field-geocoder-value"] = self.geocoder
attrs["data-geocoder-field-options-value"] = json.dumps(options)
return attrs
@property
def media(self):
js = [
"wagtailgeowidget/js/geocoder-field.js",
"wagtailgeowidget/js/geocoder-field-controller.js",
]
from wagtailgeowidget.app_settings import (
GOOGLE_MAPS_V3_APIKEY,
GOOGLE_MAPS_V3_LANGUAGE,
)
if self.geocoder == geocoders.GOOGLE_MAPS:
js = [
*js,
"https://maps.google.com/maps/api/js?key={}&libraries=places,marker&language={}".format(
GOOGLE_MAPS_V3_APIKEY,
GOOGLE_MAPS_V3_LANGUAGE,
),
]
return forms.Media(
js=js,
)
def render(self, name, value, attrs=None, renderer=None):
try:
attrs["id"]
except (KeyError, TypeError):
raise TypeError(
"GeocoderField cannot be rendered without an 'id' attribute"
)
value_data = value
widget_html = super().render(name, value_data, attrs)
return mark_safe(widget_html)
class LeafletField(forms.HiddenInput):
address_field = None
zoom_field = None
id_prefix = "id_"
srid = None
hide_latlng = False
def __init__(self, *args, **kwargs):
self.address_field = kwargs.pop("address_field", self.address_field)
self.zoom_field = kwargs.pop("zoom_field", self.zoom_field)
self.srid = kwargs.pop("srid", self.srid)
self.hide_latlng = kwargs.pop("hide_latlng", self.hide_latlng)
self.id_prefix = kwargs.pop("id_prefix", self.id_prefix)
self.zoom = kwargs.pop("zoom", GEO_WIDGET_ZOOM)
# Keeps a reference to the value data from the render method
self.value_data = None
super().__init__(*args, **kwargs)
def build_attrs(self, *args, **kwargs):
attrs = super().build_attrs(*args, **kwargs)
# Don't add Stimulus controller attributes if this widget is being used
# in a StreamField/StructBlock context (id_prefix=""). In that context,
# Telepath handles initialization. For FieldPanel (id_prefix="id_"),
# Stimulus is still needed even though Telepath is used for serialization.
if self.id_prefix == "":
return attrs
data = {
"defaultLocation": GEO_WIDGET_DEFAULT_LOCATION,
"addressField": self.address_field,
"zoomField": self.zoom_field,
"zoom": self.zoom,
"srid": self.srid,
"tileLayer": GEO_WIDGET_LEAFLET_TILE_LAYER,
"tileLayerOptions": GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS,
"showEmptyLocation": GEO_WIDGET_EMPTY_LOCATION,
"translations": translations,
}
if self.value_data and isinstance(self.value_data, str):
result = geosgeometry_str_to_struct(self.value_data)
if result:
data["defaultLocation"] = {
"lat": result["y"],
"lng": result["x"],
}
if self.value_data and Point and isinstance(self.value_data, Point):
data["defaultLocation"] = {
"lat": self.value_data.y,
"lng": self.value_data.x,
}
attrs["data-controller"] = "leaflet-field"
attrs["data-leaflet-field-options-value"] = json.dumps(data)
return attrs
@cached_property
def media(self):
return forms.Media(
css={
"all": (
"wagtailgeowidget/css/leaflet-field.css",
"https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",
)
},
js=(
"wagtailgeowidget/js/leaflet-field.js",
"wagtailgeowidget/js/leaflet-field-controller.js",
"https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",
),
)
def render(self, name, value, attrs=None, renderer=None):
try:
id_ = attrs["id"]
except (KeyError, TypeError):
raise TypeError("LeafletField cannot be rendered without an 'id' attribute")
self.value_data = value
widget_html = super().render(name, self.value_data, attrs)
input_classes = "leaflet-field-location"
if self.hide_latlng:
input_classes = "{} {}".format(
input_classes,
"leaflet-field-location--hide",
)
location = format_html(
'<div class="input">'
'<input id="{0}_latlng" class="{1}" maxlength="250" type="text">'
"</div>",
id_,
input_classes,
)
return mark_safe(
widget_html
+ location
+ '<div id="{0}_map" class="leaflet-field"></div>'.format(id_)
)
class GoogleMapsFieldAdapter(WidgetAdapter):
js_constructor = "wagtailgewidget.widgets.GoogleMapsFieldAdapter"
def js_args(self, widget):
args = super().js_args(widget)
options = {
"addressField": widget.address_field,
"zoomField": widget.zoom_field,
"defaultLocation": GEO_WIDGET_DEFAULT_LOCATION,
"srid": widget.srid,
"zoom": widget.zoom,
"showEmptyLocation": GEO_WIDGET_EMPTY_LOCATION,
"translations": translations,
"mapId": widget.map_id,
}
return [*args, options]
class Media:
js = ["wagtailgeowidget/js/google-maps-field-telepath.js"]
register(GoogleMapsFieldAdapter(), GoogleMapsField)
class GeocoderFieldAdapter(WidgetAdapter):
js_constructor = "wagtailgewidget.widgets.GeocoderFieldWrap"
def js_args(self, widget):
args = super().js_args(widget)
params = {}
if widget.geocoder == geocoders.MAPBOX:
from wagtailgeowidget.app_settings import MAPBOX_ACCESS_TOKEN
params["accessToken"] = MAPBOX_ACCESS_TOKEN
return [*args, widget.geocoder, translations, params]
class Media:
js = ["wagtailgeowidget/js/geocoder-field-telepath.js"]
register(GeocoderFieldAdapter(), GeocoderField)
class LeafletFieldAdapter(WidgetAdapter):
js_constructor = "wagtailgewidget.widgets.LeafletFieldAdapter"
def js_args(self, widget):
args = super().js_args(widget)
return [
*args,
{
"addressField": widget.address_field,
"zoomField": widget.zoom_field,
"defaultLocation": GEO_WIDGET_DEFAULT_LOCATION,
"srid": widget.srid,
"zoom": widget.zoom,
"tileLayer": GEO_WIDGET_LEAFLET_TILE_LAYER,
"tileLayerOptions": GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS,
"showEmptyLocation": GEO_WIDGET_EMPTY_LOCATION,
"translations": translations,
},
]
class Media:
js = ["wagtailgeowidget/js/leaflet-field-telepath.js"]
register(LeafletFieldAdapter(), LeafletField)
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/helpers.py | wagtailgeowidget/helpers.py | import re
from typing import Dict, Optional
geos_ptrn = re.compile(
r"^SRID=([0-9]{1,});POINT\s?\((-?[0-9\.]{1,})\s(-?[0-9\.]{1,})\)$"
)
def geosgeometry_str_to_struct(value: str) -> Optional[Dict]:
"""
Parses a geosgeometry string into struct.
Example:
SRID=5432;POINT(12.0 13.0)
Returns:
>> [5432, 12.0, 13.0]
"""
result = geos_ptrn.match(value)
if not result:
return None
return {
"srid": result.group(1),
"x": result.group(2),
"y": result.group(3),
}
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/geocoders.py | wagtailgeowidget/geocoders.py | NOMINATIM = "nominatim"
GOOGLE_MAPS = "google_maps"
GOOGLE_MAPS_PLACES = "google_maps_places"
GOOGLE_MAPS_PLACES_NEW = "google_maps_places_new"
MAPBOX = "mapbox"
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/__init__.py | wagtailgeowidget/__init__.py | #!/usr/bin/env python
"""
wagtailgeowidget
----------
Wagtail-Geo-Widget is the complete map solution for your Wagtail site.
"""
__title__ = "wagtailgeowidget"
__version__ = "9.1.0"
__build__ = 901
__author__ = "Martin Sandström"
__license__ = "MIT"
__copyright__ = "Copyright 2015-Present Fröjd Interactive"
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/apps.py | wagtailgeowidget/apps.py | from django.apps import AppConfig
class WagtailgeowidgetConfig(AppConfig):
name = "wagtailgeowidget"
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/app_settings.py | wagtailgeowidget/app_settings.py | from django.conf import settings
GEO_WIDGET_DEFAULT_LOCATION = getattr(
settings, "GEO_WIDGET_DEFAULT_LOCATION", {"lat": 59.3293, "lng": 18.0686}
)
GEO_WIDGET_EMPTY_LOCATION = getattr(settings, "GEO_WIDGET_EMPTY_LOCATION", False)
GEO_WIDGET_ZOOM = getattr(settings, "GEO_WIDGET_ZOOM", 7)
GEO_WIDGET_LEAFLET_TILE_LAYER = getattr(
settings,
"GEO_WIDGET_LEAFLET_TILE_LAYER",
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
)
GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS = getattr(
settings,
"GEO_WIDGET_LEAFLET_TILE_LAYER_OPTIONS",
{
"attribution": '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
},
)
GOOGLE_MAPS_V3_APIKEY = getattr(settings, "GOOGLE_MAPS_V3_APIKEY", None)
GOOGLE_MAPS_V3_APIKEY_CALLBACK = getattr(
settings, "GOOGLE_MAPS_V3_APIKEY_CALLBACK", None
)
GOOGLE_MAPS_V3_LANGUAGE = getattr(settings, "GOOGLE_MAPS_V3_LANGUAGE", "en")
MAPBOX_ACCESS_TOKEN = getattr(settings, "MAPBOX_ACCESS_TOKEN", None)
MAPBOX_LANGUAGE = getattr(settings, "MAPBOX_LANGUAGE", "en")
| python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false |
Frojd/wagtail-geo-widget | https://github.com/Frojd/wagtail-geo-widget/blob/ec36d7bfcd551fc415f50e8b27bd8d68a013c445/wagtailgeowidget/migrations/__init__.py | wagtailgeowidget/migrations/__init__.py | python | MIT | ec36d7bfcd551fc415f50e8b27bd8d68a013c445 | 2026-01-05T07:13:00.652315Z | false | |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/setup.py | setup.py | import sys
from distutils.core import setup
setup(
name = 'loophole',
packages = ['loophole', 'loophole.polar', 'loophole.polar.pb'],
version = '0.5.2',
description = 'Polar devices Python API and CLI.',
author = 'Radoslaw Matusiak',
author_email = 'radoslaw.matusiak@gmail.com',
url = 'https://github.com/rsc-dev/loophole',
download_url = 'https://github.com/rsc-dev/loophole/releases/tag/0.5.2',
keywords = ['polar', 'api', 'cli', 'reverse', ''],
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'License :: OSI Approved :: MIT License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Topic :: Software Development :: Libraries :: Python Modules'
],
install_requires=['protobuf'] + (
['pywinusb'] if "win" in sys.platform else ['pyusb']
)
) | python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/__main__.py | loophole/__main__.py | #!/usr/bin/env python
__author__ = 'Radoslaw Matusiak'
__copyright__ = 'Copyright (c) 2016 Radoslaw Matusiak'
__license__ = 'MIT'
__version__ = '0.5'
import cmd
import functools
import os
import sys
from polar import Device
from polar.pb import device_pb2 as pb_device
__INTRO = """
_| _| _|
_| _|_| _|_| _|_|_| _|_|_| _|_| _| _|_|
_| _| _| _| _| _| _| _| _| _| _| _| _|_|_|_|
_| _| _| _| _| _| _| _| _| _| _| _| _|
_| _|_| _|_| _|_|_| _| _| _|_| _| _|_|_|
_|
_|
ver. {}
"""
def check_if_device_is_connected(f):
"""
Decorator. Checks if device is connected before invoking function.
"""
@functools.wraps(f)
def wrapper(*args, **kwargs):
if args[0].device is not None:
return f(*args, **kwargs)
else:
print '[!] Device disconnected.'
print
return wrapper
class LoopholeCli(cmd.Cmd):
""" Loophole command line interface class. """
__PROMPT = 'loophole({})>'
def __init__(self):
"""Constructor.
"""
cmd.Cmd.__init__(self)
self.prompt = LoopholeCli.__PROMPT.format('no device')
self.device = None
# end-of-method __init__
def do_exit(self, _):
"""Quit.
Usage: exit
"""
if self.device is not None:
self.device.close()
sys.exit(0)
# end-of-method do_exit
def do_EOF(self, _):
"""Quit. handles EOF"""
self.do_exit(_)
# end-of-method do_EOF
def do_list(self, _):
"""List available Polar devices.
Usage: list
"""
devs = Device.list()
if len(devs) > 0:
for i, dev in enumerate(devs):
try:
info = Device.get_info(dev)
except ValueError as err:
print "Device no: %i" % i
print "Device info:"
print dev
print "-"*79
if 'langid' in err.message:
raise ValueError(
(
"Can't get device info. Origin Error: %s\n"
"Maybe this is a permission issue.\n"
"Please read section 'permission' in README ;)"
) % err
)
raise # raise origin error
print '{} - {} ({})'.format(i, info['product_name'], info['serial_number'])
else:
print '[!] No Polar devices found!'
print
# end-of-method do_list
def do_connect(self, dev_no):
"""Connect Polar device. Run 'list' to see available devices.
Usage: connect <device_no>
"""
try:
dev_no = int(dev_no)
except ValueError:
print '[!] You need to specify the device number. Run \'list\' to see available devices.'
print
return
try:
devs = Device.list()
dev = devs[dev_no]
serial = Device.get_info(dev)['serial_number']
self.prompt = LoopholeCli.__PROMPT.format(serial)
self.device = Device(dev)
self.device.open()
print '[+] Device connected.'
print
except IndexError:
print '[!] Device not found or failed to open it. Run \'list\' to see available devices.'
print
# end-of-method do_connect
@check_if_device_is_connected
def do_disconnect(self, _):
"""Disconnect Polar device.
"""
self.device.close()
self.device = None
self.prompt = LoopholeCli.__PROMPT.format('no device')
print '[+] Device disconnected.'
print
# end-of-method do_disconnect
@check_if_device_is_connected
def do_get(self, line):
"""Read file from device and store in under local_path.
Usage: get <device_path> <local_path>
"""
try:
src, dest = line.strip().split()
data = self.device.read_file(src)
with open(dest, 'wb') as outfile:
outfile.write(bytearray(data))
print '[+] File \'{}\' saved to \'{}\''.format(src, dest)
print
except ValueError:
print '[!] Invalid command usage.'
print '[!] Usage: get <source> <destination>'
print
# end-of-method do_get
@check_if_device_is_connected
def do_delete(self, line):
"""Delete file from device.
Usage: delete <device_path>
"""
path = line.strip()
_ = self.device.delete(path)
# end-of-method do_delete
@check_if_device_is_connected
def do_dump(self, path):
"""Dump device memory. Path is local folder to store dump.
Usage: dump <local_path>
"""
print '[+] Reading files tree...'
dev_map = self.device.walk(self.device.SEP)
for directory in dev_map.keys():
fixed_directory = directory.replace(self.device.SEP, os.sep)
full_path = os.path.abspath(os.path.join(path, fixed_directory[1:]))
if not os.path.exists(full_path):
os.makedirs(full_path)
d = dev_map[directory]
files = [e for e in d.entries if not e.name.endswith('/')]
for file in files:
with open(os.path.join(full_path, file.name), 'wb') as fh:
print '[+] Dumping {}{}'.format(directory, file.name)
data = self.device.read_file('{}{}'.format(directory, file.name))
fh.write(bytearray(data))
print '[+] Device memory dumped.'
print
# end-of-method do_dump
@check_if_device_is_connected
def do_info(self, _):
"""Print connected device info.
Usage: info
"""
info = Device.get_info(self.device.usb_device)
print '{:>20s} - {}'.format('Manufacturer', info['manufacturer'])
print '{:>20s} - {}'.format('Product name', info['product_name'])
print '{:>20s} - {}'.format('Vendor ID', info['vendor_id'])
print '{:>20s} - {}'.format('Product ID', info['product_id'])
print '{:>20s} - {}'.format('Serial number', info['serial_number'])
try:
data = self.device.read_file('/DEVICE.BPB')
resp = ''.join(chr(c) for c in data)
d = pb_device.PbDeviceInfo()
d.ParseFromString(resp)
bootloader_version = '{}.{}.{}'.format(d.bootloader_version.major, d.bootloader_version.minor, d.bootloader_version.patch)
print '{:>20s} - {}'.format('Bootloader version', bootloader_version)
platform_version = '{}.{}.{}'.format(d.platform_version.major, d.platform_version.minor, d.platform_version.patch)
print '{:>20s} - {}'.format('Platform version', platform_version)
device_version = '{}.{}.{}'.format(d.device_version.major, d.device_version.minor, d.device_version.patch)
print '{:>20s} - {}'.format('Device version', device_version)
print '{:>20s} - {}'.format('SVN revision', d.svn_rev)
print '{:>20s} - {}'.format('Hardware code', d.hardware_code)
print '{:>20s} - {}'.format('Color', d.product_color)
print '{:>20s} - {}'.format('Product design', d.product_design)
except:
print '[!] Failed to get extended info.'
print ' '
# end-of-method do_info
@check_if_device_is_connected
def do_fuzz(self, _):
import polar
num = _.strip()
if len(num) > 0:
num = int(num)
resp = self.device.send_raw([0x01, num] + [0x00] * 62)
print 'req: {} '.format(num),
if resp:
print 'err code: {}'.format(polar.PFTP_ERROR[resp[0]])
return
for i in xrange(256):
#raw_input('Sending [{}]...<press enter>'.format(i))
if (i & 0x03) == 2:
continue
if i in [3, 251, 252]:
continue
resp = self.device.send_raw([0x01, i] + [0x00] * 62)
print 'resp: {} '.format(i),
if resp:
print 'err code: {}'.format(polar.PFTP_ERROR[resp[0]])
else:
print
# end-of-method do_fuzz
@check_if_device_is_connected
def do_put_file(self, line):
path, filename = line.split()
self.device.put_file(path.strip(), filename.strip())
# end-of-method do_put_file
@check_if_device_is_connected
def do_walk(self, path):
"""Walk file system. Default device_path is device root folder.
Usage: walk [device_path]
"""
if not path.endswith('/'):
path += '/'
fs = self.device.walk(path)
keyz = fs.keys()
keyz.sort()
for k in keyz:
print k
d = fs[k]
files = [e for e in d.entries if not e.name.endswith('/')]
files.sort()
for f in files:
print '{}{} ({} bytes)'.format(k, f.name, f.size)
print
# end-of-method do_walk
pass
# end-of-class Loophole
def main():
cli = LoopholeCli()
cli.cmdloop(__INTRO.format(__version__))
# end-of-function main
##
# Entry point
if __name__ == '__main__':
main()
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/__init__.py | loophole/__init__.py | python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false | |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/__init__.py | loophole/polar/__init__.py | #!/usr/bin/env python
__author__ = 'Radoslaw Matusiak'
__copyright__ = 'Copyright (c) 2016 Radoslaw Matusiak'
__license__ = 'MIT'
__version__ = '0.5'
from collections import namedtuple
import os
import time
import pb.pftp_response_pb2 as pb_resp
import pb.pftp_request_pb2 as pb_req
PFTP_ERROR = {0: 'OPERATION_SUCCEEDED',
1: 'REBOOTING',
2: 'TRY_AGAIN',
203: 'INVALID_CONTENT',
100: 'UNIDENTIFIED_HOST_ERROR',
101: 'INVALID_COMMAND',
102: 'INVALID_PARAMETER',
103: 'NO_SUCH_FILE_OR_DIRECTORY',
200: 'UNIDENTIFIED_DEVICE_ERROR',
201: 'NOT_IMPLEMENTED',
106: 'OPERATION_NOT_PERMITTED',
107: 'NO_SUCH_USER',
204: 'CHECKSUM_FAILURE',
205: 'DISK_FULL',
206: 'PREREQUISITE_NOT_MET',
207: 'INSUFFICIENT_BUFFER',
208: 'WAIT_FOR_IDLING',
104: 'DIRECTORY_EXISTS',
108: 'TIMEOUT',
105: 'FILE_EXISTS',
209: 'BATTERY_TOO_LOW',
202: 'SYSTEM_BUSY'}
class Packet():
""" Polar device USB packet.
Packet 64 bytes:
[0] - id
[1] - size(6bits) + is_last(2bits)
[2] - sequence
[3...63] - data
"""
PACKET_SIZE = 64
DATA_SIZE = 61
def __init__(self):
self.buffer = [0] * 64
self.set_id()
self.set_sequence()
self.set_is_last(True)
# end-of-method __init__
def set_id(self, p_id=0x01):
self.buffer[0] = p_id
# end-of-method set_id
def get_id(self):
return self.buffer[0]
# end-of-method get_id
def set_size(self, size):
self.buffer[1] &= 0x03
self.buffer[1] = ((size + 2) << 2)
# end-of-method set_size
def get_size(self):
return ((self.buffer[1] & 0xfc) >> 2) - 2
# end-of-method get_size
def set_is_last(self, is_last):
self.buffer[1] &= 0xfc
self.buffer[1] |= 0 if is_last else 1
# end-of-method set_is_last
def get_is_last(self):
return (self.buffer[1] & 0x03) == 0
# end-of-method get_is_last
def set_sequence(self, sequence_id=0x00):
self.buffer[2] = sequence_id
# end-of-method set_sequence
def get_sequence(self):
return self.buffer[2]
# end-of-method get_sequence
def set_data(self, data):
if len(data) <= Packet.DATA_SIZE:
self.buffer[3:3+len(data)] = data
self.set_size(len(data))
else:
raise RuntimeError('Packet data to big!')
# end-of-method set_data
def get_raw_packet(self):
return self.buffer
# end-of-method get_packet
pass
# end-of-class Packet
class Protocol():
""" Device protocol util class. """
@staticmethod
def directory(resp):
"""
Parse device response as directory response.
:param resp: Device response.
:return: Directory object.
"""
d = pb_resp.PbPFtpDirectory()
d.ParseFromString(resp)
return d
# end-of-method directory
@staticmethod
def read(path):
"""
Create read path message.
:param path: Path to read.
:return: Read path message bytes array.
"""
return Protocol.pb_pftp_operation(path, 0x00)
# end-of-method read
@staticmethod
def delete(path):
"""
Create delete path message.
:param path: Path to delete.
:return: Delete path message bytes array.
"""
return Protocol.pb_pftp_operation(path, 0x03)
# end-of-method delete
@staticmethod
def put(path, data):
"""
Not working yet.
:param path:
:param data:
:return:
"""
raise RuntimeError()
cmds = []
length = 64
p = []
p.append(0x01)
total = len(path) + len(data)
if total > 62:
p.append(0xf9)
else:
p.append(total + 8 << 2)
p.append(0x00)
p.append(len(path)+4)
p.append(0x00)
p.append(0x08)
p.append(0x01)
p.append(0x12)
p.append(len(path))
for i in path:
p.append(ord(i))
for i in data[0:(length-9-len(path))]:
p.append(ord(i))
p = p + [0x00] * (64-len(p))
cmds.append(p)
j = 1
for i in xrange(length-9-len(path), len(data), 61):
cmd = [0x01]
subdata = data[i:i+61]
if len(subdata) == 61:
cmd.append(0xf9)
else:
cmd.append((len(subdata) + 2) << 2)
cmd.append(j)
for b in subdata:
cmd.append(ord(b))
cmd = cmd + [0x00] * (64-len(cmd))
cmds.append(cmd)
j += 1
return cmds
# end-of-method put
@staticmethod
def put_data(path, data):
req = pb_req.PbPFtpOperation()
req.command = req.PUT
req.path = path
ser_all = chr(len(path) + 4) + chr(0x00)
ser_all += req.SerializeToString()
all_data = ser_all + data
pass
# end-of-method put_data
@staticmethod
def pb_pftp_operation(path, command):
"""
Create PFTP operation message.
:param path: Message path.
:param action: Action enum value. (GET=0x00, DELETE=0x03)
:return: Message bytes array.
"""
p = Packet()
req = pb_req.PbPFtpOperation()
req.command = command
req.path = path
data = [len(path) + 4, 0x00]
data += [ord(c) for c in req.SerializeToString()]
p.set_data(data)
return p.get_raw_packet()
# end-of-method pb_pftp_operation
@staticmethod
def ack_packet(packet_no):
"""
Create response message byte array to acknowledge incoming packet.
:param packet_no: Number of packet to ack.
:return: Ack packet message bytes array.
"""
return [01, 05, packet_no] + [0] * 61
# end-of-method ack_packet
pass
# end-of-class Protocol
class Usb():
"""
USB interface to Polar devices.
Wraps Windows and Linux classes.
"""
UsbDevice = namedtuple('UsbDevice', ['vendor_id', 'product_id', 'serial_number', 'product_name'])
class WinUsb():
"""
PyWinUSB wrapper class.
Provides Windows USB support.
"""
def __init__(self):
"""
Constructor.
:return: Instance object.
"""
import pywinusb.hid as hid
self.hid = hid
self.device = None
# end-of-method __init__
def __send_wait(self, request, timeout=5000):
"""
This is internal method used for HOST->DEVICE communication.
This method only sends raw request and returns raw response.
:param request: Raw request to send. Array of byte values expected.
:param timeout: Timeout in milliseconds.
:return: Device raw response (array of byte values).
"""
self.response = None
self.out_report.set_raw_data(request)
self.out_report.send()
t = 0
while self.response is None:
time.sleep(0.05)
t += 50
if t >= timeout:
break
return self.response
# end-of-method send_wait
def data_handler(self, response):
"""
Simple USB->HOST data handler.
:param response: Response from USB HID device.
:return: Nothing.
"""
self.response = response
return None
# end-of-method data_handler
def init(self):
"""
Initialize USB communication.
:return: Nothing.
"""
if self.device is None:
raise RuntimeError('USB device not connected!')
self.device.open()
self.device.set_raw_data_handler(self.data_handler)
# If this line is a magic for you - please read https://en.wikipedia.org/wiki/Human_interface_device
self.out_report = self.device.find_output_reports()[0]
self.response = None
# end-of-method init
def list(self, vendor_id):
"""
List all USB devices for given vendor id.
:param vendor_id: Vendor id.
:return: List of available devices.
"""
all_hid_devs = self.hid.find_all_hid_devices()
devices = filter(lambda x: x.vendor_id == vendor_id, all_hid_devs)
return devices
# end-of-method list
def get_info(self, usb_device):
"""
Get infor for given USB device.
:param usb_device: USB device.
:return: Array with USB info.
"""
info = dict()
info['manufacturer'] = usb_device.vendor_name
info['product_name'] = usb_device.product_name
info['serial_number'] = usb_device.serial_number
info['vendor_id'] = '0x%04X' % usb_device.vendor_id
info['product_id'] = '0x%04X' % usb_device.product_id
return info
# end-of-method get_info
def open(self, usb_device):
"""
Open USB device.
:param usb_device: USB device to open.
:return: Nothing.
"""
f = self.hid.HidDeviceFilter(vendor_id=usb_device.vendor_id, product_id=usb_device.product_id)
devs = f.get_devices()
for d in devs:
if d.serial_number == usb_device.serial_number:
self.device = d
self.init()
# end-of-method open
def close(self):
"""
Close connected device.
:return: Nothing.
"""
self.device.close()
# end-of-method close
def send(self, request, timeout=5000):
"""
Send raw data to device and read response.
:param request: Request to send.
:param timeout: Max timeout in milliseconds. Default value: 5000 ms.
:return: Response from device.
"""
resp = []
data = self.__send_wait(request, timeout)
while data is not None:
if data[1] & 3 == 0:
length = data[1] >> 2
resp += data[3:length+1]
break
resp += data[3:]
pckt_no = data[2]
data = self.__send_wait(Protocol.ack_packet(pckt_no), timeout)
return resp
# end-of-method data
pass
# end-of-class Usb.WinUsb
class LinuxUsb():
def __send_wait(self, request, timeout):
"""
This is internal method used for HOST->DEVICE communication.
This method only sends raw request and returns raw response.
:param request: Raw request to send. Array of byte values expected.
:param timeout: Timeout in milliseconds.
:return: Device raw response (array of byte values).
"""
response = None
self.ep_out_0.write(request, timeout)
response = self.ep_in_0.read(64, timeout)
return response
# end-of-method send_wait
def __init__(self):
"""
Constructor.
:return: Instance object.
"""
import usb as usb
import usb.core as usb_core
self.usb = usb
self.usb_core = usb_core
self.ep_out_0 = None
self.ep_in_0 = None
self.usb_device = None
# end-of-method __init__
def list(self, vendor_id):
"""
List all USB devices for given vendor id.
:param vendor_id: Vendor id.
:return: List of available devices.
"""
devices = self.usb_core.find(find_all=True)
return filter(lambda x: x.idVendor == vendor_id, devices)
# end-of-method list
def get_info(self, usb_device):
"""
Get infor for given USB device.
:param usb_device: USB device.
:return: Array with USB info.
"""
info = dict()
info['manufacturer'] = self.usb.util.get_string(usb_device, usb_device.iManufacturer)
info['product_name'] = self.usb.util.get_string(usb_device, usb_device.iProduct)
info['serial_number'] = self.usb.util.get_string(usb_device, usb_device.iSerialNumber)
info['vendor_id'] = "0x%04X" % usb_device.idVendor
info['product_id'] = "0x%04X" % usb_device.idProduct
return info
# end-of-method get_info
def open(self, usb_device):
"""
Open USB device.
:param usb_device: USB device to open.
:return: Nothing.
"""
if usb_device.is_kernel_driver_active(0):
usb_device.detach_kernel_driver(0)
usb_device.set_configuration()
cfg = usb_device.get_active_configuration()
intf = cfg[(0,0)]
self.ep_out_0 = self.usb.util.find_descriptor(
intf,
custom_match = \
lambda e: \
self.usb.util.endpoint_direction(e.bEndpointAddress) == \
self.usb.util.ENDPOINT_OUT)
assert self.ep_out_0 is not None
self.ep_in_0 = self.usb.util.find_descriptor(
intf,
custom_match = \
lambda e: \
self.usb.util.endpoint_direction(e.bEndpointAddress) == \
self.usb.util.ENDPOINT_IN)
assert self.ep_in_0 is not None
self.usb_device = usb_device
# end-of-method open
def close(self):
"""
Close connected device.
:return: Nothing.
"""
self.usb.util.dispose_resources(self.usb_device)
# end-of-method close
def send(self, request, timeout):
"""
Send raw data to device and read response.
:param request: Request to send.
:param timeout: Max timeout in milliseconds. Default value: 2000 ms.
:return: Response from device.
"""
resp = []
data = self.__send_wait(request, timeout)
while data is not None:
if data[1] & 3 == 0:
length = data[1] >> 2
resp += data[3:length+1]
break
resp += data[3:]
pckt_no = data[2]
ack = Protocol.ack_packet(pckt_no)
data = self.__send_wait(ack, timeout)
return resp
# end-of-method send
pass
# end-of-class Usb.LinuxUsb
def __init__(self):
"""
Constructor.
:return: Instance object.
"""
if os.name == 'nt':
self.usb = Usb.WinUsb()
elif os.name == 'posix':
self.usb = Usb.LinuxUsb()
else:
raise NotImplementedError('Unknown operating system. Usb not supported.')
# end-of-method __init__
def list_devices(self):
"""
List available Polar device.
:return: List of UsbDevice instances for all USB plugged Polar devices.
"""
return self.usb.list(vendor_id=Device.VENDOR_ID)
# end-of-method list_devices
def get_info(self, usb_device):
"""
Returns info of the given USB device
:return: Dictionary with USB info
"""
return self.usb.get_info(usb_device)
def open(self, usb_device):
"""
Connect USB device.
:param usb_device: UsbDevice instance for device to connect.
:return: Nothing.
"""
self.usb.open(usb_device)
# end-of-method open
def close(self):
"""
Close USB device.
"""
self.usb.close()
# end-of-method close
def send(self, request, timeout=5000, skip_header=True):
"""
Send
:param request: UsbDevice instance for device to connect.
:param timeout: Timeout value.
:param skip_header: Backward compatibility. If false, raw device response is returned.
:return: Nothing.
"""
resp = self.usb.send(request, timeout)
if skip_header:
return resp[2:]
else:
return resp
# end-of-method send
pass
# end-of-class Usb
class Device():
"""
Polar devices class. Works on Windows.
Note: Tested with Polar Loop.
"""
VENDOR_ID = 0x0DA4 # Polar Electro Oy
PRODUCT_ID = {0x0008: 'Loop'}
SEP = '/'
def __init__(self, usb_device):
"""
Constructor.
:param usb: USB instance connected to Polar device.
:return: Instance object.
"""
self.usb_device = usb_device
self.usb = Usb()
# end-of-method __init__
@staticmethod
def list():
"""
List all Polar devices connected to the computer.
:return List of all connected Polar devices.
"""
usb = Usb()
return usb.list_devices()
# end-of-method list
@staticmethod
def get_info(usb_device):
"""
Reads USB device info from the given usb device.
:return: Device info dictionary.
"""
usb = Usb()
return usb.get_info(usb_device)
# end-of-method get_info
def open(self):
"""
Connects to the device
"""
self.usb.open(self.usb_device)
def close(self):
"""
Closes the device
"""
self.usb.close()
def walk(self, path):
"""
Recursively walk given path.
:param path: Path to walk.
:return: Dictionary of files and subfolders.
"""
ret = {}
dirs = [path]
while True:
try:
current_dir = dirs.pop()
d = self.list_dir(current_dir)
if d is not None:
ret[current_dir] = d
for e in d.entries:
if e.name.endswith('/'):
dirs.append('{}{}'.format(current_dir, e.name))
except IndexError:
break
return ret
# end-of-method walk
def list_dir(self, path):
"""
List given directory.
:param path: Path to list.
:return: Directory object.
"""
try:
resp = self.usb.send(request=Protocol.read(path))
if resp is not None and len(resp) > 0:
resp = ''.join(chr(c) for c in resp)
d = Protocol.directory(resp)
return d
except:
print 'Path {} failed!'.format(path)
# end-of-method list_dir
def read_file(self, path):
"""
Read file from device.
:param path: File's path.
:return: Bytes list.
"""
req = Protocol.read(path)
resp = self.usb.send(request=req)
return resp
# end-of-method read_file
def delete(self, path):
"""
Delete path from device.
:param path: File's path.
:return: Device response.
"""
resp = self.usb.send(request=Protocol.delete(path))
return resp
# end-of-method delete
def send_raw(self, data):
"""
Send raw data to device.
:param data: Data to send.
:return: Device response.
"""
resp = self.usb.send(request=data, skip_header=False)
return resp
# end-of-method send_raw
def put_file(self, path, file_name):
try:
data = open(file_name, 'rb').read()
packets = Protocol.put_data(path, data)
print 'Put file {} on {}'.format(file_name, path)
for p in packets:
resp = self.usb.send(p)
print 'PUT_FILE: {}'.format(resp)
except IOError:
raise
# end-of-method put_file
@staticmethod
def get_product_by_id(id):
"""
Returns product name by given product ID.
:param id: Product ID numeric value.
:return: Product name.
"""
if id in Device.PRODUCT_ID.keys():
return Device.PRODUCT_ID[id]
else:
return 'unknown'
# end-of-method get_product_by_id
pass
# end-of-class Device
if __name__ == '__main__':
pass
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/dailysummary_pb2.py | loophole/polar/pb/dailysummary_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: dailysummary.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='dailysummary.proto',
package='data',
serialized_pb=_b('\n\x12\x64\x61ilysummary.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xb8\x01\n\x15PbActivityGoalSummary\x12\x15\n\ractivity_goal\x18\x01 \x02(\x02\x12\x19\n\x11\x61\x63hieved_activity\x18\x02 \x02(\x02\x12\"\n\rtime_to_go_up\x18\x03 \x01(\x0b\x32\x0b.PbDuration\x12$\n\x0ftime_to_go_walk\x18\x04 \x01(\x0b\x32\x0b.PbDuration\x12#\n\x0etime_to_go_jog\x18\x05 \x01(\x0b\x32\x0b.PbDuration\"\xea\x02\n\x14PbActivityClassTimes\x12\"\n\rtime_non_wear\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x1f\n\ntime_sleep\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12#\n\x0etime_sedentary\x18\x03 \x02(\x0b\x32\x0b.PbDuration\x12(\n\x13time_light_activity\x18\x04 \x02(\x0b\x32\x0b.PbDuration\x12-\n\x18time_continuous_moderate\x18\x05 \x02(\x0b\x32\x0b.PbDuration\x12/\n\x1atime_intermittent_moderate\x18\x06 \x02(\x0b\x32\x0b.PbDuration\x12-\n\x18time_continuous_vigorous\x18\x07 \x02(\x0b\x32\x0b.PbDuration\x12/\n\x1atime_intermittent_vigorous\x18\x08 \x02(\x0b\x32\x0b.PbDuration\"\x93\x02\n\x0ePbDailySummary\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\r\n\x05steps\x18\x02 \x01(\r\x12\x19\n\x11\x61\x63tivity_calories\x18\x03 \x01(\r\x12\x19\n\x11training_calories\x18\x04 \x01(\r\x12\x14\n\x0c\x62mr_calories\x18\x05 \x01(\r\x12:\n\x15\x61\x63tivity_goal_summary\x18\x06 \x01(\x0b\x32\x1b.data.PbActivityGoalSummary\x12\x38\n\x14\x61\x63tivity_class_times\x18\x07 \x01(\x0b\x32\x1a.data.PbActivityClassTimes\x12\x19\n\x11\x61\x63tivity_distance\x18\x08 \x01(\x02')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBACTIVITYGOALSUMMARY = _descriptor.Descriptor(
name='PbActivityGoalSummary',
full_name='data.PbActivityGoalSummary',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='activity_goal', full_name='data.PbActivityGoalSummary.activity_goal', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='achieved_activity', full_name='data.PbActivityGoalSummary.achieved_activity', index=1,
number=2, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_to_go_up', full_name='data.PbActivityGoalSummary.time_to_go_up', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_to_go_walk', full_name='data.PbActivityGoalSummary.time_to_go_walk', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_to_go_jog', full_name='data.PbActivityGoalSummary.time_to_go_jog', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=42,
serialized_end=226,
)
_PBACTIVITYCLASSTIMES = _descriptor.Descriptor(
name='PbActivityClassTimes',
full_name='data.PbActivityClassTimes',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='time_non_wear', full_name='data.PbActivityClassTimes.time_non_wear', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_sleep', full_name='data.PbActivityClassTimes.time_sleep', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_sedentary', full_name='data.PbActivityClassTimes.time_sedentary', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_light_activity', full_name='data.PbActivityClassTimes.time_light_activity', index=3,
number=4, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_continuous_moderate', full_name='data.PbActivityClassTimes.time_continuous_moderate', index=4,
number=5, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_intermittent_moderate', full_name='data.PbActivityClassTimes.time_intermittent_moderate', index=5,
number=6, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_continuous_vigorous', full_name='data.PbActivityClassTimes.time_continuous_vigorous', index=6,
number=7, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_intermittent_vigorous', full_name='data.PbActivityClassTimes.time_intermittent_vigorous', index=7,
number=8, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=229,
serialized_end=591,
)
_PBDAILYSUMMARY = _descriptor.Descriptor(
name='PbDailySummary',
full_name='data.PbDailySummary',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='date', full_name='data.PbDailySummary.date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steps', full_name='data.PbDailySummary.steps', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_calories', full_name='data.PbDailySummary.activity_calories', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_calories', full_name='data.PbDailySummary.training_calories', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='bmr_calories', full_name='data.PbDailySummary.bmr_calories', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_goal_summary', full_name='data.PbDailySummary.activity_goal_summary', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_class_times', full_name='data.PbDailySummary.activity_class_times', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_distance', full_name='data.PbDailySummary.activity_distance', index=7,
number=8, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=594,
serialized_end=869,
)
_PBACTIVITYGOALSUMMARY.fields_by_name['time_to_go_up'].message_type = types_pb2._PBDURATION
_PBACTIVITYGOALSUMMARY.fields_by_name['time_to_go_walk'].message_type = types_pb2._PBDURATION
_PBACTIVITYGOALSUMMARY.fields_by_name['time_to_go_jog'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_non_wear'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_sleep'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_sedentary'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_light_activity'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_continuous_moderate'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_intermittent_moderate'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_continuous_vigorous'].message_type = types_pb2._PBDURATION
_PBACTIVITYCLASSTIMES.fields_by_name['time_intermittent_vigorous'].message_type = types_pb2._PBDURATION
_PBDAILYSUMMARY.fields_by_name['date'].message_type = types_pb2._PBDATE
_PBDAILYSUMMARY.fields_by_name['activity_goal_summary'].message_type = _PBACTIVITYGOALSUMMARY
_PBDAILYSUMMARY.fields_by_name['activity_class_times'].message_type = _PBACTIVITYCLASSTIMES
DESCRIPTOR.message_types_by_name['PbActivityGoalSummary'] = _PBACTIVITYGOALSUMMARY
DESCRIPTOR.message_types_by_name['PbActivityClassTimes'] = _PBACTIVITYCLASSTIMES
DESCRIPTOR.message_types_by_name['PbDailySummary'] = _PBDAILYSUMMARY
PbActivityGoalSummary = _reflection.GeneratedProtocolMessageType('PbActivityGoalSummary', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYGOALSUMMARY,
__module__ = 'dailysummary_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivityGoalSummary)
))
_sym_db.RegisterMessage(PbActivityGoalSummary)
PbActivityClassTimes = _reflection.GeneratedProtocolMessageType('PbActivityClassTimes', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYCLASSTIMES,
__module__ = 'dailysummary_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivityClassTimes)
))
_sym_db.RegisterMessage(PbActivityClassTimes)
PbDailySummary = _reflection.GeneratedProtocolMessageType('PbDailySummary', (_message.Message,), dict(
DESCRIPTOR = _PBDAILYSUMMARY,
__module__ = 'dailysummary_pb2'
# @@protoc_insertion_point(class_scope:data.PbDailySummary)
))
_sym_db.RegisterMessage(PbDailySummary)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_stats_pb2.py | loophole/polar/pb/exercise_stats_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_stats.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_stats.proto',
package='data',
serialized_pb=_b('\n\x14\x65xercise_stats.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"\xde\x01\n\x19PbSwimmingStyleStatistics\x12\x10\n\x08\x64istance\x18\x01 \x02(\x02\x12\x14\n\x0cstroke_count\x18\x02 \x02(\r\x12(\n\x13swimming_time_total\x18\x03 \x01(\x0b\x32\x0b.PbDuration\x12\x19\n\x11\x61verage_heartrate\x18\x04 \x01(\r\x12\x19\n\x11maximum_heartrate\x18\x05 \x01(\r\x12\x15\n\raverage_swolf\x18\x06 \x01(\x02\x12\"\n\rpool_time_min\x18\x07 \x01(\x0b\x32\x0b.PbDuration\"\x9a\x03\n\x14PbSwimmingStatistics\x12\x19\n\x11swimming_distance\x18\x01 \x02(\x02\x12=\n\x14\x66reestyle_statistics\x18\x02 \x01(\x0b\x32\x1f.data.PbSwimmingStyleStatistics\x12>\n\x15\x62\x61\x63kstroke_statistics\x18\x03 \x01(\x0b\x32\x1f.data.PbSwimmingStyleStatistics\x12@\n\x17\x62reaststroke_statistics\x18\x04 \x01(\x0b\x32\x1f.data.PbSwimmingStyleStatistics\x12=\n\x14\x62utterfly_statistics\x18\x05 \x01(\x0b\x32\x1f.data.PbSwimmingStyleStatistics\x12\x1a\n\x12total_stroke_count\x18\x06 \x01(\r\x12\x1f\n\x17number_of_pools_swimmed\x18\x07 \x01(\r\x12*\n\rswimming_pool\x18\x08 \x01(\x0b\x32\x13.PbSwimmingPoolInfo\"J\n\x15PbHeartRateStatistics\x12\x0f\n\x07minimum\x18\x01 \x01(\r\x12\x0f\n\x07\x61verage\x18\x02 \x01(\r\x12\x0f\n\x07maximum\x18\x03 \x01(\r\"5\n\x11PbSpeedStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\x12\x0f\n\x07maximum\x18\x02 \x01(\x02\"7\n\x13PbCadenceStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\"I\n\x14PbAltitudeStatistics\x12\x0f\n\x07minimum\x18\x01 \x01(\x02\x12\x0f\n\x07\x61verage\x18\x02 \x01(\x02\x12\x0f\n\x07maximum\x18\x03 \x01(\x02\"5\n\x11PbPowerStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x05\x12\x0f\n\x07maximum\x18\x02 \x01(\x05\"0\n\x1dPbCyclingEfficiencyStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"1\n\x1ePbPedalingEfficiencyStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"(\n\x15PbLRBalanceStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\"L\n\x17PbTemperatureStatistics\x12\x0f\n\x07minimum\x18\x01 \x01(\x02\x12\x0f\n\x07\x61verage\x18\x02 \x01(\x02\x12\x0f\n\x07maximum\x18\x03 \x01(\x02\"<\n\x18PbStrideLengthStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\"7\n\x13PbInclineStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\x12\x0f\n\x07maximum\x18\x02 \x01(\x02\"7\n\x13PbDeclineStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\x12\x0f\n\x07maximum\x18\x02 \x01(\x02\"\'\n\x14PbActivityStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\"\xc9\x04\n\x14PbExerciseStatistics\x12/\n\nheart_rate\x18\x01 \x01(\x0b\x32\x1b.data.PbHeartRateStatistics\x12&\n\x05speed\x18\x02 \x01(\x0b\x32\x17.data.PbSpeedStatistics\x12*\n\x07\x63\x61\x64\x65nce\x18\x03 \x01(\x0b\x32\x19.data.PbCadenceStatistics\x12,\n\x08\x61ltitude\x18\x04 \x01(\x0b\x32\x1a.data.PbAltitudeStatistics\x12&\n\x05power\x18\x05 \x01(\x0b\x32\x17.data.PbPowerStatistics\x12\x37\n\x12left_right_balance\x18\x06 \x01(\x0b\x32\x1b.data.PbLRBalanceStatistics\x12\x32\n\x0btemperature\x18\x07 \x01(\x0b\x32\x1d.data.PbTemperatureStatistics\x12,\n\x08\x61\x63tivity\x18\x08 \x01(\x0b\x32\x1a.data.PbActivityStatistics\x12\x35\n\rstride_length\x18\t \x01(\x0b\x32\x1e.data.PbStrideLengthStatistics\x12*\n\x07incline\x18\n \x01(\x0b\x32\x19.data.PbInclineStatistics\x12*\n\x07\x64\x65\x63line\x18\x0b \x01(\x0b\x32\x19.data.PbDeclineStatistics\x12,\n\x08swimming\x18\x0c \x01(\x0b\x32\x1a.data.PbSwimmingStatistics')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSWIMMINGSTYLESTATISTICS = _descriptor.Descriptor(
name='PbSwimmingStyleStatistics',
full_name='data.PbSwimmingStyleStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbSwimmingStyleStatistics.distance', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stroke_count', full_name='data.PbSwimmingStyleStatistics.stroke_count', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming_time_total', full_name='data.PbSwimmingStyleStatistics.swimming_time_total', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_heartrate', full_name='data.PbSwimmingStyleStatistics.average_heartrate', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum_heartrate', full_name='data.PbSwimmingStyleStatistics.maximum_heartrate', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_swolf', full_name='data.PbSwimmingStyleStatistics.average_swolf', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='pool_time_min', full_name='data.PbSwimmingStyleStatistics.pool_time_min', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=62,
serialized_end=284,
)
_PBSWIMMINGSTATISTICS = _descriptor.Descriptor(
name='PbSwimmingStatistics',
full_name='data.PbSwimmingStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='swimming_distance', full_name='data.PbSwimmingStatistics.swimming_distance', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='freestyle_statistics', full_name='data.PbSwimmingStatistics.freestyle_statistics', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='backstroke_statistics', full_name='data.PbSwimmingStatistics.backstroke_statistics', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='breaststroke_statistics', full_name='data.PbSwimmingStatistics.breaststroke_statistics', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='butterfly_statistics', full_name='data.PbSwimmingStatistics.butterfly_statistics', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='total_stroke_count', full_name='data.PbSwimmingStatistics.total_stroke_count', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='number_of_pools_swimmed', full_name='data.PbSwimmingStatistics.number_of_pools_swimmed', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming_pool', full_name='data.PbSwimmingStatistics.swimming_pool', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=287,
serialized_end=697,
)
_PBHEARTRATESTATISTICS = _descriptor.Descriptor(
name='PbHeartRateStatistics',
full_name='data.PbHeartRateStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='minimum', full_name='data.PbHeartRateStatistics.minimum', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average', full_name='data.PbHeartRateStatistics.average', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbHeartRateStatistics.maximum', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=699,
serialized_end=773,
)
_PBSPEEDSTATISTICS = _descriptor.Descriptor(
name='PbSpeedStatistics',
full_name='data.PbSpeedStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbSpeedStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbSpeedStatistics.maximum', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=775,
serialized_end=828,
)
_PBCADENCESTATISTICS = _descriptor.Descriptor(
name='PbCadenceStatistics',
full_name='data.PbCadenceStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbCadenceStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbCadenceStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=830,
serialized_end=885,
)
_PBALTITUDESTATISTICS = _descriptor.Descriptor(
name='PbAltitudeStatistics',
full_name='data.PbAltitudeStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='minimum', full_name='data.PbAltitudeStatistics.minimum', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average', full_name='data.PbAltitudeStatistics.average', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbAltitudeStatistics.maximum', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=887,
serialized_end=960,
)
_PBPOWERSTATISTICS = _descriptor.Descriptor(
name='PbPowerStatistics',
full_name='data.PbPowerStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbPowerStatistics.average', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbPowerStatistics.maximum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=962,
serialized_end=1015,
)
_PBCYCLINGEFFICIENCYSTATISTICS = _descriptor.Descriptor(
name='PbCyclingEfficiencyStatistics',
full_name='data.PbCyclingEfficiencyStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbCyclingEfficiencyStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1017,
serialized_end=1065,
)
_PBPEDALINGEFFICIENCYSTATISTICS = _descriptor.Descriptor(
name='PbPedalingEfficiencyStatistics',
full_name='data.PbPedalingEfficiencyStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbPedalingEfficiencyStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1067,
serialized_end=1116,
)
_PBLRBALANCESTATISTICS = _descriptor.Descriptor(
name='PbLRBalanceStatistics',
full_name='data.PbLRBalanceStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLRBalanceStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1118,
serialized_end=1158,
)
_PBTEMPERATURESTATISTICS = _descriptor.Descriptor(
name='PbTemperatureStatistics',
full_name='data.PbTemperatureStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='minimum', full_name='data.PbTemperatureStatistics.minimum', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average', full_name='data.PbTemperatureStatistics.average', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbTemperatureStatistics.maximum', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1160,
serialized_end=1236,
)
_PBSTRIDELENGTHSTATISTICS = _descriptor.Descriptor(
name='PbStrideLengthStatistics',
full_name='data.PbStrideLengthStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbStrideLengthStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbStrideLengthStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1238,
serialized_end=1298,
)
_PBINCLINESTATISTICS = _descriptor.Descriptor(
name='PbInclineStatistics',
full_name='data.PbInclineStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbInclineStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbInclineStatistics.maximum', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1300,
serialized_end=1355,
)
_PBDECLINESTATISTICS = _descriptor.Descriptor(
name='PbDeclineStatistics',
full_name='data.PbDeclineStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbDeclineStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbDeclineStatistics.maximum', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1357,
serialized_end=1412,
)
_PBACTIVITYSTATISTICS = _descriptor.Descriptor(
name='PbActivityStatistics',
full_name='data.PbActivityStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbActivityStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1414,
serialized_end=1453,
)
_PBEXERCISESTATISTICS = _descriptor.Descriptor(
name='PbExerciseStatistics',
full_name='data.PbExerciseStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_rate', full_name='data.PbExerciseStatistics.heart_rate', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed', full_name='data.PbExerciseStatistics.speed', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence', full_name='data.PbExerciseStatistics.cadence', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude', full_name='data.PbExerciseStatistics.altitude', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power', full_name='data.PbExerciseStatistics.power', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_right_balance', full_name='data.PbExerciseStatistics.left_right_balance', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='temperature', full_name='data.PbExerciseStatistics.temperature', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity', full_name='data.PbExerciseStatistics.activity', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length', full_name='data.PbExerciseStatistics.stride_length', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='incline', full_name='data.PbExerciseStatistics.incline', index=9,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='decline', full_name='data.PbExerciseStatistics.decline', index=10,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming', full_name='data.PbExerciseStatistics.swimming', index=11,
number=12, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1456,
serialized_end=2041,
)
_PBSWIMMINGSTYLESTATISTICS.fields_by_name['swimming_time_total'].message_type = types_pb2._PBDURATION
_PBSWIMMINGSTYLESTATISTICS.fields_by_name['pool_time_min'].message_type = types_pb2._PBDURATION
_PBSWIMMINGSTATISTICS.fields_by_name['freestyle_statistics'].message_type = _PBSWIMMINGSTYLESTATISTICS
_PBSWIMMINGSTATISTICS.fields_by_name['backstroke_statistics'].message_type = _PBSWIMMINGSTYLESTATISTICS
_PBSWIMMINGSTATISTICS.fields_by_name['breaststroke_statistics'].message_type = _PBSWIMMINGSTYLESTATISTICS
_PBSWIMMINGSTATISTICS.fields_by_name['butterfly_statistics'].message_type = _PBSWIMMINGSTYLESTATISTICS
_PBSWIMMINGSTATISTICS.fields_by_name['swimming_pool'].message_type = structures_pb2._PBSWIMMINGPOOLINFO
_PBEXERCISESTATISTICS.fields_by_name['heart_rate'].message_type = _PBHEARTRATESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['speed'].message_type = _PBSPEEDSTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['cadence'].message_type = _PBCADENCESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['altitude'].message_type = _PBALTITUDESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['power'].message_type = _PBPOWERSTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['left_right_balance'].message_type = _PBLRBALANCESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['temperature'].message_type = _PBTEMPERATURESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['activity'].message_type = _PBACTIVITYSTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['stride_length'].message_type = _PBSTRIDELENGTHSTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['incline'].message_type = _PBINCLINESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['decline'].message_type = _PBDECLINESTATISTICS
_PBEXERCISESTATISTICS.fields_by_name['swimming'].message_type = _PBSWIMMINGSTATISTICS
DESCRIPTOR.message_types_by_name['PbSwimmingStyleStatistics'] = _PBSWIMMINGSTYLESTATISTICS
DESCRIPTOR.message_types_by_name['PbSwimmingStatistics'] = _PBSWIMMINGSTATISTICS
DESCRIPTOR.message_types_by_name['PbHeartRateStatistics'] = _PBHEARTRATESTATISTICS
DESCRIPTOR.message_types_by_name['PbSpeedStatistics'] = _PBSPEEDSTATISTICS
DESCRIPTOR.message_types_by_name['PbCadenceStatistics'] = _PBCADENCESTATISTICS
DESCRIPTOR.message_types_by_name['PbAltitudeStatistics'] = _PBALTITUDESTATISTICS
DESCRIPTOR.message_types_by_name['PbPowerStatistics'] = _PBPOWERSTATISTICS
DESCRIPTOR.message_types_by_name['PbCyclingEfficiencyStatistics'] = _PBCYCLINGEFFICIENCYSTATISTICS
DESCRIPTOR.message_types_by_name['PbPedalingEfficiencyStatistics'] = _PBPEDALINGEFFICIENCYSTATISTICS
DESCRIPTOR.message_types_by_name['PbLRBalanceStatistics'] = _PBLRBALANCESTATISTICS
DESCRIPTOR.message_types_by_name['PbTemperatureStatistics'] = _PBTEMPERATURESTATISTICS
DESCRIPTOR.message_types_by_name['PbStrideLengthStatistics'] = _PBSTRIDELENGTHSTATISTICS
DESCRIPTOR.message_types_by_name['PbInclineStatistics'] = _PBINCLINESTATISTICS
DESCRIPTOR.message_types_by_name['PbDeclineStatistics'] = _PBDECLINESTATISTICS
DESCRIPTOR.message_types_by_name['PbActivityStatistics'] = _PBACTIVITYSTATISTICS
DESCRIPTOR.message_types_by_name['PbExerciseStatistics'] = _PBEXERCISESTATISTICS
PbSwimmingStyleStatistics = _reflection.GeneratedProtocolMessageType('PbSwimmingStyleStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBSWIMMINGSTYLESTATISTICS,
__module__ = 'exercise_stats_pb2'
# @@protoc_insertion_point(class_scope:data.PbSwimmingStyleStatistics)
))
_sym_db.RegisterMessage(PbSwimmingStyleStatistics)
PbSwimmingStatistics = _reflection.GeneratedProtocolMessageType('PbSwimmingStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBSWIMMINGSTATISTICS,
__module__ = 'exercise_stats_pb2'
# @@protoc_insertion_point(class_scope:data.PbSwimmingStatistics)
))
_sym_db.RegisterMessage(PbSwimmingStatistics)
PbHeartRateStatistics = _reflection.GeneratedProtocolMessageType('PbHeartRateStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBHEARTRATESTATISTICS,
__module__ = 'exercise_stats_pb2'
# @@protoc_insertion_point(class_scope:data.PbHeartRateStatistics)
))
_sym_db.RegisterMessage(PbHeartRateStatistics)
PbSpeedStatistics = _reflection.GeneratedProtocolMessageType('PbSpeedStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBSPEEDSTATISTICS,
__module__ = 'exercise_stats_pb2'
# @@protoc_insertion_point(class_scope:data.PbSpeedStatistics)
))
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_test_prefs_pb2.py | loophole/polar/pb/user_test_prefs_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_test_prefs.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_test_prefs.proto',
package='data',
serialized_pb=_b('\n\x15user_test_prefs.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"s\n\x15PbUserTestPreferences\x12\x30\n\x16orthostatic_test_reset\x18\x01 \x01(\x0b\x32\x10.PbLocalDateTime\x12(\n\rlast_modified\x18\x65 \x02(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBUSERTESTPREFERENCES = _descriptor.Descriptor(
name='PbUserTestPreferences',
full_name='data.PbUserTestPreferences',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='orthostatic_test_reset', full_name='data.PbUserTestPreferences.orthostatic_test_reset', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserTestPreferences.last_modified', index=1,
number=101, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=44,
serialized_end=159,
)
_PBUSERTESTPREFERENCES.fields_by_name['orthostatic_test_reset'].message_type = types_pb2._PBLOCALDATETIME
_PBUSERTESTPREFERENCES.fields_by_name['last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbUserTestPreferences'] = _PBUSERTESTPREFERENCES
PbUserTestPreferences = _reflection.GeneratedProtocolMessageType('PbUserTestPreferences', (_message.Message,), dict(
DESCRIPTOR = _PBUSERTESTPREFERENCES,
__module__ = 'user_test_prefs_pb2'
# @@protoc_insertion_point(class_scope:data.PbUserTestPreferences)
))
_sym_db.RegisterMessage(PbUserTestPreferences)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/structures_pb2.py | loophole/polar/pb/structures_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: structures.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='structures.proto',
package='',
syntax='proto2',
serialized_pb=_b('\n\x10structures.proto\x1a\x0btypes.proto\"\x85\x02\n\x0ePbVolumeTarget\x12\x37\n\x0btarget_type\x18\x01 \x02(\x0e\x32\".PbVolumeTarget.PbVolymeTargetType\x12\x1d\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x0b.PbDuration\x12\x10\n\x08\x64istance\x18\x03 \x01(\x02\x12\x10\n\x08\x63\x61lories\x18\x04 \x01(\r\"w\n\x12PbVolymeTargetType\x12\x1f\n\x1bVOLUME_TARGET_TYPE_DURATION\x10\x00\x12\x1f\n\x1bVOLUME_TARGET_TYPE_DISTANCE\x10\x01\x12\x1f\n\x1bVOLUME_TARGET_TYPE_CALORIES\x10\x02\"U\n\x16PbStravaSegmentTargets\x12\x1d\n\x08own_best\x18\x01 \x01(\x0b\x32\x0b.PbDuration\x12\x1c\n\x07kom_qom\x18\x02 \x01(\x0b\x32\x0b.PbDuration\"\xeb\x01\n\x15PbStravaSegmentTarget\x12G\n\x13strava_segment_type\x18\x01 \x02(\x0e\x32*.PbStravaSegmentTarget.PbStravaSegmentType\x12\x37\n\x16strava_segment_targets\x18\x02 \x01(\x0b\x32\x17.PbStravaSegmentTargets\"P\n\x13PbStravaSegmentType\x12\x1c\n\x18STRAVA_SEGMENT_TYPE_RIDE\x10\x01\x12\x1b\n\x17STRAVA_SEGMENT_TYPE_RUN\x10\x02\"\xb2\x02\n\x0ePbTrainingLoad\x12\x19\n\x11training_load_val\x18\x01 \x01(\r\x12\"\n\rrecovery_time\x18\x02 \x01(\x0b\x32\x0b.PbDuration\x12 \n\x18\x63\x61rbohydrate_consumption\x18\x03 \x01(\r\x12\x1b\n\x13protein_consumption\x18\x04 \x01(\r\x12\x17\n\x0f\x66\x61t_consumption\x18\x05 \x01(\r\x12\x1a\n\x12\x63\x61rbohydrate_grams\x18\x06 \x01(\x02\x12\x15\n\rprotein_grams\x18\x07 \x01(\x02\x12\x11\n\tfat_grams\x18\x08 \x01(\x02\x12\x11\n\tmeal_size\x18\t \x01(\x02\x12\x30\n\x1b\x66ueling_reminder_timestamps\x18\n \x03(\x0b\x32\x0b.PbDuration\"<\n\x0fPbHeartRateZone\x12\x13\n\x0blower_limit\x18\x01 \x02(\r\x12\x14\n\x0chigher_limit\x18\x02 \x02(\r\"8\n\x0bPbSpeedZone\x12\x13\n\x0blower_limit\x18\x01 \x02(\x02\x12\x14\n\x0chigher_limit\x18\x02 \x02(\x02\"8\n\x0bPbPowerZone\x12\x13\n\x0blower_limit\x18\x01 \x02(\r\x12\x14\n\x0chigher_limit\x18\x02 \x02(\r\"\xac\x02\n\x07PbZones\x12)\n\x0fheart_rate_zone\x18\x01 \x03(\x0b\x32\x10.PbHeartRateZone\x12 \n\nspeed_zone\x18\x02 \x03(\x0b\x32\x0c.PbSpeedZone\x12 \n\npower_zone\x18\x03 \x03(\x0b\x32\x0c.PbPowerZone\x12@\n\x19heart_rate_setting_source\x18\n \x01(\x0e\x32\x1d.PbHeartRateZoneSettingSource\x12\x37\n\x14power_setting_source\x18\x0b \x01(\x0e\x32\x19.PbPowerZoneSettingSource\x12\x37\n\x14speed_setting_source\x18\x0c \x01(\x0e\x32\x19.PbSpeedZoneSettingSource\"1\n\x08PbBleMac\x12\x0b\n\x03mac\x18\x01 \x02(\x0c\x12\x18\n\x04type\x18\x02 \x02(\x0e\x32\n.PbMacType\"\x1f\n\x0fPbBleDeviceName\x12\x0c\n\x04name\x18\x01 \x02(\t\"\x1f\n\nPbDeviceId\x12\x11\n\tdevice_id\x18\x01 \x02(\t\"F\n\x0ePbRunningIndex\x12\r\n\x05value\x18\x01 \x02(\r\x12%\n\x10\x63\x61lculation_time\x18\x02 \x01(\x0b\x32\x0b.PbDuration\"\"\n\x11PbSportIdentifier\x12\r\n\x05value\x18\x01 \x02(\x04\"\x1d\n\rPbOneLineText\x12\x0c\n\x04text\x18\x01 \x02(\t\"\x1f\n\x0fPbMultiLineText\x12\x0c\n\x04text\x18\x01 \x02(\t\" \n\x0cPbLanguageId\x12\x10\n\x08language\x18\x01 \x02(\t\"T\n\x19PbTrainingSessionTargetId\x12\r\n\x05value\x18\x01 \x02(\x04\x12(\n\rlast_modified\x18\x02 \x01(\x0b\x32\x11.PbSystemDateTime\"V\n\x1bPbTrainingSessionFavoriteId\x12\r\n\x05value\x18\x01 \x02(\x04\x12(\n\rlast_modified\x18\x02 \x01(\x0b\x32\x11.PbSystemDateTime\"\x1a\n\tPbRouteId\x12\r\n\x05value\x18\x01 \x02(\x04\"[\n\x12PbSwimmingPoolInfo\x12\x13\n\x0bpool_length\x18\x01 \x01(\x02\x12\x30\n\x12swimming_pool_type\x18\x02 \x02(\x0e\x32\x14.PbSwimmingPoolUnits\"$\n\x13PbTrainingProgramId\x12\r\n\x05value\x18\x01 \x02(\x04\"\x1a\n\tPbEventId\x12\r\n\x05value\x18\x01 \x02(\x04\"/\n\x1ePbOnDemandTrainingTargetTypeId\x12\r\n\x05value\x18\x01 \x02(\x04\"M\n\x0bPbPauseTime\x12\x1f\n\nstart_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x1d\n\x08\x64uration\x18\x02 \x02(\x0b\x32\x0b.PbDuration\" \n\x0fPbApplicationId\x12\r\n\x05value\x18\x01 \x02(\x04\"K\n\tPbVersion\x12\r\n\x05major\x18\x01 \x02(\r\x12\r\n\x05minor\x18\x02 \x02(\r\x12\r\n\x05patch\x18\x03 \x02(\r\x12\x11\n\tspecifier\x18\x04 \x01(\t\"5\n\x12PbAlgorithmVersion\x12\x1f\n\x0bohr_version\x18\x01 \x01(\x0b\x32\n.PbVersion\"n\n\x12PbSubcomponentInfo\x12\x0c\n\x04name\x18\x01 \x02(\t\x12-\n\x19OBSOLETE_required_version\x18\x02 \x01(\x0b\x32\n.PbVersion\x12\x1b\n\x07version\x18\x03 \x01(\x0b\x32\n.PbVersion\"\x19\n\tPbBleUuid\x12\x0c\n\x04uuid\x18\x01 \x02(\x0c\"?\n\x13PbBleCharacteristic\x12\x0e\n\x06handle\x18\x01 \x02(\r\x12\x18\n\x04type\x18\x02 \x02(\x0b\x32\n.PbBleUuid\"^\n\x0cPbBleService\x12\x1f\n\x0bserviceUuid\x18\x01 \x02(\x0b\x32\n.PbBleUuid\x12-\n\x0f\x63haracteristics\x18\x02 \x03(\x0b\x32\x14.PbBleCharacteristic\"\xfd\x01\n\x0ePbSourceDevice\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x14\n\x0cmanufacturer\x18\x02 \x01(\t\x12\x14\n\x0cmodel_number\x18\x03 \x01(\t\x12\x15\n\rhardware_code\x18\x04 \x01(\t\x12$\n\x10platform_version\x18\x05 \x01(\x0b\x32\n.PbVersion\x12$\n\x10software_version\x18\x06 \x01(\x0b\x32\n.PbVersion\x12*\n\x16polarmathsmart_version\x18\x07 \x01(\x0b\x32\n.PbVersion\x12\"\n\tcollector\x18\x08 \x01(\x0b\x32\x0f.PbSourceDevice\"S\n\x14PbSampleSourceDevice\x12\x13\n\x0bstart_index\x18\x01 \x02(\r\x12&\n\rsource_device\x18\x02 \x02(\x0b\x32\x0f.PbSourceDevice\"\xc8\x01\n\x1cPbStrengthTrainingResistance\x12W\n\x0fresistance_type\x18\x01 \x02(\x0e\x32>.PbStrengthTrainingResistance.PbStrengthTrainingResistanceType\x12\x0e\n\x06weight\x18\x02 \x01(\x02\"?\n PbStrengthTrainingResistanceType\x12\x0f\n\x0b\x42ODY_WEIGHT\x10\x00\x12\n\n\x06WEIGHT\x10\x01')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBVOLUMETARGET_PBVOLYMETARGETTYPE = _descriptor.EnumDescriptor(
name='PbVolymeTargetType',
full_name='PbVolumeTarget.PbVolymeTargetType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='VOLUME_TARGET_TYPE_DURATION', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='VOLUME_TARGET_TYPE_DISTANCE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='VOLUME_TARGET_TYPE_CALORIES', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=176,
serialized_end=295,
)
_sym_db.RegisterEnumDescriptor(_PBVOLUMETARGET_PBVOLYMETARGETTYPE)
_PBSTRAVASEGMENTTARGET_PBSTRAVASEGMENTTYPE = _descriptor.EnumDescriptor(
name='PbStravaSegmentType',
full_name='PbStravaSegmentTarget.PbStravaSegmentType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='STRAVA_SEGMENT_TYPE_RIDE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STRAVA_SEGMENT_TYPE_RUN', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=540,
serialized_end=620,
)
_sym_db.RegisterEnumDescriptor(_PBSTRAVASEGMENTTARGET_PBSTRAVASEGMENTTYPE)
_PBSTRENGTHTRAININGRESISTANCE_PBSTRENGTHTRAININGRESISTANCETYPE = _descriptor.EnumDescriptor(
name='PbStrengthTrainingResistanceType',
full_name='PbStrengthTrainingResistance.PbStrengthTrainingResistanceType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='BODY_WEIGHT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WEIGHT', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3169,
serialized_end=3232,
)
_sym_db.RegisterEnumDescriptor(_PBSTRENGTHTRAININGRESISTANCE_PBSTRENGTHTRAININGRESISTANCETYPE)
_PBVOLUMETARGET = _descriptor.Descriptor(
name='PbVolumeTarget',
full_name='PbVolumeTarget',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='target_type', full_name='PbVolumeTarget.target_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='PbVolumeTarget.duration', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='PbVolumeTarget.distance', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calories', full_name='PbVolumeTarget.calories', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBVOLUMETARGET_PBVOLYMETARGETTYPE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=34,
serialized_end=295,
)
_PBSTRAVASEGMENTTARGETS = _descriptor.Descriptor(
name='PbStravaSegmentTargets',
full_name='PbStravaSegmentTargets',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='own_best', full_name='PbStravaSegmentTargets.own_best', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='kom_qom', full_name='PbStravaSegmentTargets.kom_qom', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=297,
serialized_end=382,
)
_PBSTRAVASEGMENTTARGET = _descriptor.Descriptor(
name='PbStravaSegmentTarget',
full_name='PbStravaSegmentTarget',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='strava_segment_type', full_name='PbStravaSegmentTarget.strava_segment_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='strava_segment_targets', full_name='PbStravaSegmentTarget.strava_segment_targets', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBSTRAVASEGMENTTARGET_PBSTRAVASEGMENTTYPE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=385,
serialized_end=620,
)
_PBTRAININGLOAD = _descriptor.Descriptor(
name='PbTrainingLoad',
full_name='PbTrainingLoad',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='training_load_val', full_name='PbTrainingLoad.training_load_val', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recovery_time', full_name='PbTrainingLoad.recovery_time', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='carbohydrate_consumption', full_name='PbTrainingLoad.carbohydrate_consumption', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='protein_consumption', full_name='PbTrainingLoad.protein_consumption', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fat_consumption', full_name='PbTrainingLoad.fat_consumption', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='carbohydrate_grams', full_name='PbTrainingLoad.carbohydrate_grams', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='protein_grams', full_name='PbTrainingLoad.protein_grams', index=6,
number=7, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fat_grams', full_name='PbTrainingLoad.fat_grams', index=7,
number=8, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='meal_size', full_name='PbTrainingLoad.meal_size', index=8,
number=9, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fueling_reminder_timestamps', full_name='PbTrainingLoad.fueling_reminder_timestamps', index=9,
number=10, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=623,
serialized_end=929,
)
_PBHEARTRATEZONE = _descriptor.Descriptor(
name='PbHeartRateZone',
full_name='PbHeartRateZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='lower_limit', full_name='PbHeartRateZone.lower_limit', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='higher_limit', full_name='PbHeartRateZone.higher_limit', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=931,
serialized_end=991,
)
_PBSPEEDZONE = _descriptor.Descriptor(
name='PbSpeedZone',
full_name='PbSpeedZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='lower_limit', full_name='PbSpeedZone.lower_limit', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='higher_limit', full_name='PbSpeedZone.higher_limit', index=1,
number=2, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=993,
serialized_end=1049,
)
_PBPOWERZONE = _descriptor.Descriptor(
name='PbPowerZone',
full_name='PbPowerZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='lower_limit', full_name='PbPowerZone.lower_limit', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='higher_limit', full_name='PbPowerZone.higher_limit', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1051,
serialized_end=1107,
)
_PBZONES = _descriptor.Descriptor(
name='PbZones',
full_name='PbZones',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_rate_zone', full_name='PbZones.heart_rate_zone', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_zone', full_name='PbZones.speed_zone', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power_zone', full_name='PbZones.power_zone', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_setting_source', full_name='PbZones.heart_rate_setting_source', index=3,
number=10, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power_setting_source', full_name='PbZones.power_setting_source', index=4,
number=11, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_setting_source', full_name='PbZones.speed_setting_source', index=5,
number=12, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1110,
serialized_end=1410,
)
_PBBLEMAC = _descriptor.Descriptor(
name='PbBleMac',
full_name='PbBleMac',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mac', full_name='PbBleMac.mac', index=0,
number=1, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='type', full_name='PbBleMac.type', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1412,
serialized_end=1461,
)
_PBBLEDEVICENAME = _descriptor.Descriptor(
name='PbBleDeviceName',
full_name='PbBleDeviceName',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='PbBleDeviceName.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1463,
serialized_end=1494,
)
_PBDEVICEID = _descriptor.Descriptor(
name='PbDeviceId',
full_name='PbDeviceId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='device_id', full_name='PbDeviceId.device_id', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1496,
serialized_end=1527,
)
_PBRUNNINGINDEX = _descriptor.Descriptor(
name='PbRunningIndex',
full_name='PbRunningIndex',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbRunningIndex.value', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calculation_time', full_name='PbRunningIndex.calculation_time', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1529,
serialized_end=1599,
)
_PBSPORTIDENTIFIER = _descriptor.Descriptor(
name='PbSportIdentifier',
full_name='PbSportIdentifier',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbSportIdentifier.value', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1601,
serialized_end=1635,
)
_PBONELINETEXT = _descriptor.Descriptor(
name='PbOneLineText',
full_name='PbOneLineText',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='text', full_name='PbOneLineText.text', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1637,
serialized_end=1666,
)
_PBMULTILINETEXT = _descriptor.Descriptor(
name='PbMultiLineText',
full_name='PbMultiLineText',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='text', full_name='PbMultiLineText.text', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1668,
serialized_end=1699,
)
_PBLANGUAGEID = _descriptor.Descriptor(
name='PbLanguageId',
full_name='PbLanguageId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='language', full_name='PbLanguageId.language', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1701,
serialized_end=1733,
)
_PBTRAININGSESSIONTARGETID = _descriptor.Descriptor(
name='PbTrainingSessionTargetId',
full_name='PbTrainingSessionTargetId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbTrainingSessionTargetId.value', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='PbTrainingSessionTargetId.last_modified', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1735,
serialized_end=1819,
)
_PBTRAININGSESSIONFAVORITEID = _descriptor.Descriptor(
name='PbTrainingSessionFavoriteId',
full_name='PbTrainingSessionFavoriteId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbTrainingSessionFavoriteId.value', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='PbTrainingSessionFavoriteId.last_modified', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1821,
serialized_end=1907,
)
_PBROUTEID = _descriptor.Descriptor(
name='PbRouteId',
full_name='PbRouteId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbRouteId.value', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1909,
serialized_end=1935,
)
_PBSWIMMINGPOOLINFO = _descriptor.Descriptor(
name='PbSwimmingPoolInfo',
full_name='PbSwimmingPoolInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='pool_length', full_name='PbSwimmingPoolInfo.pool_length', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming_pool_type', full_name='PbSwimmingPoolInfo.swimming_pool_type', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1937,
serialized_end=2028,
)
_PBTRAININGPROGRAMID = _descriptor.Descriptor(
name='PbTrainingProgramId',
full_name='PbTrainingProgramId',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='PbTrainingProgramId.value', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2030,
serialized_end=2066,
)
_PBEVENTID = _descriptor.Descriptor(
name='PbEventId',
full_name='PbEventId',
filename=None,
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_sensors_pb2.py | loophole/polar/pb/exercise_sensors_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_sensors.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_sensors.proto',
package='data',
serialized_pb=_b('\n\x16\x65xercise_sensors.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\"q\n\x10PbExerciseSensor\x12\x16\n\x03mac\x18\x01 \x02(\x0b\x32\t.PbBleMac\x12\x1e\n\tdevice_id\x18\x02 \x01(\x0b\x32\x0b.PbDeviceId\x12%\n\x0b\x64\x65vice_name\x18\x03 \x01(\x0b\x32\x10.PbBleDeviceName\"<\n\x11PbExerciseSensors\x12\'\n\x07sensors\x18\x01 \x03(\x0b\x32\x16.data.PbExerciseSensor')
,
dependencies=[structures_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBEXERCISESENSOR = _descriptor.Descriptor(
name='PbExerciseSensor',
full_name='data.PbExerciseSensor',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mac', full_name='data.PbExerciseSensor.mac', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_id', full_name='data.PbExerciseSensor.device_id', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_name', full_name='data.PbExerciseSensor.device_name', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=50,
serialized_end=163,
)
_PBEXERCISESENSORS = _descriptor.Descriptor(
name='PbExerciseSensors',
full_name='data.PbExerciseSensors',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sensors', full_name='data.PbExerciseSensors.sensors', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=165,
serialized_end=225,
)
_PBEXERCISESENSOR.fields_by_name['mac'].message_type = structures_pb2._PBBLEMAC
_PBEXERCISESENSOR.fields_by_name['device_id'].message_type = structures_pb2._PBDEVICEID
_PBEXERCISESENSOR.fields_by_name['device_name'].message_type = structures_pb2._PBBLEDEVICENAME
_PBEXERCISESENSORS.fields_by_name['sensors'].message_type = _PBEXERCISESENSOR
DESCRIPTOR.message_types_by_name['PbExerciseSensor'] = _PBEXERCISESENSOR
DESCRIPTOR.message_types_by_name['PbExerciseSensors'] = _PBEXERCISESENSORS
PbExerciseSensor = _reflection.GeneratedProtocolMessageType('PbExerciseSensor', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISESENSOR,
__module__ = 'exercise_sensors_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseSensor)
))
_sym_db.RegisterMessage(PbExerciseSensor)
PbExerciseSensors = _reflection.GeneratedProtocolMessageType('PbExerciseSensors', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISESENSORS,
__module__ = 'exercise_sensors_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseSensors)
))
_sym_db.RegisterMessage(PbExerciseSensors)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/pftp_response_pb2.py | loophole/polar/pb/pftp_response_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pftp/pftp_response.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='pftp/pftp_response.proto',
package='protocol',
syntax='proto2',
serialized_pb=_b('\n\x18pftp/pftp_response.proto\x12\x08protocol\x1a\x0btypes.proto\"\x96\x01\n\x0bPbPFtpEntry\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x0c\n\x04size\x18\x02 \x02(\x04\x12\"\n\x07\x63reated\x18\x03 \x01(\x0b\x32\x11.PbSystemDateTime\x12#\n\x08modified\x18\x04 \x01(\x0b\x32\x11.PbSystemDateTime\x12\"\n\x07touched\x18\x05 \x01(\x0b\x32\x11.PbSystemDateTime\"9\n\x0fPbPFtpDirectory\x12&\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.protocol.PbPFtpEntry\"/\n\x1aPbPFtpIdentifyDeviceResult\x12\x11\n\tdevice_id\x18\x01 \x02(\t\"Z\n\x19PbPFtpGetSystemTimeResult\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x0f\n\x07trusted\x18\x03 \x02(\x08\"[\n\x18PbPFtpGetLocalTimeResult\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x11\n\ttz_offset\x18\x03 \x01(\x05\"_\n\x15PbPFtpDiskSpaceResult\x12\x15\n\rfragment_size\x18\x01 \x02(\r\x12\x17\n\x0ftotal_fragments\x18\x02 \x02(\x04\x12\x16\n\x0e\x66ree_fragments\x18\x03 \x02(\x04\"3\n\"PbPFtpGenerateChallengeTokenResult\x12\r\n\x05token\x18\x01 \x02(\x0c\"\xcd\x01\n\"PbPFtpGenerateAsymmetricKeysResult\x12\x12\n\npublic_key\x18\x01 \x01(\x0c\x12\x61\n\x15\x61symmetric_key_format\x18\x02 \x01(\x0e\x32\x42.protocol.PbPFtpGenerateAsymmetricKeysResult.PbAsymmetricKeyFormat\"0\n\x15PbAsymmetricKeyFormat\x12\x17\n\x13SEC256KL_COMPRESSED\x10\x00\"E\n\x19PbPFtpBatteryStatusResult\x12\x16\n\x0e\x62\x61ttery_status\x18\x01 \x02(\r\x12\x10\n\x08\x63harging\x18\x02 \x01(\x08\"D\n!PbPFtpGetInactivityPreAlertResult\x12\x1f\n\x17inactivity_pre_alert_on\x18\x01 \x02(\x08\"V\n\x1ePbRequestRecordingStatusResult\x12\x14\n\x0crecording_on\x18\x01 \x02(\x08\x12\x1e\n\x16sample_data_identifier\x18\x02 \x01(\t\",\n\x16PbRequestDisplayStatus\x12\x12\n\ndisplay_on\x18\x01 \x02(\x08\"9\n\x1dPbPFtpGetVisualElementsResult\x12\x18\n\x10visual_data_path\x18\x01 \x02(\t')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPFTPGENERATEASYMMETRICKEYSRESULT_PBASYMMETRICKEYFORMAT = _descriptor.EnumDescriptor(
name='PbAsymmetricKeyFormat',
full_name='protocol.PbPFtpGenerateAsymmetricKeysResult.PbAsymmetricKeyFormat',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SEC256KL_COMPRESSED', index=0, number=0,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=805,
serialized_end=853,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPGENERATEASYMMETRICKEYSRESULT_PBASYMMETRICKEYFORMAT)
_PBPFTPENTRY = _descriptor.Descriptor(
name='PbPFtpEntry',
full_name='protocol.PbPFtpEntry',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='protocol.PbPFtpEntry.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='size', full_name='protocol.PbPFtpEntry.size', index=1,
number=2, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='created', full_name='protocol.PbPFtpEntry.created', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='modified', full_name='protocol.PbPFtpEntry.modified', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='touched', full_name='protocol.PbPFtpEntry.touched', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=52,
serialized_end=202,
)
_PBPFTPDIRECTORY = _descriptor.Descriptor(
name='PbPFtpDirectory',
full_name='protocol.PbPFtpDirectory',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='entries', full_name='protocol.PbPFtpDirectory.entries', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=204,
serialized_end=261,
)
_PBPFTPIDENTIFYDEVICERESULT = _descriptor.Descriptor(
name='PbPFtpIdentifyDeviceResult',
full_name='protocol.PbPFtpIdentifyDeviceResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='device_id', full_name='protocol.PbPFtpIdentifyDeviceResult.device_id', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=263,
serialized_end=310,
)
_PBPFTPGETSYSTEMTIMERESULT = _descriptor.Descriptor(
name='PbPFtpGetSystemTimeResult',
full_name='protocol.PbPFtpGetSystemTimeResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='date', full_name='protocol.PbPFtpGetSystemTimeResult.date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time', full_name='protocol.PbPFtpGetSystemTimeResult.time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='trusted', full_name='protocol.PbPFtpGetSystemTimeResult.trusted', index=2,
number=3, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=312,
serialized_end=402,
)
_PBPFTPGETLOCALTIMERESULT = _descriptor.Descriptor(
name='PbPFtpGetLocalTimeResult',
full_name='protocol.PbPFtpGetLocalTimeResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='date', full_name='protocol.PbPFtpGetLocalTimeResult.date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time', full_name='protocol.PbPFtpGetLocalTimeResult.time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tz_offset', full_name='protocol.PbPFtpGetLocalTimeResult.tz_offset', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=404,
serialized_end=495,
)
_PBPFTPDISKSPACERESULT = _descriptor.Descriptor(
name='PbPFtpDiskSpaceResult',
full_name='protocol.PbPFtpDiskSpaceResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='fragment_size', full_name='protocol.PbPFtpDiskSpaceResult.fragment_size', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='total_fragments', full_name='protocol.PbPFtpDiskSpaceResult.total_fragments', index=1,
number=2, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='free_fragments', full_name='protocol.PbPFtpDiskSpaceResult.free_fragments', index=2,
number=3, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=497,
serialized_end=592,
)
_PBPFTPGENERATECHALLENGETOKENRESULT = _descriptor.Descriptor(
name='PbPFtpGenerateChallengeTokenResult',
full_name='protocol.PbPFtpGenerateChallengeTokenResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='token', full_name='protocol.PbPFtpGenerateChallengeTokenResult.token', index=0,
number=1, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=594,
serialized_end=645,
)
_PBPFTPGENERATEASYMMETRICKEYSRESULT = _descriptor.Descriptor(
name='PbPFtpGenerateAsymmetricKeysResult',
full_name='protocol.PbPFtpGenerateAsymmetricKeysResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='public_key', full_name='protocol.PbPFtpGenerateAsymmetricKeysResult.public_key', index=0,
number=1, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='asymmetric_key_format', full_name='protocol.PbPFtpGenerateAsymmetricKeysResult.asymmetric_key_format', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBPFTPGENERATEASYMMETRICKEYSRESULT_PBASYMMETRICKEYFORMAT,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=648,
serialized_end=853,
)
_PBPFTPBATTERYSTATUSRESULT = _descriptor.Descriptor(
name='PbPFtpBatteryStatusResult',
full_name='protocol.PbPFtpBatteryStatusResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='battery_status', full_name='protocol.PbPFtpBatteryStatusResult.battery_status', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='charging', full_name='protocol.PbPFtpBatteryStatusResult.charging', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=855,
serialized_end=924,
)
_PBPFTPGETINACTIVITYPREALERTRESULT = _descriptor.Descriptor(
name='PbPFtpGetInactivityPreAlertResult',
full_name='protocol.PbPFtpGetInactivityPreAlertResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='inactivity_pre_alert_on', full_name='protocol.PbPFtpGetInactivityPreAlertResult.inactivity_pre_alert_on', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=926,
serialized_end=994,
)
_PBREQUESTRECORDINGSTATUSRESULT = _descriptor.Descriptor(
name='PbRequestRecordingStatusResult',
full_name='protocol.PbRequestRecordingStatusResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='recording_on', full_name='protocol.PbRequestRecordingStatusResult.recording_on', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sample_data_identifier', full_name='protocol.PbRequestRecordingStatusResult.sample_data_identifier', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=996,
serialized_end=1082,
)
_PBREQUESTDISPLAYSTATUS = _descriptor.Descriptor(
name='PbRequestDisplayStatus',
full_name='protocol.PbRequestDisplayStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='display_on', full_name='protocol.PbRequestDisplayStatus.display_on', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1084,
serialized_end=1128,
)
_PBPFTPGETVISUALELEMENTSRESULT = _descriptor.Descriptor(
name='PbPFtpGetVisualElementsResult',
full_name='protocol.PbPFtpGetVisualElementsResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='visual_data_path', full_name='protocol.PbPFtpGetVisualElementsResult.visual_data_path', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1130,
serialized_end=1187,
)
_PBPFTPENTRY.fields_by_name['created'].message_type = types__pb2._PBSYSTEMDATETIME
_PBPFTPENTRY.fields_by_name['modified'].message_type = types__pb2._PBSYSTEMDATETIME
_PBPFTPENTRY.fields_by_name['touched'].message_type = types__pb2._PBSYSTEMDATETIME
_PBPFTPDIRECTORY.fields_by_name['entries'].message_type = _PBPFTPENTRY
_PBPFTPGETSYSTEMTIMERESULT.fields_by_name['date'].message_type = types__pb2._PBDATE
_PBPFTPGETSYSTEMTIMERESULT.fields_by_name['time'].message_type = types__pb2._PBTIME
_PBPFTPGETLOCALTIMERESULT.fields_by_name['date'].message_type = types__pb2._PBDATE
_PBPFTPGETLOCALTIMERESULT.fields_by_name['time'].message_type = types__pb2._PBTIME
_PBPFTPGENERATEASYMMETRICKEYSRESULT.fields_by_name['asymmetric_key_format'].enum_type = _PBPFTPGENERATEASYMMETRICKEYSRESULT_PBASYMMETRICKEYFORMAT
_PBPFTPGENERATEASYMMETRICKEYSRESULT_PBASYMMETRICKEYFORMAT.containing_type = _PBPFTPGENERATEASYMMETRICKEYSRESULT
DESCRIPTOR.message_types_by_name['PbPFtpEntry'] = _PBPFTPENTRY
DESCRIPTOR.message_types_by_name['PbPFtpDirectory'] = _PBPFTPDIRECTORY
DESCRIPTOR.message_types_by_name['PbPFtpIdentifyDeviceResult'] = _PBPFTPIDENTIFYDEVICERESULT
DESCRIPTOR.message_types_by_name['PbPFtpGetSystemTimeResult'] = _PBPFTPGETSYSTEMTIMERESULT
DESCRIPTOR.message_types_by_name['PbPFtpGetLocalTimeResult'] = _PBPFTPGETLOCALTIMERESULT
DESCRIPTOR.message_types_by_name['PbPFtpDiskSpaceResult'] = _PBPFTPDISKSPACERESULT
DESCRIPTOR.message_types_by_name['PbPFtpGenerateChallengeTokenResult'] = _PBPFTPGENERATECHALLENGETOKENRESULT
DESCRIPTOR.message_types_by_name['PbPFtpGenerateAsymmetricKeysResult'] = _PBPFTPGENERATEASYMMETRICKEYSRESULT
DESCRIPTOR.message_types_by_name['PbPFtpBatteryStatusResult'] = _PBPFTPBATTERYSTATUSRESULT
DESCRIPTOR.message_types_by_name['PbPFtpGetInactivityPreAlertResult'] = _PBPFTPGETINACTIVITYPREALERTRESULT
DESCRIPTOR.message_types_by_name['PbRequestRecordingStatusResult'] = _PBREQUESTRECORDINGSTATUSRESULT
DESCRIPTOR.message_types_by_name['PbRequestDisplayStatus'] = _PBREQUESTDISPLAYSTATUS
DESCRIPTOR.message_types_by_name['PbPFtpGetVisualElementsResult'] = _PBPFTPGETVISUALELEMENTSRESULT
PbPFtpEntry = _reflection.GeneratedProtocolMessageType('PbPFtpEntry', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPENTRY,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpEntry)
))
_sym_db.RegisterMessage(PbPFtpEntry)
PbPFtpDirectory = _reflection.GeneratedProtocolMessageType('PbPFtpDirectory', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPDIRECTORY,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpDirectory)
))
_sym_db.RegisterMessage(PbPFtpDirectory)
PbPFtpIdentifyDeviceResult = _reflection.GeneratedProtocolMessageType('PbPFtpIdentifyDeviceResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPIDENTIFYDEVICERESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpIdentifyDeviceResult)
))
_sym_db.RegisterMessage(PbPFtpIdentifyDeviceResult)
PbPFtpGetSystemTimeResult = _reflection.GeneratedProtocolMessageType('PbPFtpGetSystemTimeResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGETSYSTEMTIMERESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGetSystemTimeResult)
))
_sym_db.RegisterMessage(PbPFtpGetSystemTimeResult)
PbPFtpGetLocalTimeResult = _reflection.GeneratedProtocolMessageType('PbPFtpGetLocalTimeResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGETLOCALTIMERESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGetLocalTimeResult)
))
_sym_db.RegisterMessage(PbPFtpGetLocalTimeResult)
PbPFtpDiskSpaceResult = _reflection.GeneratedProtocolMessageType('PbPFtpDiskSpaceResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPDISKSPACERESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpDiskSpaceResult)
))
_sym_db.RegisterMessage(PbPFtpDiskSpaceResult)
PbPFtpGenerateChallengeTokenResult = _reflection.GeneratedProtocolMessageType('PbPFtpGenerateChallengeTokenResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGENERATECHALLENGETOKENRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGenerateChallengeTokenResult)
))
_sym_db.RegisterMessage(PbPFtpGenerateChallengeTokenResult)
PbPFtpGenerateAsymmetricKeysResult = _reflection.GeneratedProtocolMessageType('PbPFtpGenerateAsymmetricKeysResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGENERATEASYMMETRICKEYSRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGenerateAsymmetricKeysResult)
))
_sym_db.RegisterMessage(PbPFtpGenerateAsymmetricKeysResult)
PbPFtpBatteryStatusResult = _reflection.GeneratedProtocolMessageType('PbPFtpBatteryStatusResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPBATTERYSTATUSRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpBatteryStatusResult)
))
_sym_db.RegisterMessage(PbPFtpBatteryStatusResult)
PbPFtpGetInactivityPreAlertResult = _reflection.GeneratedProtocolMessageType('PbPFtpGetInactivityPreAlertResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGETINACTIVITYPREALERTRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGetInactivityPreAlertResult)
))
_sym_db.RegisterMessage(PbPFtpGetInactivityPreAlertResult)
PbRequestRecordingStatusResult = _reflection.GeneratedProtocolMessageType('PbRequestRecordingStatusResult', (_message.Message,), dict(
DESCRIPTOR = _PBREQUESTRECORDINGSTATUSRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbRequestRecordingStatusResult)
))
_sym_db.RegisterMessage(PbRequestRecordingStatusResult)
PbRequestDisplayStatus = _reflection.GeneratedProtocolMessageType('PbRequestDisplayStatus', (_message.Message,), dict(
DESCRIPTOR = _PBREQUESTDISPLAYSTATUS,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbRequestDisplayStatus)
))
_sym_db.RegisterMessage(PbRequestDisplayStatus)
PbPFtpGetVisualElementsResult = _reflection.GeneratedProtocolMessageType('PbPFtpGetVisualElementsResult', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGETVISUALELEMENTSRESULT,
__module__ = 'pftp.pftp_response_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGetVisualElementsResult)
))
_sym_db.RegisterMessage(PbPFtpGetVisualElementsResult)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/training_session_target_pb2.py | loophole/polar/pb/training_session_target_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: training_session_target.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import exercise_phases_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='training_session_target.proto',
package='data',
serialized_pb=_b('\n\x1dtraining_session_target.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x15\x65xercise_phases.proto\x1a\x0btypes.proto\"C\n\x10PbSteadyRacePace\x12\x1d\n\x08\x64uration\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x10\n\x08\x64istance\x18\x02 \x02(\x02\"\xf9\x01\n\x10PbExerciseTarget\x12*\n\x0btarget_type\x18\x01 \x02(\x0e\x32\x15.PbExerciseTargetType\x12$\n\x08sport_id\x18\x02 \x01(\x0b\x32\x12.PbSportIdentifier\x12&\n\rvolume_target\x18\x03 \x01(\x0b\x32\x0f.PbVolumeTarget\x12\x1e\n\x06phases\x18\x04 \x01(\x0b\x32\x0e.data.PbPhases\x12\x19\n\x05route\x18\x05 \x01(\x0b\x32\n.PbRouteId\x12\x30\n\x10steady_race_pace\x18\x06 \x01(\x0b\x32\x16.data.PbSteadyRacePace\"\xe0\x02\n\x17PbTrainingSessionTarget\x12\x1c\n\x04name\x18\x02 \x02(\x0b\x32\x0e.PbOneLineText\x12$\n\x08sport_id\x18\x03 \x01(\x0b\x32\x12.PbSportIdentifier\x12$\n\nstart_time\x18\x04 \x01(\x0b\x32\x10.PbLocalDateTime\x12%\n\x0b\x64\x65scription\x18\x05 \x01(\x0b\x32\x10.PbMultiLineText\x12/\n\x0f\x65xercise_target\x18\x06 \x03(\x0b\x32\x16.data.PbExerciseTarget\x12\x13\n\x0btarget_done\x18\x07 \x01(\x08\x12\x1d\n\x08\x64uration\x18\x08 \x01(\x0b\x32\x0b.PbDuration\x12\x31\n\x13training_program_id\x18\t \x01(\x0b\x32\x14.PbTrainingProgramId\x12\x1c\n\x08\x65vent_id\x18\n \x01(\x0b\x32\n.PbEventId')
,
dependencies=[structures_pb2.DESCRIPTOR,exercise_phases_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSTEADYRACEPACE = _descriptor.Descriptor(
name='PbSteadyRacePace',
full_name='data.PbSteadyRacePace',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbSteadyRacePace.duration', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbSteadyRacePace.distance', index=1,
number=2, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=93,
serialized_end=160,
)
_PBEXERCISETARGET = _descriptor.Descriptor(
name='PbExerciseTarget',
full_name='data.PbExerciseTarget',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='target_type', full_name='data.PbExerciseTarget.target_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_id', full_name='data.PbExerciseTarget.sport_id', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='volume_target', full_name='data.PbExerciseTarget.volume_target', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='phases', full_name='data.PbExerciseTarget.phases', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='route', full_name='data.PbExerciseTarget.route', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steady_race_pace', full_name='data.PbExerciseTarget.steady_race_pace', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=163,
serialized_end=412,
)
_PBTRAININGSESSIONTARGET = _descriptor.Descriptor(
name='PbTrainingSessionTarget',
full_name='data.PbTrainingSessionTarget',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='data.PbTrainingSessionTarget.name', index=0,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_id', full_name='data.PbTrainingSessionTarget.sport_id', index=1,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbTrainingSessionTarget.start_time', index=2,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='description', full_name='data.PbTrainingSessionTarget.description', index=3,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exercise_target', full_name='data.PbTrainingSessionTarget.exercise_target', index=4,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_done', full_name='data.PbTrainingSessionTarget.target_done', index=5,
number=7, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbTrainingSessionTarget.duration', index=6,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_program_id', full_name='data.PbTrainingSessionTarget.training_program_id', index=7,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='event_id', full_name='data.PbTrainingSessionTarget.event_id', index=8,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=415,
serialized_end=767,
)
_PBSTEADYRACEPACE.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBEXERCISETARGET.fields_by_name['target_type'].enum_type = types_pb2._PBEXERCISETARGETTYPE
_PBEXERCISETARGET.fields_by_name['sport_id'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBEXERCISETARGET.fields_by_name['volume_target'].message_type = structures_pb2._PBVOLUMETARGET
_PBEXERCISETARGET.fields_by_name['phases'].message_type = exercise_phases_pb2._PBPHASES
_PBEXERCISETARGET.fields_by_name['route'].message_type = structures_pb2._PBROUTEID
_PBEXERCISETARGET.fields_by_name['steady_race_pace'].message_type = _PBSTEADYRACEPACE
_PBTRAININGSESSIONTARGET.fields_by_name['name'].message_type = structures_pb2._PBONELINETEXT
_PBTRAININGSESSIONTARGET.fields_by_name['sport_id'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBTRAININGSESSIONTARGET.fields_by_name['start_time'].message_type = types_pb2._PBLOCALDATETIME
_PBTRAININGSESSIONTARGET.fields_by_name['description'].message_type = structures_pb2._PBMULTILINETEXT
_PBTRAININGSESSIONTARGET.fields_by_name['exercise_target'].message_type = _PBEXERCISETARGET
_PBTRAININGSESSIONTARGET.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBTRAININGSESSIONTARGET.fields_by_name['training_program_id'].message_type = structures_pb2._PBTRAININGPROGRAMID
_PBTRAININGSESSIONTARGET.fields_by_name['event_id'].message_type = structures_pb2._PBEVENTID
DESCRIPTOR.message_types_by_name['PbSteadyRacePace'] = _PBSTEADYRACEPACE
DESCRIPTOR.message_types_by_name['PbExerciseTarget'] = _PBEXERCISETARGET
DESCRIPTOR.message_types_by_name['PbTrainingSessionTarget'] = _PBTRAININGSESSIONTARGET
PbSteadyRacePace = _reflection.GeneratedProtocolMessageType('PbSteadyRacePace', (_message.Message,), dict(
DESCRIPTOR = _PBSTEADYRACEPACE,
__module__ = 'training_session_target_pb2'
# @@protoc_insertion_point(class_scope:data.PbSteadyRacePace)
))
_sym_db.RegisterMessage(PbSteadyRacePace)
PbExerciseTarget = _reflection.GeneratedProtocolMessageType('PbExerciseTarget', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISETARGET,
__module__ = 'training_session_target_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseTarget)
))
_sym_db.RegisterMessage(PbExerciseTarget)
PbTrainingSessionTarget = _reflection.GeneratedProtocolMessageType('PbTrainingSessionTarget', (_message.Message,), dict(
DESCRIPTOR = _PBTRAININGSESSIONTARGET,
__module__ = 'training_session_target_pb2'
# @@protoc_insertion_point(class_scope:data.PbTrainingSessionTarget)
))
_sym_db.RegisterMessage(PbTrainingSessionTarget)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/poi_pb2.py | loophole/polar/pb/poi_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: poi.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='poi.proto',
package='data',
serialized_pb=_b('\n\tpoi.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"\xc1\x01\n\x11PbPointOfInterest\x12\x1d\n\x08location\x18\x01 \x02(\x0b\x32\x0b.PbLocation\x12\x10\n\x08point_id\x18\x02 \x01(\x04\x12\x1e\n\x04name\x18\x03 \x01(\x0b\x32\x10.PbMultiLineText\x12\r\n\x05\x61larm\x18\x04 \x01(\x08\x12\"\n\x07\x63reated\x18\x64 \x01(\x0b\x32\x11.PbSystemDateTime\x12(\n\rlast_modified\x18\x65 \x01(\x0b\x32\x11.PbSystemDateTime\"<\n\x12PbPointOfInterests\x12&\n\x05point\x18\x01 \x03(\x0b\x32\x17.data.PbPointOfInterest')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPOINTOFINTEREST = _descriptor.Descriptor(
name='PbPointOfInterest',
full_name='data.PbPointOfInterest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='location', full_name='data.PbPointOfInterest.location', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='point_id', full_name='data.PbPointOfInterest.point_id', index=1,
number=2, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='data.PbPointOfInterest.name', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='alarm', full_name='data.PbPointOfInterest.alarm', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='created', full_name='data.PbPointOfInterest.created', index=4,
number=100, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbPointOfInterest.last_modified', index=5,
number=101, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=51,
serialized_end=244,
)
_PBPOINTOFINTERESTS = _descriptor.Descriptor(
name='PbPointOfInterests',
full_name='data.PbPointOfInterests',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='point', full_name='data.PbPointOfInterests.point', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=246,
serialized_end=306,
)
_PBPOINTOFINTEREST.fields_by_name['location'].message_type = types_pb2._PBLOCATION
_PBPOINTOFINTEREST.fields_by_name['name'].message_type = structures_pb2._PBMULTILINETEXT
_PBPOINTOFINTEREST.fields_by_name['created'].message_type = types_pb2._PBSYSTEMDATETIME
_PBPOINTOFINTEREST.fields_by_name['last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
_PBPOINTOFINTERESTS.fields_by_name['point'].message_type = _PBPOINTOFINTEREST
DESCRIPTOR.message_types_by_name['PbPointOfInterest'] = _PBPOINTOFINTEREST
DESCRIPTOR.message_types_by_name['PbPointOfInterests'] = _PBPOINTOFINTERESTS
PbPointOfInterest = _reflection.GeneratedProtocolMessageType('PbPointOfInterest', (_message.Message,), dict(
DESCRIPTOR = _PBPOINTOFINTEREST,
__module__ = 'poi_pb2'
# @@protoc_insertion_point(class_scope:data.PbPointOfInterest)
))
_sym_db.RegisterMessage(PbPointOfInterest)
PbPointOfInterests = _reflection.GeneratedProtocolMessageType('PbPointOfInterests', (_message.Message,), dict(
DESCRIPTOR = _PBPOINTOFINTERESTS,
__module__ = 'poi_pb2'
# @@protoc_insertion_point(class_scope:data.PbPointOfInterests)
))
_sym_db.RegisterMessage(PbPointOfInterests)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_avalon_settings_pb2.py | loophole/polar/pb/sportprofile_avalon_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_avalon_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_avalon_settings.proto',
package='data',
serialized_pb=_b('\n\"sportprofile_avalon_settings.proto\x12\x04\x64\x61ta\"\x9a\x02\n\x1cPbAvalonSportProfileSettings\x12\x44\n\x0bheart_touch\x18\x01 \x01(\x0e\x32/.data.PbAvalonSportProfileSettings.PbHeartTouch\x12\x11\n\tvibration\x18\x03 \x01(\x08\x12\x12\n\nauto_start\x18\x04 \x01(\x08\"\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBAVALONSPORTPROFILESETTINGS_PBHEARTTOUCH = _descriptor.EnumDescriptor(
name='PbHeartTouch',
full_name='data.PbAvalonSportProfileSettings.PbHeartTouch',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_PREVIOUS_LAP', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_TIME_OF_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=187,
serialized_end=327,
)
_sym_db.RegisterEnumDescriptor(_PBAVALONSPORTPROFILESETTINGS_PBHEARTTOUCH)
_PBAVALONSPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbAvalonSportProfileSettings',
full_name='data.PbAvalonSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_touch', full_name='data.PbAvalonSportProfileSettings.heart_touch', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vibration', full_name='data.PbAvalonSportProfileSettings.vibration', index=1,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbAvalonSportProfileSettings.auto_start', index=2,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBAVALONSPORTPROFILESETTINGS_PBHEARTTOUCH,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=45,
serialized_end=327,
)
_PBAVALONSPORTPROFILESETTINGS.fields_by_name['heart_touch'].enum_type = _PBAVALONSPORTPROFILESETTINGS_PBHEARTTOUCH
_PBAVALONSPORTPROFILESETTINGS_PBHEARTTOUCH.containing_type = _PBAVALONSPORTPROFILESETTINGS
DESCRIPTOR.message_types_by_name['PbAvalonSportProfileSettings'] = _PBAVALONSPORTPROFILESETTINGS
PbAvalonSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbAvalonSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBAVALONSPORTPROFILESETTINGS,
__module__ = 'sportprofile_avalon_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbAvalonSportProfileSettings)
))
_sym_db.RegisterMessage(PbAvalonSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_mclaren_settings_pb2.py | loophole/polar/pb/sportprofile_mclaren_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_mclaren_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_mclaren_settings.proto',
package='data',
serialized_pb=_b('\n#sportprofile_mclaren_settings.proto\x12\x04\x64\x61ta\"3\n\x1dPbMcLarenSportProfileSettings\x12\x12\n\nauto_start\x18\x04 \x02(\x08')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBMCLARENSPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbMcLarenSportProfileSettings',
full_name='data.PbMcLarenSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbMcLarenSportProfileSettings.auto_start', index=0,
number=4, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=45,
serialized_end=96,
)
DESCRIPTOR.message_types_by_name['PbMcLarenSportProfileSettings'] = _PBMCLARENSPORTPROFILESETTINGS
PbMcLarenSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbMcLarenSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBMCLARENSPORTPROFILESETTINGS,
__module__ = 'sportprofile_mclaren_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbMcLarenSportProfileSettings)
))
_sym_db.RegisterMessage(PbMcLarenSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/errors_pb2.py | loophole/polar/pb/errors_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: errors.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='errors.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x0c\x65rrors.proto\x12\x04\x64\x61ta\"C\n\x15PbConstraintViolation\x12\x11\n\tvalueName\x18\x01 \x02(\t\x12\x17\n\x0fviolationReason\x18\x02 \x02(\t\"p\n\x08PbErrors\x12\x0f\n\x07message\x18\x01 \x02(\t\x12/\n\nviolations\x18\x02 \x03(\x0b\x32\x1b.data.PbConstraintViolation\x12\x0e\n\x06\x65rrors\x18\x03 \x03(\t\x12\x12\n\nstackTrace\x18\x04 \x03(\t')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBCONSTRAINTVIOLATION = _descriptor.Descriptor(
name='PbConstraintViolation',
full_name='data.PbConstraintViolation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='valueName', full_name='data.PbConstraintViolation.valueName', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='violationReason', full_name='data.PbConstraintViolation.violationReason', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=22,
serialized_end=89,
)
_PBERRORS = _descriptor.Descriptor(
name='PbErrors',
full_name='data.PbErrors',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='message', full_name='data.PbErrors.message', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='violations', full_name='data.PbErrors.violations', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='errors', full_name='data.PbErrors.errors', index=2,
number=3, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stackTrace', full_name='data.PbErrors.stackTrace', index=3,
number=4, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=91,
serialized_end=203,
)
_PBERRORS.fields_by_name['violations'].message_type = _PBCONSTRAINTVIOLATION
DESCRIPTOR.message_types_by_name['PbConstraintViolation'] = _PBCONSTRAINTVIOLATION
DESCRIPTOR.message_types_by_name['PbErrors'] = _PBERRORS
PbConstraintViolation = _reflection.GeneratedProtocolMessageType('PbConstraintViolation', (_message.Message,), dict(
DESCRIPTOR = _PBCONSTRAINTVIOLATION,
__module__ = 'errors_pb2'
# @@protoc_insertion_point(class_scope:data.PbConstraintViolation)
))
_sym_db.RegisterMessage(PbConstraintViolation)
PbErrors = _reflection.GeneratedProtocolMessageType('PbErrors', (_message.Message,), dict(
DESCRIPTOR = _PBERRORS,
__module__ = 'errors_pb2'
# @@protoc_insertion_point(class_scope:data.PbErrors)
))
_sym_db.RegisterMessage(PbErrors)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_samples_pb2.py | loophole/polar/pb/exercise_samples_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_samples.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
import structures_pb2 as structures__pb2
import exercise_rr_samples_pb2 as exercise__rr__samples__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_samples.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x16\x65xercise_samples.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\x1a\x10structures.proto\x1a\x19\x65xercise_rr_samples.proto\"\x86\x03\n\x13PbPowerMeasurements\x12\x15\n\rcurrent_power\x18\x01 \x02(\x05\x12$\n\x1c\x63umulative_crank_revolutions\x18\x02 \x01(\r\x12\x1c\n\x14\x63umulative_timestamp\x18\x03 \x01(\r\x12\x1b\n\x13\x66orce_magnitude_min\x18\x04 \x01(\x11\x12\x1b\n\x13\x66orce_magnitude_max\x18\x05 \x01(\x05\x12!\n\x19\x66orce_magnitude_min_angle\x18\x06 \x01(\r\x12!\n\x19\x66orce_magnitude_max_angle\x18\x07 \x01(\r\x12\x1e\n\x16\x62ottom_dead_spot_angle\x18\x08 \x01(\r\x12\x1b\n\x13top_dead_spot_angle\x18\t \x01(\r\x12\x1b\n\x13pedal_power_balance\x18\n \x01(\r\x12\x1c\n\x14torque_magnitude_min\x18\x0b \x01(\x05\x12\x1c\n\x14torque_magnitude_max\x18\x0c \x01(\x05\"{\n\x12PbCalibrationValue\x12\x13\n\x0bstart_index\x18\x01 \x02(\r\x12\r\n\x05value\x18\x02 \x02(\x02\x12#\n\toperation\x18\x03 \x02(\x0e\x32\x10.PbOperationType\x12\x1c\n\x05\x63\x61use\x18\x04 \x01(\x0e\x32\r.PbMovingType\"\xc3\x06\n\x1fPbExerciseIntervalledSampleList\x12\"\n\x0bsample_type\x18\x01 \x02(\x0e\x32\r.PbSampleType\x12\x1d\n\x15recording_interval_ms\x18\x02 \x01(\r\x12&\n\rsample_source\x18\x03 \x03(\x0b\x32\x0f.PbSampleSource\x12\x1a\n\x12heart_rate_samples\x18\x04 \x03(\r\x12\x17\n\x0f\x63\x61\x64\x65nce_samples\x18\x05 \x03(\r\x12\x15\n\rspeed_samples\x18\x06 \x03(\x02\x12\x18\n\x10\x64istance_samples\x18\x07 \x03(\x02\x12\x1c\n\x14\x66orward_acceleration\x18\x08 \x03(\x02\x12*\n\x13moving_type_samples\x18\t \x03(\x0e\x32\r.PbMovingType\x12\x18\n\x10\x61ltitude_samples\x18\n \x03(\x02\x12\x36\n\x14\x61ltitude_calibration\x18\x0b \x03(\x0b\x32\x18.data.PbCalibrationValue\x12\x1b\n\x13temperature_samples\x18\x0c \x03(\x02\x12\x1d\n\x15stride_length_samples\x18\r \x03(\r\x12\x34\n\x12stride_calibration\x18\x0e \x03(\x0b\x32\x18.data.PbCalibrationValue\x12;\n\x18left_pedal_power_samples\x18\x0f \x03(\x0b\x32\x19.data.PbPowerMeasurements\x12<\n\x19right_pedal_power_samples\x18\x10 \x03(\x0b\x32\x19.data.PbPowerMeasurements\x12\x38\n\x16left_power_calibration\x18\x11 \x03(\x0b\x32\x18.data.PbCalibrationValue\x12\x39\n\x17right_power_calibration\x18\x12 \x03(\x0b\x32\x18.data.PbCalibrationValue\x12/\n\nrr_samples\x18\x13 \x01(\x0b\x32\x1b.data.PbExerciseRRIntervals\x12 \n\x18\x61\x63\x63\x65leration_mad_samples\x18\x14 \x03(\x02\"\xcf\n\n\x11PbExerciseSamples\x12\'\n\x12recording_interval\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x1a\n\x12heart_rate_samples\x18\x02 \x03(\r\x12,\n\x12heart_rate_offline\x18\x03 \x03(\x0b\x32\x10.PbSensorOffline\x12\x17\n\x0f\x63\x61\x64\x65nce_samples\x18\x04 \x03(\r\x12)\n\x0f\x63\x61\x64\x65nce_offline\x18\x05 \x03(\x0b\x32\x10.PbSensorOffline\x12\x18\n\x10\x61ltitude_samples\x18\x06 \x03(\x02\x12*\n\x10\x61ltitude_offline\x18\x12 \x03(\x0b\x32\x10.PbSensorOffline\x12\x36\n\x14\x61ltitude_calibration\x18\x07 \x03(\x0b\x32\x18.data.PbCalibrationValue\x12\x1b\n\x13temperature_samples\x18\x08 \x03(\x02\x12-\n\x13temperature_offline\x18\x13 \x03(\x0b\x32\x10.PbSensorOffline\x12\x15\n\rspeed_samples\x18\t \x03(\x02\x12\'\n\rspeed_offline\x18\n \x03(\x0b\x32\x10.PbSensorOffline\x12\x18\n\x10\x64istance_samples\x18\x0b \x03(\x02\x12*\n\x10\x64istance_offline\x18\x0c \x03(\x0b\x32\x10.PbSensorOffline\x12\x1d\n\x15stride_length_samples\x18\r \x03(\r\x12/\n\x15stride_length_offline\x18\x0e \x03(\x0b\x32\x10.PbSensorOffline\x12\x34\n\x12stride_calibration\x18\x0f \x03(\x0b\x32\x18.data.PbCalibrationValue\x12\x1c\n\x14\x66orward_acceleration\x18\x10 \x03(\x02\x12\x36\n\x1c\x66orward_acceleration_offline\x18\x14 \x03(\x0b\x32\x10.PbSensorOffline\x12*\n\x13moving_type_samples\x18\x11 \x03(\x0e\x32\r.PbMovingType\x12-\n\x13moving_type_offline\x18\x15 \x03(\x0b\x32\x10.PbSensorOffline\x12;\n\x18left_pedal_power_samples\x18\x16 \x03(\x0b\x32\x19.data.PbPowerMeasurements\x12\x32\n\x18left_pedal_power_offline\x18\x17 \x03(\x0b\x32\x10.PbSensorOffline\x12<\n\x19right_pedal_power_samples\x18\x18 \x03(\x0b\x32\x19.data.PbPowerMeasurements\x12\x33\n\x19right_pedal_power_offline\x18\x19 \x03(\x0b\x32\x10.PbSensorOffline\x12\x38\n\x16left_power_calibration\x18\x1a \x03(\x0b\x32\x18.data.PbCalibrationValue\x12\x39\n\x17right_power_calibration\x18\x1b \x03(\x0b\x32\x18.data.PbCalibrationValue\x12/\n\nrr_samples\x18\x1c \x01(\x0b\x32\x1b.data.PbExerciseRRIntervals\x12O\n exercise_intervalled_sample_list\x18\x1d \x03(\x0b\x32%.data.PbExerciseIntervalledSampleList\x12!\n\x0bpause_times\x18\x1e \x03(\x0b\x32\x0c.PbPauseTime')
,
dependencies=[types__pb2.DESCRIPTOR,structures__pb2.DESCRIPTOR,exercise__rr__samples__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPOWERMEASUREMENTS = _descriptor.Descriptor(
name='PbPowerMeasurements',
full_name='data.PbPowerMeasurements',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='current_power', full_name='data.PbPowerMeasurements.current_power', index=0,
number=1, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cumulative_crank_revolutions', full_name='data.PbPowerMeasurements.cumulative_crank_revolutions', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cumulative_timestamp', full_name='data.PbPowerMeasurements.cumulative_timestamp', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='force_magnitude_min', full_name='data.PbPowerMeasurements.force_magnitude_min', index=3,
number=4, type=17, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='force_magnitude_max', full_name='data.PbPowerMeasurements.force_magnitude_max', index=4,
number=5, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='force_magnitude_min_angle', full_name='data.PbPowerMeasurements.force_magnitude_min_angle', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='force_magnitude_max_angle', full_name='data.PbPowerMeasurements.force_magnitude_max_angle', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='bottom_dead_spot_angle', full_name='data.PbPowerMeasurements.bottom_dead_spot_angle', index=7,
number=8, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='top_dead_spot_angle', full_name='data.PbPowerMeasurements.top_dead_spot_angle', index=8,
number=9, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='pedal_power_balance', full_name='data.PbPowerMeasurements.pedal_power_balance', index=9,
number=10, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='torque_magnitude_min', full_name='data.PbPowerMeasurements.torque_magnitude_min', index=10,
number=11, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='torque_magnitude_max', full_name='data.PbPowerMeasurements.torque_magnitude_max', index=11,
number=12, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=91,
serialized_end=481,
)
_PBCALIBRATIONVALUE = _descriptor.Descriptor(
name='PbCalibrationValue',
full_name='data.PbCalibrationValue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_index', full_name='data.PbCalibrationValue.start_index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='value', full_name='data.PbCalibrationValue.value', index=1,
number=2, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='operation', full_name='data.PbCalibrationValue.operation', index=2,
number=3, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cause', full_name='data.PbCalibrationValue.cause', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=483,
serialized_end=606,
)
_PBEXERCISEINTERVALLEDSAMPLELIST = _descriptor.Descriptor(
name='PbExerciseIntervalledSampleList',
full_name='data.PbExerciseIntervalledSampleList',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sample_type', full_name='data.PbExerciseIntervalledSampleList.sample_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recording_interval_ms', full_name='data.PbExerciseIntervalledSampleList.recording_interval_ms', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sample_source', full_name='data.PbExerciseIntervalledSampleList.sample_source', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_samples', full_name='data.PbExerciseIntervalledSampleList.heart_rate_samples', index=3,
number=4, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence_samples', full_name='data.PbExerciseIntervalledSampleList.cadence_samples', index=4,
number=5, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_samples', full_name='data.PbExerciseIntervalledSampleList.speed_samples', index=5,
number=6, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_samples', full_name='data.PbExerciseIntervalledSampleList.distance_samples', index=6,
number=7, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration', full_name='data.PbExerciseIntervalledSampleList.forward_acceleration', index=7,
number=8, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='moving_type_samples', full_name='data.PbExerciseIntervalledSampleList.moving_type_samples', index=8,
number=9, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_samples', full_name='data.PbExerciseIntervalledSampleList.altitude_samples', index=9,
number=10, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_calibration', full_name='data.PbExerciseIntervalledSampleList.altitude_calibration', index=10,
number=11, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='temperature_samples', full_name='data.PbExerciseIntervalledSampleList.temperature_samples', index=11,
number=12, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length_samples', full_name='data.PbExerciseIntervalledSampleList.stride_length_samples', index=12,
number=13, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_calibration', full_name='data.PbExerciseIntervalledSampleList.stride_calibration', index=13,
number=14, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_pedal_power_samples', full_name='data.PbExerciseIntervalledSampleList.left_pedal_power_samples', index=14,
number=15, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='right_pedal_power_samples', full_name='data.PbExerciseIntervalledSampleList.right_pedal_power_samples', index=15,
number=16, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_power_calibration', full_name='data.PbExerciseIntervalledSampleList.left_power_calibration', index=16,
number=17, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='right_power_calibration', full_name='data.PbExerciseIntervalledSampleList.right_power_calibration', index=17,
number=18, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_samples', full_name='data.PbExerciseIntervalledSampleList.rr_samples', index=18,
number=19, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='acceleration_mad_samples', full_name='data.PbExerciseIntervalledSampleList.acceleration_mad_samples', index=19,
number=20, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=609,
serialized_end=1444,
)
_PBEXERCISESAMPLES = _descriptor.Descriptor(
name='PbExerciseSamples',
full_name='data.PbExerciseSamples',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='recording_interval', full_name='data.PbExerciseSamples.recording_interval', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_samples', full_name='data.PbExerciseSamples.heart_rate_samples', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_offline', full_name='data.PbExerciseSamples.heart_rate_offline', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence_samples', full_name='data.PbExerciseSamples.cadence_samples', index=3,
number=4, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence_offline', full_name='data.PbExerciseSamples.cadence_offline', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_samples', full_name='data.PbExerciseSamples.altitude_samples', index=5,
number=6, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_offline', full_name='data.PbExerciseSamples.altitude_offline', index=6,
number=18, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_calibration', full_name='data.PbExerciseSamples.altitude_calibration', index=7,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='temperature_samples', full_name='data.PbExerciseSamples.temperature_samples', index=8,
number=8, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='temperature_offline', full_name='data.PbExerciseSamples.temperature_offline', index=9,
number=19, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_samples', full_name='data.PbExerciseSamples.speed_samples', index=10,
number=9, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_offline', full_name='data.PbExerciseSamples.speed_offline', index=11,
number=10, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_samples', full_name='data.PbExerciseSamples.distance_samples', index=12,
number=11, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_offline', full_name='data.PbExerciseSamples.distance_offline', index=13,
number=12, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length_samples', full_name='data.PbExerciseSamples.stride_length_samples', index=14,
number=13, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length_offline', full_name='data.PbExerciseSamples.stride_length_offline', index=15,
number=14, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_calibration', full_name='data.PbExerciseSamples.stride_calibration', index=16,
number=15, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration', full_name='data.PbExerciseSamples.forward_acceleration', index=17,
number=16, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration_offline', full_name='data.PbExerciseSamples.forward_acceleration_offline', index=18,
number=20, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='moving_type_samples', full_name='data.PbExerciseSamples.moving_type_samples', index=19,
number=17, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='moving_type_offline', full_name='data.PbExerciseSamples.moving_type_offline', index=20,
number=21, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_pedal_power_samples', full_name='data.PbExerciseSamples.left_pedal_power_samples', index=21,
number=22, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_pedal_power_offline', full_name='data.PbExerciseSamples.left_pedal_power_offline', index=22,
number=23, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='right_pedal_power_samples', full_name='data.PbExerciseSamples.right_pedal_power_samples', index=23,
number=24, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='right_pedal_power_offline', full_name='data.PbExerciseSamples.right_pedal_power_offline', index=24,
number=25, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_power_calibration', full_name='data.PbExerciseSamples.left_power_calibration', index=25,
number=26, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='right_power_calibration', full_name='data.PbExerciseSamples.right_power_calibration', index=26,
number=27, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_samples', full_name='data.PbExerciseSamples.rr_samples', index=27,
number=28, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exercise_intervalled_sample_list', full_name='data.PbExerciseSamples.exercise_intervalled_sample_list', index=28,
number=29, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='pause_times', full_name='data.PbExerciseSamples.pause_times', index=29,
number=30, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1447,
serialized_end=2806,
)
_PBCALIBRATIONVALUE.fields_by_name['operation'].enum_type = types__pb2._PBOPERATIONTYPE
_PBCALIBRATIONVALUE.fields_by_name['cause'].enum_type = types__pb2._PBMOVINGTYPE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['sample_type'].enum_type = types__pb2._PBSAMPLETYPE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['sample_source'].message_type = types__pb2._PBSAMPLESOURCE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['moving_type_samples'].enum_type = types__pb2._PBMOVINGTYPE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['altitude_calibration'].message_type = _PBCALIBRATIONVALUE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['stride_calibration'].message_type = _PBCALIBRATIONVALUE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['left_pedal_power_samples'].message_type = _PBPOWERMEASUREMENTS
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['right_pedal_power_samples'].message_type = _PBPOWERMEASUREMENTS
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['left_power_calibration'].message_type = _PBCALIBRATIONVALUE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['right_power_calibration'].message_type = _PBCALIBRATIONVALUE
_PBEXERCISEINTERVALLEDSAMPLELIST.fields_by_name['rr_samples'].message_type = exercise__rr__samples__pb2._PBEXERCISERRINTERVALS
_PBEXERCISESAMPLES.fields_by_name['recording_interval'].message_type = types__pb2._PBDURATION
_PBEXERCISESAMPLES.fields_by_name['heart_rate_offline'].message_type = types__pb2._PBSENSOROFFLINE
_PBEXERCISESAMPLES.fields_by_name['cadence_offline'].message_type = types__pb2._PBSENSOROFFLINE
_PBEXERCISESAMPLES.fields_by_name['altitude_offline'].message_type = types__pb2._PBSENSOROFFLINE
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_devset_pb2.py | loophole/polar/pb/user_devset_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_devset.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_devset.proto',
package='data',
serialized_pb=_b('\n\x11user_devset.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xbb\x08\n\x1bPbUserDeviceGeneralSettings\x12\x31\n\x17OBSOLETE_time_selection\x18\x01 \x01(\x0e\x32\x10.PbTimeSelection\x12\x1d\n\x15OBSOLETE_time2_offset\x18\x02 \x01(\x05\x12\x41\n\nwatch_face\x18\x03 \x01(\x0e\x32-.data.PbUserDeviceGeneralSettings.PbWatchFace\x12L\n\x10\x62utton_lock_mode\x18\x04 \x01(\x0e\x32\x32.data.PbUserDeviceGeneralSettings.PbButtonLockMode\x12&\n\x13\x62utton_sound_volume\x18\x05 \x01(\x0b\x32\t.PbVolume\x12\x16\n\x0evibration_mode\x18\x07 \x01(\x08\x12\x42\n\nhandedness\x18\x08 \x01(\x0e\x32..data.PbUserDeviceGeneralSettings.PbHandedness\x12\x18\n\x10\x65xeview_inverted\x18\t \x01(\x08\x12X\n\x16tap_button_sensitivity\x18\n \x01(\x0e\x32\x38.data.PbUserDeviceGeneralSettings.PbTapButtonSensitivity\x12M\n\x10inactivity_alert\x18\x0b \x01(\x0e\x32\x33.data.PbUserDeviceGeneralSettings.PbInactivityAlert\x12\x1f\n\x17\x62le_connect_mode_enable\x18\x0c \x01(\x08\"`\n\x0bPbWatchFace\x12\t\n\x05\x42\x41SIC\x10\x01\x12\t\n\x05\x41WARD\x10\x02\x12\r\n\tUSER_NAME\x10\x03\x12\t\n\x05\x45VENT\x10\x04\x12\n\n\x06\x41NALOG\x10\x05\x12\x07\n\x03\x42IG\x10\x06\x12\x0c\n\x08\x41\x43TIVITY\x10\x07\"(\n\x10PbButtonLockMode\x12\n\n\x06MANUAL\x10\x01\x12\x08\n\x04\x41UTO\x10\x02\"9\n\x0cPbHandedness\x12\x13\n\x0fWU_IN_LEFT_HAND\x10\x01\x12\x14\n\x10WU_IN_RIGHT_HAND\x10\x02\"\xc1\x01\n\x16PbTapButtonSensitivity\x12\x1e\n\x1aTAP_BUTTON_SENSITIVITY_OFF\x10\x01\x12#\n\x1fTAP_BUTTON_SENSITIVITY_VERY_LOW\x10\x05\x12\x1e\n\x1aTAP_BUTTON_SENSITIVITY_LOW\x10\x02\x12!\n\x1dTAP_BUTTON_SENSITIVITY_MEDIUM\x10\x03\x12\x1f\n\x1bTAP_BUTTON_SENSITIVITY_HIGH\x10\x04\"F\n\x11PbInactivityAlert\x12\x18\n\x14INACTIVITY_ALERT_OFF\x10\x01\x12\x17\n\x13INACTIVITY_ALERT_ON\x10\x02\"\xe6\x01\n\x19PbUserDeviceAlarmSettings\x12?\n\nalarm_mode\x18\x01 \x02(\x0e\x32+.data.PbUserDeviceAlarmSettings.PbAlarmMode\x12\x1b\n\nalarm_time\x18\x02 \x02(\x0b\x32\x07.PbTime\"k\n\x0bPbAlarmMode\x12\x12\n\x0e\x41LARM_MODE_OFF\x10\x01\x12\x13\n\x0f\x41LARM_MODE_ONCE\x10\x02\x12\x19\n\x15\x41LARM_MODE_MON_TO_FRI\x10\x03\x12\x18\n\x14\x41LARM_MODE_EVERY_DAY\x10\x04\"D\n\x1dPbUserDeviceCountdownSettings\x12#\n\x0e\x63ountdown_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\"G\n\x1cPbUserDeviceJumpTestSettings\x12\'\n\x12\x63ont_jump_duration\x18\x01 \x02(\x0b\x32\x0b.PbDuration\"\x8d\x02\n\x14PbIntervalTimerValue\x12K\n\x13interval_timer_type\x18\x01 \x02(\x0e\x32..data.PbIntervalTimerValue.PbIntervalTimerType\x12,\n\x17interval_timer_duration\x18\x02 \x01(\x0b\x32\x0b.PbDuration\x12\x1f\n\x17interval_timer_distance\x18\x03 \x01(\x02\"Y\n\x13PbIntervalTimerType\x12 \n\x1cINTERVAL_TIMER_TYPE_DURATION\x10\x01\x12 \n\x1cINTERVAL_TIMER_TYPE_DISTANCE\x10\x02\"W\n\x1bPbUserIntervalTimerSettings\x12\x38\n\x14interval_timer_value\x18\x01 \x03(\x0b\x32\x1a.data.PbIntervalTimerValue\"C\n\x1ePbUserEndTimeEstimatorSettings\x12!\n\x19\x65nd_time_estimator_target\x18\x01 \x01(\x02\"\xb7\x01\n\x1cPbUserDeviceResearchSettings\x12%\n\x1d\x61\x63\x63\x65lerometer_raw_data_enable\x18\x01 \x01(\x08\x12!\n\x19gyroscope_raw_data_enable\x18\x02 \x01(\x08\x12$\n\x1cmagnetometer_raw_data_enable\x18\x03 \x01(\x08\x12\'\n\x1flinear_acceleration_data_enable\x18\x04 \x01(\x08\"\xae\x04\n\x19PbUserSafetyLightSettings\x12?\n\x04mode\x18\x01 \x02(\x0e\x32\x31.data.PbUserSafetyLightSettings.PbSafetyLightMode\x12V\n\x10\x61\x63tivation_level\x18\x02 \x01(\x0e\x32<.data.PbUserSafetyLightSettings.PbSafetyLightActivationLevel\x12J\n\nblink_rate\x18\x03 \x01(\x0e\x32\x36.data.PbUserSafetyLightSettings.PbSafetyLightBlinkRate\"H\n\x11PbSafetyLightMode\x12\x17\n\x13SAFETY_LIGHT_MANUAL\x10\x01\x12\x1a\n\x16SAFETY_LIGHT_AUTOMATIC\x10\x02\"p\n\x1cPbSafetyLightActivationLevel\x12\x19\n\x15\x41\x43TIVATION_LEVEL_DARK\x10\x01\x12\x19\n\x15\x41\x43TIVATION_LEVEL_DUSK\x10\x02\x12\x1a\n\x16\x41\x43TIVATION_LEVEL_LIGHT\x10\x03\"p\n\x16PbSafetyLightBlinkRate\x12\x12\n\x0e\x42LINK_RATE_OFF\x10\x01\x12\x13\n\x0f\x42LINK_RATE_SLOW\x10\x02\x12\x13\n\x0f\x42LINK_RATE_FAST\x10\x03\x12\x18\n\x14\x42LINK_RATE_VERY_FAST\x10\x04\"W\n\x16PbDoNotDisturbSettings\x12\x0f\n\x07\x65nabled\x18\x01 \x02(\x08\x12\x16\n\x05start\x18\x02 \x01(\x0b\x32\x07.PbTime\x12\x14\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x07.PbTime\"\xa7\x01\n$PbUserSmartWatchNotificationSettings\x12\x0f\n\x07\x65nabled\x18\x01 \x02(\x08\x12\x17\n\x0fpreview_enabled\x18\x02 \x01(\x08\x12=\n\x17\x64o_not_disturb_settings\x18\x03 \x01(\x0b\x32\x1c.data.PbDoNotDisturbSettings\x12\x16\n\x0esounds_enabled\x18\x04 \x01(\x08\"\x9b\x05\n\x14PbUserDeviceSettings\x12;\n\x10general_settings\x18\x01 \x02(\x0b\x32!.data.PbUserDeviceGeneralSettings\x12\x37\n\x0e\x61larm_settings\x18\x02 \x01(\x0b\x32\x1f.data.PbUserDeviceAlarmSettings\x12?\n\x12\x63ountdown_settings\x18\x03 \x01(\x0b\x32#.data.PbUserDeviceCountdownSettings\x12=\n\x11jumptest_settings\x18\x04 \x01(\x0b\x32\".data.PbUserDeviceJumpTestSettings\x12\x42\n\x17interval_timer_settings\x18\x05 \x01(\x0b\x32!.data.PbUserIntervalTimerSettings\x12I\n\x1b\x65nd_time_estimator_settings\x18\x06 \x01(\x0b\x32$.data.PbUserEndTimeEstimatorSettings\x12=\n\x11research_settings\x18\x07 \x01(\x0b\x32\".data.PbUserDeviceResearchSettings\x12>\n\x15safety_light_settings\x18\x08 \x01(\x0b\x32\x1f.data.PbUserSafetyLightSettings\x12U\n!smart_watch_notification_settings\x18\t \x01(\x0b\x32*.data.PbUserSmartWatchNotificationSettings\x12(\n\rlast_modified\x18\x65 \x02(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBUSERDEVICEGENERALSETTINGS_PBWATCHFACE = _descriptor.EnumDescriptor(
name='PbWatchFace',
full_name='data.PbUserDeviceGeneralSettings.PbWatchFace',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='BASIC', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AWARD', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='USER_NAME', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='EVENT', index=3, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ANALOG', index=4, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BIG', index=5, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVITY', index=6, number=7,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=659,
serialized_end=755,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEGENERALSETTINGS_PBWATCHFACE)
_PBUSERDEVICEGENERALSETTINGS_PBBUTTONLOCKMODE = _descriptor.EnumDescriptor(
name='PbButtonLockMode',
full_name='data.PbUserDeviceGeneralSettings.PbButtonLockMode',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='MANUAL', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTO', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=757,
serialized_end=797,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEGENERALSETTINGS_PBBUTTONLOCKMODE)
_PBUSERDEVICEGENERALSETTINGS_PBHANDEDNESS = _descriptor.EnumDescriptor(
name='PbHandedness',
full_name='data.PbUserDeviceGeneralSettings.PbHandedness',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='WU_IN_LEFT_HAND', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WU_IN_RIGHT_HAND', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=799,
serialized_end=856,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEGENERALSETTINGS_PBHANDEDNESS)
_PBUSERDEVICEGENERALSETTINGS_PBTAPBUTTONSENSITIVITY = _descriptor.EnumDescriptor(
name='PbTapButtonSensitivity',
full_name='data.PbUserDeviceGeneralSettings.PbTapButtonSensitivity',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_SENSITIVITY_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_SENSITIVITY_VERY_LOW', index=1, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_SENSITIVITY_LOW', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_SENSITIVITY_MEDIUM', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_SENSITIVITY_HIGH', index=4, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=859,
serialized_end=1052,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEGENERALSETTINGS_PBTAPBUTTONSENSITIVITY)
_PBUSERDEVICEGENERALSETTINGS_PBINACTIVITYALERT = _descriptor.EnumDescriptor(
name='PbInactivityAlert',
full_name='data.PbUserDeviceGeneralSettings.PbInactivityAlert',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='INACTIVITY_ALERT_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INACTIVITY_ALERT_ON', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1054,
serialized_end=1124,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEGENERALSETTINGS_PBINACTIVITYALERT)
_PBUSERDEVICEALARMSETTINGS_PBALARMMODE = _descriptor.EnumDescriptor(
name='PbAlarmMode',
full_name='data.PbUserDeviceAlarmSettings.PbAlarmMode',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ALARM_MODE_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALARM_MODE_ONCE', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALARM_MODE_MON_TO_FRI', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALARM_MODE_EVERY_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1250,
serialized_end=1357,
)
_sym_db.RegisterEnumDescriptor(_PBUSERDEVICEALARMSETTINGS_PBALARMMODE)
_PBINTERVALTIMERVALUE_PBINTERVALTIMERTYPE = _descriptor.EnumDescriptor(
name='PbIntervalTimerType',
full_name='data.PbIntervalTimerValue.PbIntervalTimerType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='INTERVAL_TIMER_TYPE_DURATION', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INTERVAL_TIMER_TYPE_DISTANCE', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1683,
serialized_end=1772,
)
_sym_db.RegisterEnumDescriptor(_PBINTERVALTIMERVALUE_PBINTERVALTIMERTYPE)
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTMODE = _descriptor.EnumDescriptor(
name='PbSafetyLightMode',
full_name='data.PbUserSafetyLightSettings.PbSafetyLightMode',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SAFETY_LIGHT_MANUAL', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SAFETY_LIGHT_AUTOMATIC', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2377,
serialized_end=2449,
)
_sym_db.RegisterEnumDescriptor(_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTMODE)
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTACTIVATIONLEVEL = _descriptor.EnumDescriptor(
name='PbSafetyLightActivationLevel',
full_name='data.PbUserSafetyLightSettings.PbSafetyLightActivationLevel',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ACTIVATION_LEVEL_DARK', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVATION_LEVEL_DUSK', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVATION_LEVEL_LIGHT', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2451,
serialized_end=2563,
)
_sym_db.RegisterEnumDescriptor(_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTACTIVATIONLEVEL)
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTBLINKRATE = _descriptor.EnumDescriptor(
name='PbSafetyLightBlinkRate',
full_name='data.PbUserSafetyLightSettings.PbSafetyLightBlinkRate',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='BLINK_RATE_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLINK_RATE_SLOW', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLINK_RATE_FAST', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLINK_RATE_VERY_FAST', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2565,
serialized_end=2677,
)
_sym_db.RegisterEnumDescriptor(_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTBLINKRATE)
_PBUSERDEVICEGENERALSETTINGS = _descriptor.Descriptor(
name='PbUserDeviceGeneralSettings',
full_name='data.PbUserDeviceGeneralSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='OBSOLETE_time_selection', full_name='data.PbUserDeviceGeneralSettings.OBSOLETE_time_selection', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_time2_offset', full_name='data.PbUserDeviceGeneralSettings.OBSOLETE_time2_offset', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='watch_face', full_name='data.PbUserDeviceGeneralSettings.watch_face', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='button_lock_mode', full_name='data.PbUserDeviceGeneralSettings.button_lock_mode', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='button_sound_volume', full_name='data.PbUserDeviceGeneralSettings.button_sound_volume', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vibration_mode', full_name='data.PbUserDeviceGeneralSettings.vibration_mode', index=5,
number=7, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='handedness', full_name='data.PbUserDeviceGeneralSettings.handedness', index=6,
number=8, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exeview_inverted', full_name='data.PbUserDeviceGeneralSettings.exeview_inverted', index=7,
number=9, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tap_button_sensitivity', full_name='data.PbUserDeviceGeneralSettings.tap_button_sensitivity', index=8,
number=10, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='inactivity_alert', full_name='data.PbUserDeviceGeneralSettings.inactivity_alert', index=9,
number=11, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ble_connect_mode_enable', full_name='data.PbUserDeviceGeneralSettings.ble_connect_mode_enable', index=10,
number=12, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERDEVICEGENERALSETTINGS_PBWATCHFACE,
_PBUSERDEVICEGENERALSETTINGS_PBBUTTONLOCKMODE,
_PBUSERDEVICEGENERALSETTINGS_PBHANDEDNESS,
_PBUSERDEVICEGENERALSETTINGS_PBTAPBUTTONSENSITIVITY,
_PBUSERDEVICEGENERALSETTINGS_PBINACTIVITYALERT,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=41,
serialized_end=1124,
)
_PBUSERDEVICEALARMSETTINGS = _descriptor.Descriptor(
name='PbUserDeviceAlarmSettings',
full_name='data.PbUserDeviceAlarmSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='alarm_mode', full_name='data.PbUserDeviceAlarmSettings.alarm_mode', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='alarm_time', full_name='data.PbUserDeviceAlarmSettings.alarm_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERDEVICEALARMSETTINGS_PBALARMMODE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1127,
serialized_end=1357,
)
_PBUSERDEVICECOUNTDOWNSETTINGS = _descriptor.Descriptor(
name='PbUserDeviceCountdownSettings',
full_name='data.PbUserDeviceCountdownSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='countdown_time', full_name='data.PbUserDeviceCountdownSettings.countdown_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1359,
serialized_end=1427,
)
_PBUSERDEVICEJUMPTESTSETTINGS = _descriptor.Descriptor(
name='PbUserDeviceJumpTestSettings',
full_name='data.PbUserDeviceJumpTestSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='cont_jump_duration', full_name='data.PbUserDeviceJumpTestSettings.cont_jump_duration', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1429,
serialized_end=1500,
)
_PBINTERVALTIMERVALUE = _descriptor.Descriptor(
name='PbIntervalTimerValue',
full_name='data.PbIntervalTimerValue',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='interval_timer_type', full_name='data.PbIntervalTimerValue.interval_timer_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='interval_timer_duration', full_name='data.PbIntervalTimerValue.interval_timer_duration', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='interval_timer_distance', full_name='data.PbIntervalTimerValue.interval_timer_distance', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBINTERVALTIMERVALUE_PBINTERVALTIMERTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1503,
serialized_end=1772,
)
_PBUSERINTERVALTIMERSETTINGS = _descriptor.Descriptor(
name='PbUserIntervalTimerSettings',
full_name='data.PbUserIntervalTimerSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='interval_timer_value', full_name='data.PbUserIntervalTimerSettings.interval_timer_value', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1774,
serialized_end=1861,
)
_PBUSERENDTIMEESTIMATORSETTINGS = _descriptor.Descriptor(
name='PbUserEndTimeEstimatorSettings',
full_name='data.PbUserEndTimeEstimatorSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='end_time_estimator_target', full_name='data.PbUserEndTimeEstimatorSettings.end_time_estimator_target', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1863,
serialized_end=1930,
)
_PBUSERDEVICERESEARCHSETTINGS = _descriptor.Descriptor(
name='PbUserDeviceResearchSettings',
full_name='data.PbUserDeviceResearchSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='accelerometer_raw_data_enable', full_name='data.PbUserDeviceResearchSettings.accelerometer_raw_data_enable', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='gyroscope_raw_data_enable', full_name='data.PbUserDeviceResearchSettings.gyroscope_raw_data_enable', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='magnetometer_raw_data_enable', full_name='data.PbUserDeviceResearchSettings.magnetometer_raw_data_enable', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='linear_acceleration_data_enable', full_name='data.PbUserDeviceResearchSettings.linear_acceleration_data_enable', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1933,
serialized_end=2116,
)
_PBUSERSAFETYLIGHTSETTINGS = _descriptor.Descriptor(
name='PbUserSafetyLightSettings',
full_name='data.PbUserSafetyLightSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mode', full_name='data.PbUserSafetyLightSettings.mode', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activation_level', full_name='data.PbUserSafetyLightSettings.activation_level', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='blink_rate', full_name='data.PbUserSafetyLightSettings.blink_rate', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTMODE,
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTACTIVATIONLEVEL,
_PBUSERSAFETYLIGHTSETTINGS_PBSAFETYLIGHTBLINKRATE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2119,
serialized_end=2677,
)
_PBDONOTDISTURBSETTINGS = _descriptor.Descriptor(
name='PbDoNotDisturbSettings',
full_name='data.PbDoNotDisturbSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='data.PbDoNotDisturbSettings.enabled', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start', full_name='data.PbDoNotDisturbSettings.start', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end', full_name='data.PbDoNotDisturbSettings.end', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2679,
serialized_end=2766,
)
_PBUSERSMARTWATCHNOTIFICATIONSETTINGS = _descriptor.Descriptor(
name='PbUserSmartWatchNotificationSettings',
full_name='data.PbUserSmartWatchNotificationSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='data.PbUserSmartWatchNotificationSettings.enabled', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='preview_enabled', full_name='data.PbUserSmartWatchNotificationSettings.preview_enabled', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='do_not_disturb_settings', full_name='data.PbUserSmartWatchNotificationSettings.do_not_disturb_settings', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sounds_enabled', full_name='data.PbUserSmartWatchNotificationSettings.sounds_enabled', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2769,
serialized_end=2936,
)
_PBUSERDEVICESETTINGS = _descriptor.Descriptor(
name='PbUserDeviceSettings',
full_name='data.PbUserDeviceSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='general_settings', full_name='data.PbUserDeviceSettings.general_settings', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='alarm_settings', full_name='data.PbUserDeviceSettings.alarm_settings', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='countdown_settings', full_name='data.PbUserDeviceSettings.countdown_settings', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_phases_pb2.py | loophole/polar/pb/exercise_phases_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_phases.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_phases.proto',
package='data',
serialized_pb=_b('\n\x15\x65xercise_phases.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"\xb0\x02\n\x0bPbPhaseGoal\x12\x32\n\tgoal_type\x18\x01 \x02(\x0e\x32\x1f.data.PbPhaseGoal.PhaseGoalType\x12\x1d\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x0b.PbDuration\x12\x10\n\x08\x64istance\x18\x03 \x01(\x02\x12\x12\n\nheart_rate\x18\x04 \x01(\r\"\xa7\x01\n\rPhaseGoalType\x12\x12\n\x0ePHASE_GOAL_OFF\x10\x00\x12\x13\n\x0fPHASE_GOAL_TIME\x10\x01\x12\x17\n\x13PHASE_GOAL_DISTANCE\x10\x02\x12\x1c\n\x18PHASE_GOAL_INCREASING_HR\x10\x03\x12\x1c\n\x18PHASE_GOAL_DECREASING_HR\x10\x04\x12\x18\n\x14PHASE_GOAL_RACE_PACE\x10\x05\"\xc7\x03\n\x10PbPhaseIntensity\x12\x41\n\x0eintensity_type\x18\x01 \x02(\x0e\x32).data.PbPhaseIntensity.PhaseIntensityType\x12=\n\x0fheart_rate_zone\x18\x02 \x01(\x0b\x32$.data.PbPhaseIntensity.IntensityZone\x12\x38\n\nspeed_zone\x18\x03 \x01(\x0b\x32$.data.PbPhaseIntensity.IntensityZone\x12\x38\n\npower_zone\x18\x04 \x01(\x0b\x32$.data.PbPhaseIntensity.IntensityZone\x1a-\n\rIntensityZone\x12\r\n\x05lower\x18\x01 \x02(\r\x12\r\n\x05upper\x18\x02 \x02(\r\"\x8d\x01\n\x12PhaseIntensityType\x12\x18\n\x14PHASE_INTENSITY_FREE\x10\x00\x12\x1d\n\x19PHASE_INTENSITY_SPORTZONE\x10\x01\x12\x1e\n\x1aPHASE_INTENSITY_SPEED_ZONE\x10\x02\x12\x1e\n\x1aPHASE_INTENSITY_POWER_ZONE\x10\x03\"\x8c\x02\n\x07PbPhase\x12\x1c\n\x04name\x18\x01 \x02(\x0b\x32\x0e.PbOneLineText\x12/\n\x06\x63hange\x18\x02 \x02(\x0e\x32\x1f.data.PbPhase.PbPhaseChangeType\x12\x1f\n\x04goal\x18\x03 \x02(\x0b\x32\x11.data.PbPhaseGoal\x12)\n\tintensity\x18\x04 \x02(\x0b\x32\x16.data.PbPhaseIntensity\x12\x14\n\x0crepeat_count\x18\x05 \x01(\r\x12\x12\n\njump_index\x18\x06 \x01(\r\"<\n\x11PbPhaseChangeType\x12\x11\n\rCHANGE_MANUAL\x10\x00\x12\x14\n\x10\x43HANGE_AUTOMATIC\x10\x01\"(\n\x08PbPhases\x12\x1c\n\x05phase\x18\x01 \x03(\x0b\x32\r.data.PbPhase')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPHASEGOAL_PHASEGOALTYPE = _descriptor.EnumDescriptor(
name='PhaseGoalType',
full_name='data.PbPhaseGoal.PhaseGoalType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_OFF', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_TIME', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_DISTANCE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_INCREASING_HR', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_DECREASING_HR', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_GOAL_RACE_PACE', index=5, number=5,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=200,
serialized_end=367,
)
_sym_db.RegisterEnumDescriptor(_PBPHASEGOAL_PHASEGOALTYPE)
_PBPHASEINTENSITY_PHASEINTENSITYTYPE = _descriptor.EnumDescriptor(
name='PhaseIntensityType',
full_name='data.PbPhaseIntensity.PhaseIntensityType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='PHASE_INTENSITY_FREE', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_INTENSITY_SPORTZONE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_INTENSITY_SPEED_ZONE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PHASE_INTENSITY_POWER_ZONE', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=684,
serialized_end=825,
)
_sym_db.RegisterEnumDescriptor(_PBPHASEINTENSITY_PHASEINTENSITYTYPE)
_PBPHASE_PBPHASECHANGETYPE = _descriptor.EnumDescriptor(
name='PbPhaseChangeType',
full_name='data.PbPhase.PbPhaseChangeType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='CHANGE_MANUAL', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CHANGE_AUTOMATIC', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1036,
serialized_end=1096,
)
_sym_db.RegisterEnumDescriptor(_PBPHASE_PBPHASECHANGETYPE)
_PBPHASEGOAL = _descriptor.Descriptor(
name='PbPhaseGoal',
full_name='data.PbPhaseGoal',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='goal_type', full_name='data.PbPhaseGoal.goal_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbPhaseGoal.duration', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbPhaseGoal.distance', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate', full_name='data.PbPhaseGoal.heart_rate', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBPHASEGOAL_PHASEGOALTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=63,
serialized_end=367,
)
_PBPHASEINTENSITY_INTENSITYZONE = _descriptor.Descriptor(
name='IntensityZone',
full_name='data.PbPhaseIntensity.IntensityZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='lower', full_name='data.PbPhaseIntensity.IntensityZone.lower', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='upper', full_name='data.PbPhaseIntensity.IntensityZone.upper', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=636,
serialized_end=681,
)
_PBPHASEINTENSITY = _descriptor.Descriptor(
name='PbPhaseIntensity',
full_name='data.PbPhaseIntensity',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='intensity_type', full_name='data.PbPhaseIntensity.intensity_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_zone', full_name='data.PbPhaseIntensity.heart_rate_zone', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_zone', full_name='data.PbPhaseIntensity.speed_zone', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power_zone', full_name='data.PbPhaseIntensity.power_zone', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[_PBPHASEINTENSITY_INTENSITYZONE, ],
enum_types=[
_PBPHASEINTENSITY_PHASEINTENSITYTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=370,
serialized_end=825,
)
_PBPHASE = _descriptor.Descriptor(
name='PbPhase',
full_name='data.PbPhase',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='data.PbPhase.name', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='change', full_name='data.PbPhase.change', index=1,
number=2, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='goal', full_name='data.PbPhase.goal', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='intensity', full_name='data.PbPhase.intensity', index=3,
number=4, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='repeat_count', full_name='data.PbPhase.repeat_count', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='jump_index', full_name='data.PbPhase.jump_index', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBPHASE_PBPHASECHANGETYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=828,
serialized_end=1096,
)
_PBPHASES = _descriptor.Descriptor(
name='PbPhases',
full_name='data.PbPhases',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='phase', full_name='data.PbPhases.phase', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1098,
serialized_end=1138,
)
_PBPHASEGOAL.fields_by_name['goal_type'].enum_type = _PBPHASEGOAL_PHASEGOALTYPE
_PBPHASEGOAL.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBPHASEGOAL_PHASEGOALTYPE.containing_type = _PBPHASEGOAL
_PBPHASEINTENSITY_INTENSITYZONE.containing_type = _PBPHASEINTENSITY
_PBPHASEINTENSITY.fields_by_name['intensity_type'].enum_type = _PBPHASEINTENSITY_PHASEINTENSITYTYPE
_PBPHASEINTENSITY.fields_by_name['heart_rate_zone'].message_type = _PBPHASEINTENSITY_INTENSITYZONE
_PBPHASEINTENSITY.fields_by_name['speed_zone'].message_type = _PBPHASEINTENSITY_INTENSITYZONE
_PBPHASEINTENSITY.fields_by_name['power_zone'].message_type = _PBPHASEINTENSITY_INTENSITYZONE
_PBPHASEINTENSITY_PHASEINTENSITYTYPE.containing_type = _PBPHASEINTENSITY
_PBPHASE.fields_by_name['name'].message_type = structures_pb2._PBONELINETEXT
_PBPHASE.fields_by_name['change'].enum_type = _PBPHASE_PBPHASECHANGETYPE
_PBPHASE.fields_by_name['goal'].message_type = _PBPHASEGOAL
_PBPHASE.fields_by_name['intensity'].message_type = _PBPHASEINTENSITY
_PBPHASE_PBPHASECHANGETYPE.containing_type = _PBPHASE
_PBPHASES.fields_by_name['phase'].message_type = _PBPHASE
DESCRIPTOR.message_types_by_name['PbPhaseGoal'] = _PBPHASEGOAL
DESCRIPTOR.message_types_by_name['PbPhaseIntensity'] = _PBPHASEINTENSITY
DESCRIPTOR.message_types_by_name['PbPhase'] = _PBPHASE
DESCRIPTOR.message_types_by_name['PbPhases'] = _PBPHASES
PbPhaseGoal = _reflection.GeneratedProtocolMessageType('PbPhaseGoal', (_message.Message,), dict(
DESCRIPTOR = _PBPHASEGOAL,
__module__ = 'exercise_phases_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseGoal)
))
_sym_db.RegisterMessage(PbPhaseGoal)
PbPhaseIntensity = _reflection.GeneratedProtocolMessageType('PbPhaseIntensity', (_message.Message,), dict(
IntensityZone = _reflection.GeneratedProtocolMessageType('IntensityZone', (_message.Message,), dict(
DESCRIPTOR = _PBPHASEINTENSITY_INTENSITYZONE,
__module__ = 'exercise_phases_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseIntensity.IntensityZone)
))
,
DESCRIPTOR = _PBPHASEINTENSITY,
__module__ = 'exercise_phases_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseIntensity)
))
_sym_db.RegisterMessage(PbPhaseIntensity)
_sym_db.RegisterMessage(PbPhaseIntensity.IntensityZone)
PbPhase = _reflection.GeneratedProtocolMessageType('PbPhase', (_message.Message,), dict(
DESCRIPTOR = _PBPHASE,
__module__ = 'exercise_phases_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhase)
))
_sym_db.RegisterMessage(PbPhase)
PbPhases = _reflection.GeneratedProtocolMessageType('PbPhases', (_message.Message,), dict(
DESCRIPTOR = _PBPHASES,
__module__ = 'exercise_phases_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhases)
))
_sym_db.RegisterMessage(PbPhases)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/pftp_error_pb2.py | loophole/polar/pb/pftp_error_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pftp/pftp_error.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='pftp/pftp_error.proto',
package='protocol',
syntax='proto2',
serialized_pb=_b('\n\x15pftp/pftp_error.proto\x12\x08protocol*\xf5\x03\n\x0bPbPFtpError\x12\x17\n\x13OPERATION_SUCCEEDED\x10\x00\x12\r\n\tREBOOTING\x10\x01\x12\r\n\tTRY_AGAIN\x10\x02\x12\x1b\n\x17UNIDENTIFIED_HOST_ERROR\x10\x64\x12\x13\n\x0fINVALID_COMMAND\x10\x65\x12\x15\n\x11INVALID_PARAMETER\x10\x66\x12\x1d\n\x19NO_SUCH_FILE_OR_DIRECTORY\x10g\x12\x14\n\x10\x44IRECTORY_EXISTS\x10h\x12\x0f\n\x0b\x46ILE_EXISTS\x10i\x12\x1b\n\x17OPERATION_NOT_PERMITTED\x10j\x12\x10\n\x0cNO_SUCH_USER\x10k\x12\x0b\n\x07TIMEOUT\x10l\x12\x1e\n\x19UNIDENTIFIED_DEVICE_ERROR\x10\xc8\x01\x12\x14\n\x0fNOT_IMPLEMENTED\x10\xc9\x01\x12\x10\n\x0bSYSTEM_BUSY\x10\xca\x01\x12\x14\n\x0fINVALID_CONTENT\x10\xcb\x01\x12\x15\n\x10\x43HECKSUM_FAILURE\x10\xcc\x01\x12\x0e\n\tDISK_FULL\x10\xcd\x01\x12\x19\n\x14PREREQUISITE_NOT_MET\x10\xce\x01\x12\x18\n\x13INSUFFICIENT_BUFFER\x10\xcf\x01\x12\x14\n\x0fWAIT_FOR_IDLING\x10\xd0\x01\x12\x14\n\x0f\x42\x41TTERY_TOO_LOW\x10\xd1\x01')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPFTPERROR = _descriptor.EnumDescriptor(
name='PbPFtpError',
full_name='protocol.PbPFtpError',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='OPERATION_SUCCEEDED', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REBOOTING', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TRY_AGAIN', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UNIDENTIFIED_HOST_ERROR', index=3, number=100,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INVALID_COMMAND', index=4, number=101,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INVALID_PARAMETER', index=5, number=102,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NO_SUCH_FILE_OR_DIRECTORY', index=6, number=103,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DIRECTORY_EXISTS', index=7, number=104,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FILE_EXISTS', index=8, number=105,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='OPERATION_NOT_PERMITTED', index=9, number=106,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NO_SUCH_USER', index=10, number=107,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIMEOUT', index=11, number=108,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UNIDENTIFIED_DEVICE_ERROR', index=12, number=200,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NOT_IMPLEMENTED', index=13, number=201,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SYSTEM_BUSY', index=14, number=202,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INVALID_CONTENT', index=15, number=203,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CHECKSUM_FAILURE', index=16, number=204,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DISK_FULL', index=17, number=205,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREREQUISITE_NOT_MET', index=18, number=206,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INSUFFICIENT_BUFFER', index=19, number=207,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WAIT_FOR_IDLING', index=20, number=208,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BATTERY_TOO_LOW', index=21, number=209,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=36,
serialized_end=537,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPERROR)
PbPFtpError = enum_type_wrapper.EnumTypeWrapper(_PBPFTPERROR)
OPERATION_SUCCEEDED = 0
REBOOTING = 1
TRY_AGAIN = 2
UNIDENTIFIED_HOST_ERROR = 100
INVALID_COMMAND = 101
INVALID_PARAMETER = 102
NO_SUCH_FILE_OR_DIRECTORY = 103
DIRECTORY_EXISTS = 104
FILE_EXISTS = 105
OPERATION_NOT_PERMITTED = 106
NO_SUCH_USER = 107
TIMEOUT = 108
UNIDENTIFIED_DEVICE_ERROR = 200
NOT_IMPLEMENTED = 201
SYSTEM_BUSY = 202
INVALID_CONTENT = 203
CHECKSUM_FAILURE = 204
DISK_FULL = 205
PREREQUISITE_NOT_MET = 206
INSUFFICIENT_BUFFER = 207
WAIT_FOR_IDLING = 208
BATTERY_TOO_LOW = 209
DESCRIPTOR.enum_types_by_name['PbPFtpError'] = _PBPFTPERROR
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/map_information_pb2.py | loophole/polar/pb/map_information_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: map_information.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='map_information.proto',
package='data',
serialized_pb=_b('\n\x15map_information.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"4\n\rPbMapLocation\x12\x10\n\x08latitude\x18\x01 \x02(\x01\x12\x11\n\tlongitude\x18\x02 \x02(\x01\"\x80\x01\n\x10PbMapInformation\x12)\n\x0c\x63\x65ntre_point\x18\x01 \x02(\x0b\x32\x13.data.PbMapLocation\x12)\n\x0e\x64\x61ta_timestamp\x18\x02 \x01(\x0b\x32\x11.PbSystemDateTime\x12\x16\n\x07updated\x18\x03 \x01(\x08:\x05\x66\x61lse')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBMAPLOCATION = _descriptor.Descriptor(
name='PbMapLocation',
full_name='data.PbMapLocation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbMapLocation.latitude', index=0,
number=1, type=1, cpp_type=5, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbMapLocation.longitude', index=1,
number=2, type=1, cpp_type=5, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=44,
serialized_end=96,
)
_PBMAPINFORMATION = _descriptor.Descriptor(
name='PbMapInformation',
full_name='data.PbMapInformation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='centre_point', full_name='data.PbMapInformation.centre_point', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='data_timestamp', full_name='data.PbMapInformation.data_timestamp', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='updated', full_name='data.PbMapInformation.updated', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=99,
serialized_end=227,
)
_PBMAPINFORMATION.fields_by_name['centre_point'].message_type = _PBMAPLOCATION
_PBMAPINFORMATION.fields_by_name['data_timestamp'].message_type = types_pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbMapLocation'] = _PBMAPLOCATION
DESCRIPTOR.message_types_by_name['PbMapInformation'] = _PBMAPINFORMATION
PbMapLocation = _reflection.GeneratedProtocolMessageType('PbMapLocation', (_message.Message,), dict(
DESCRIPTOR = _PBMAPLOCATION,
__module__ = 'map_information_pb2'
# @@protoc_insertion_point(class_scope:data.PbMapLocation)
))
_sym_db.RegisterMessage(PbMapLocation)
PbMapInformation = _reflection.GeneratedProtocolMessageType('PbMapInformation', (_message.Message,), dict(
DESCRIPTOR = _PBMAPINFORMATION,
__module__ = 'map_information_pb2'
# @@protoc_insertion_point(class_scope:data.PbMapInformation)
))
_sym_db.RegisterMessage(PbMapInformation)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_samples2_pb2.py | loophole/polar/pb/exercise_samples2_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: data/exercise_samples2.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='data/exercise_samples2.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x1c\x64\x61ta/exercise_samples2.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\x8c\x03\n\x1aPbExerciseSamplesSyncPoint\x12\r\n\x05index\x18\x01 \x02(\r\x12\x19\n\x11heart_rate_sample\x18\x02 \x01(\r\x12\x16\n\x0e\x63\x61\x64\x65nce_sample\x18\x03 \x01(\r\x12\x14\n\x0cspeed_sample\x18\x04 \x01(\x02\x12\x17\n\x0f\x64istance_sample\x18\x05 \x01(\x02\x12#\n\x1b\x66orward_acceleration_sample\x18\x06 \x01(\x02\x12\x1f\n\x17\x61\x63\x63\x65leration_mad_sample\x18\n \x01(\x02\x12&\n\x18speed_sample_granularity\x18\x07 \x01(\r:\x04\x31\x30\x30\x30\x12\'\n\x1b\x64istance_sample_granularity\x18\x08 \x01(\r:\x02\x31\x30\x12\x34\n\'forward_acceleration_sample_granularity\x18\t \x01(\r:\x03\x31\x30\x30\x12\x30\n#acceleration_mad_sample_granularity\x18\x0b \x01(\r:\x03\x31\x30\x30\"\x9d\x03\n PbExerciseIntervalledSample2List\x12\"\n\x0bsample_type\x18\x01 \x02(\x0e\x32\r.PbSampleType\x12\x1d\n\x15recording_interval_ms\x18\x02 \x02(\r\x12\x34\n\nsync_point\x18\x03 \x03(\x0b\x32 .data.PbExerciseSamplesSyncPoint\x12&\n\rsample_source\x18\x04 \x03(\x0b\x32\x0f.PbSampleSource\x12\x1a\n\x12heart_rate_samples\x18\x05 \x03(\x11\x12\x17\n\x0f\x63\x61\x64\x65nce_samples\x18\x06 \x03(\x11\x12\x15\n\rspeed_samples\x18\x07 \x03(\x11\x12\x18\n\x10\x64istance_samples\x18\x08 \x03(\r\x12$\n\x1c\x66orward_acceleration_samples\x18\t \x03(\x11\x12 \n\x18\x61\x63\x63\x65leration_mad_samples\x18\x0b \x03(\x11\x12*\n\x13moving_type_samples\x18\n \x03(\x0e\x32\r.PbMovingType\"g\n\x12PbExerciseSamples2\x12Q\n!exercise_intervalled_sample2_list\x18\x01 \x03(\x0b\x32&.data.PbExerciseIntervalledSample2List')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBEXERCISESAMPLESSYNCPOINT = _descriptor.Descriptor(
name='PbExerciseSamplesSyncPoint',
full_name='data.PbExerciseSamplesSyncPoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='index', full_name='data.PbExerciseSamplesSyncPoint.index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_sample', full_name='data.PbExerciseSamplesSyncPoint.heart_rate_sample', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence_sample', full_name='data.PbExerciseSamplesSyncPoint.cadence_sample', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_sample', full_name='data.PbExerciseSamplesSyncPoint.speed_sample', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_sample', full_name='data.PbExerciseSamplesSyncPoint.distance_sample', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration_sample', full_name='data.PbExerciseSamplesSyncPoint.forward_acceleration_sample', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='acceleration_mad_sample', full_name='data.PbExerciseSamplesSyncPoint.acceleration_mad_sample', index=6,
number=10, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_sample_granularity', full_name='data.PbExerciseSamplesSyncPoint.speed_sample_granularity', index=7,
number=7, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=1000,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_sample_granularity', full_name='data.PbExerciseSamplesSyncPoint.distance_sample_granularity', index=8,
number=8, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=10,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration_sample_granularity', full_name='data.PbExerciseSamplesSyncPoint.forward_acceleration_sample_granularity', index=9,
number=9, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=100,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='acceleration_mad_sample_granularity', full_name='data.PbExerciseSamplesSyncPoint.acceleration_mad_sample_granularity', index=10,
number=11, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=100,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=52,
serialized_end=448,
)
_PBEXERCISEINTERVALLEDSAMPLE2LIST = _descriptor.Descriptor(
name='PbExerciseIntervalledSample2List',
full_name='data.PbExerciseIntervalledSample2List',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sample_type', full_name='data.PbExerciseIntervalledSample2List.sample_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recording_interval_ms', full_name='data.PbExerciseIntervalledSample2List.recording_interval_ms', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sync_point', full_name='data.PbExerciseIntervalledSample2List.sync_point', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sample_source', full_name='data.PbExerciseIntervalledSample2List.sample_source', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_samples', full_name='data.PbExerciseIntervalledSample2List.heart_rate_samples', index=4,
number=5, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence_samples', full_name='data.PbExerciseIntervalledSample2List.cadence_samples', index=5,
number=6, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_samples', full_name='data.PbExerciseIntervalledSample2List.speed_samples', index=6,
number=7, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_samples', full_name='data.PbExerciseIntervalledSample2List.distance_samples', index=7,
number=8, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='forward_acceleration_samples', full_name='data.PbExerciseIntervalledSample2List.forward_acceleration_samples', index=8,
number=9, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='acceleration_mad_samples', full_name='data.PbExerciseIntervalledSample2List.acceleration_mad_samples', index=9,
number=11, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='moving_type_samples', full_name='data.PbExerciseIntervalledSample2List.moving_type_samples', index=10,
number=10, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=451,
serialized_end=864,
)
_PBEXERCISESAMPLES2 = _descriptor.Descriptor(
name='PbExerciseSamples2',
full_name='data.PbExerciseSamples2',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='exercise_intervalled_sample2_list', full_name='data.PbExerciseSamples2.exercise_intervalled_sample2_list', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=866,
serialized_end=969,
)
_PBEXERCISEINTERVALLEDSAMPLE2LIST.fields_by_name['sample_type'].enum_type = types__pb2._PBSAMPLETYPE
_PBEXERCISEINTERVALLEDSAMPLE2LIST.fields_by_name['sync_point'].message_type = _PBEXERCISESAMPLESSYNCPOINT
_PBEXERCISEINTERVALLEDSAMPLE2LIST.fields_by_name['sample_source'].message_type = types__pb2._PBSAMPLESOURCE
_PBEXERCISEINTERVALLEDSAMPLE2LIST.fields_by_name['moving_type_samples'].enum_type = types__pb2._PBMOVINGTYPE
_PBEXERCISESAMPLES2.fields_by_name['exercise_intervalled_sample2_list'].message_type = _PBEXERCISEINTERVALLEDSAMPLE2LIST
DESCRIPTOR.message_types_by_name['PbExerciseSamplesSyncPoint'] = _PBEXERCISESAMPLESSYNCPOINT
DESCRIPTOR.message_types_by_name['PbExerciseIntervalledSample2List'] = _PBEXERCISEINTERVALLEDSAMPLE2LIST
DESCRIPTOR.message_types_by_name['PbExerciseSamples2'] = _PBEXERCISESAMPLES2
PbExerciseSamplesSyncPoint = _reflection.GeneratedProtocolMessageType('PbExerciseSamplesSyncPoint', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISESAMPLESSYNCPOINT,
__module__ = 'data.exercise_samples2_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseSamplesSyncPoint)
))
_sym_db.RegisterMessage(PbExerciseSamplesSyncPoint)
PbExerciseIntervalledSample2List = _reflection.GeneratedProtocolMessageType('PbExerciseIntervalledSample2List', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISEINTERVALLEDSAMPLE2LIST,
__module__ = 'data.exercise_samples2_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseIntervalledSample2List)
))
_sym_db.RegisterMessage(PbExerciseIntervalledSample2List)
PbExerciseSamples2 = _reflection.GeneratedProtocolMessageType('PbExerciseSamples2', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISESAMPLES2,
__module__ = 'data.exercise_samples2_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseSamples2)
))
_sym_db.RegisterMessage(PbExerciseSamples2)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_guitar_settings_pb2.py | loophole/polar/pb/sportprofile_guitar_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_guitar_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_guitar_settings.proto',
package='data',
serialized_pb=_b('\n\"sportprofile_guitar_settings.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"\x94\x08\n\x1cPbGuitarSportProfileSettings\x12\x44\n\x0bheart_touch\x18\x01 \x01(\x0e\x32/.data.PbGuitarSportProfileSettings.PbHeartTouch\x12O\n\x11tap_button_action\x18\x02 \x01(\x0e\x32\x34.data.PbGuitarSportProfileSettings.PbTapButtonAction\x12\x11\n\tvibration\x18\x03 \x01(\x08\x12\x12\n\nauto_start\x18\x04 \x01(\x08\x12\x16\n\x0e\x61uto_scrolling\x18\x05 \x01(\x08\x12\x42\n\x1cstride_sensor_calib_settings\x18\x06 \x01(\x0b\x32\x1c.PbStrideSensorCalibSettings\x12!\n\x19sprint_display_activation\x18\x07 \x01(\r\x12\x89\x01\n\x1csport_tap_button_sensitivity\x18\x08 \x01(\x0e\x32>.data.PbGuitarSportProfileSettings.PbSportTapButtonSensitivity:#SPORT_TAP_BUTTON_SENSITIVITY_MEDIUM\x12*\n\rswimming_pool\x18\t \x01(\x0b\x32\x13.PbSwimmingPoolInfo\"\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04\"\x88\x01\n\x11PbTapButtonAction\x12\x12\n\x0eTAP_BUTTON_OFF\x10\x01\x12\x17\n\x13TAP_BUTTON_TAKE_LAP\x10\x02\x12#\n\x1fTAP_BUTTON_CHANGE_TRAINING_VIEW\x10\x03\x12!\n\x1dTAP_BUTTON_ACTIVATE_BACKLIGHT\x10\x04\"\xe4\x01\n\x1bPbSportTapButtonSensitivity\x12$\n SPORT_TAP_BUTTON_SENSITIVITY_OFF\x10\x01\x12)\n%SPORT_TAP_BUTTON_SENSITIVITY_VERY_LOW\x10\x05\x12$\n SPORT_TAP_BUTTON_SENSITIVITY_LOW\x10\x02\x12\'\n#SPORT_TAP_BUTTON_SENSITIVITY_MEDIUM\x10\x03\x12%\n!SPORT_TAP_BUTTON_SENSITIVITY_HIGH\x10\x04')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBGUITARSPORTPROFILESETTINGS_PBHEARTTOUCH = _descriptor.EnumDescriptor(
name='PbHeartTouch',
full_name='data.PbGuitarSportProfileSettings.PbHeartTouch',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_PREVIOUS_LAP', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_TIME_OF_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=610,
serialized_end=750,
)
_sym_db.RegisterEnumDescriptor(_PBGUITARSPORTPROFILESETTINGS_PBHEARTTOUCH)
_PBGUITARSPORTPROFILESETTINGS_PBTAPBUTTONACTION = _descriptor.EnumDescriptor(
name='PbTapButtonAction',
full_name='data.PbGuitarSportProfileSettings.PbTapButtonAction',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_TAKE_LAP', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_CHANGE_TRAINING_VIEW', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_ACTIVATE_BACKLIGHT', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=753,
serialized_end=889,
)
_sym_db.RegisterEnumDescriptor(_PBGUITARSPORTPROFILESETTINGS_PBTAPBUTTONACTION)
_PBGUITARSPORTPROFILESETTINGS_PBSPORTTAPBUTTONSENSITIVITY = _descriptor.EnumDescriptor(
name='PbSportTapButtonSensitivity',
full_name='data.PbGuitarSportProfileSettings.PbSportTapButtonSensitivity',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SPORT_TAP_BUTTON_SENSITIVITY_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TAP_BUTTON_SENSITIVITY_VERY_LOW', index=1, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TAP_BUTTON_SENSITIVITY_LOW', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TAP_BUTTON_SENSITIVITY_MEDIUM', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TAP_BUTTON_SENSITIVITY_HIGH', index=4, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=892,
serialized_end=1120,
)
_sym_db.RegisterEnumDescriptor(_PBGUITARSPORTPROFILESETTINGS_PBSPORTTAPBUTTONSENSITIVITY)
_PBGUITARSPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbGuitarSportProfileSettings',
full_name='data.PbGuitarSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_touch', full_name='data.PbGuitarSportProfileSettings.heart_touch', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tap_button_action', full_name='data.PbGuitarSportProfileSettings.tap_button_action', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vibration', full_name='data.PbGuitarSportProfileSettings.vibration', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbGuitarSportProfileSettings.auto_start', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_scrolling', full_name='data.PbGuitarSportProfileSettings.auto_scrolling', index=4,
number=5, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_sensor_calib_settings', full_name='data.PbGuitarSportProfileSettings.stride_sensor_calib_settings', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sprint_display_activation', full_name='data.PbGuitarSportProfileSettings.sprint_display_activation', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_tap_button_sensitivity', full_name='data.PbGuitarSportProfileSettings.sport_tap_button_sensitivity', index=7,
number=8, type=14, cpp_type=8, label=1,
has_default_value=True, default_value=3,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming_pool', full_name='data.PbGuitarSportProfileSettings.swimming_pool', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBGUITARSPORTPROFILESETTINGS_PBHEARTTOUCH,
_PBGUITARSPORTPROFILESETTINGS_PBTAPBUTTONACTION,
_PBGUITARSPORTPROFILESETTINGS_PBSPORTTAPBUTTONSENSITIVITY,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=76,
serialized_end=1120,
)
_PBGUITARSPORTPROFILESETTINGS.fields_by_name['heart_touch'].enum_type = _PBGUITARSPORTPROFILESETTINGS_PBHEARTTOUCH
_PBGUITARSPORTPROFILESETTINGS.fields_by_name['tap_button_action'].enum_type = _PBGUITARSPORTPROFILESETTINGS_PBTAPBUTTONACTION
_PBGUITARSPORTPROFILESETTINGS.fields_by_name['stride_sensor_calib_settings'].message_type = types_pb2._PBSTRIDESENSORCALIBSETTINGS
_PBGUITARSPORTPROFILESETTINGS.fields_by_name['sport_tap_button_sensitivity'].enum_type = _PBGUITARSPORTPROFILESETTINGS_PBSPORTTAPBUTTONSENSITIVITY
_PBGUITARSPORTPROFILESETTINGS.fields_by_name['swimming_pool'].message_type = structures_pb2._PBSWIMMINGPOOLINFO
_PBGUITARSPORTPROFILESETTINGS_PBHEARTTOUCH.containing_type = _PBGUITARSPORTPROFILESETTINGS
_PBGUITARSPORTPROFILESETTINGS_PBTAPBUTTONACTION.containing_type = _PBGUITARSPORTPROFILESETTINGS
_PBGUITARSPORTPROFILESETTINGS_PBSPORTTAPBUTTONSENSITIVITY.containing_type = _PBGUITARSPORTPROFILESETTINGS
DESCRIPTOR.message_types_by_name['PbGuitarSportProfileSettings'] = _PBGUITARSPORTPROFILESETTINGS
PbGuitarSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbGuitarSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBGUITARSPORTPROFILESETTINGS,
__module__ = 'sportprofile_guitar_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbGuitarSportProfileSettings)
))
_sym_db.RegisterMessage(PbGuitarSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/act_dailygoal_pb2.py | loophole/polar/pb/act_dailygoal_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: act_dailygoal.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='act_dailygoal.proto',
package='data',
serialized_pb=_b('\n\x13\x61\x63t_dailygoal.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"G\n\x14PbActivityMetMinGoal\x12\x0c\n\x04goal\x18\x01 \x02(\x02\x12!\n\x19\x61\x63tivity_cutoff_threshold\x18\x02 \x01(\x02\"\x86\x01\n\x12PbPolarBalanceGoal\x12\x1b\n\nstart_date\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\rtarget_weight\x18\x02 \x01(\x02\x12\x1e\n\x16goal_duration_in_weeks\x18\x03 \x01(\r\x12\x1c\n\x14\x66raction_of_activity\x18\x04 \x01(\x02\"\xea\x02\n\x13PbDailyActivityGoal\x12?\n\tgoal_type\x18\x03 \x01(\x0e\x32,.data.PbDailyActivityGoal.PbActivityGoalType\x12\x38\n\x14\x61\x63tivity_metmin_goal\x18\x01 \x01(\x0b\x32\x1a.data.PbActivityMetMinGoal\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12\x34\n\x12polar_balance_goal\x18\x04 \x01(\x0b\x32\x18.data.PbPolarBalanceGoal\"x\n\x12PbActivityGoalType\x12 \n\x1c\x41\x43TIVITY_GOAL_DAILY_ACTIVITY\x10\x01\x12\x1d\n\x19\x41\x43TIVITY_GOAL_WEIGHT_LOSS\x10\x02\x12!\n\x1d\x41\x43TIVITY_GOAL_WEIGHT_MAINTAIN\x10\x03')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBDAILYACTIVITYGOAL_PBACTIVITYGOALTYPE = _descriptor.EnumDescriptor(
name='PbActivityGoalType',
full_name='data.PbDailyActivityGoal.PbActivityGoalType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ACTIVITY_GOAL_DAILY_ACTIVITY', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVITY_GOAL_WEIGHT_LOSS', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVITY_GOAL_WEIGHT_MAINTAIN', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=495,
serialized_end=615,
)
_sym_db.RegisterEnumDescriptor(_PBDAILYACTIVITYGOAL_PBACTIVITYGOALTYPE)
_PBACTIVITYMETMINGOAL = _descriptor.Descriptor(
name='PbActivityMetMinGoal',
full_name='data.PbActivityMetMinGoal',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='goal', full_name='data.PbActivityMetMinGoal.goal', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_cutoff_threshold', full_name='data.PbActivityMetMinGoal.activity_cutoff_threshold', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=42,
serialized_end=113,
)
_PBPOLARBALANCEGOAL = _descriptor.Descriptor(
name='PbPolarBalanceGoal',
full_name='data.PbPolarBalanceGoal',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_date', full_name='data.PbPolarBalanceGoal.start_date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_weight', full_name='data.PbPolarBalanceGoal.target_weight', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='goal_duration_in_weeks', full_name='data.PbPolarBalanceGoal.goal_duration_in_weeks', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fraction_of_activity', full_name='data.PbPolarBalanceGoal.fraction_of_activity', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=116,
serialized_end=250,
)
_PBDAILYACTIVITYGOAL = _descriptor.Descriptor(
name='PbDailyActivityGoal',
full_name='data.PbDailyActivityGoal',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='goal_type', full_name='data.PbDailyActivityGoal.goal_type', index=0,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_metmin_goal', full_name='data.PbDailyActivityGoal.activity_metmin_goal', index=1,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbDailyActivityGoal.last_modified', index=2,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='polar_balance_goal', full_name='data.PbDailyActivityGoal.polar_balance_goal', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBDAILYACTIVITYGOAL_PBACTIVITYGOALTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=253,
serialized_end=615,
)
_PBPOLARBALANCEGOAL.fields_by_name['start_date'].message_type = types_pb2._PBDATE
_PBDAILYACTIVITYGOAL.fields_by_name['goal_type'].enum_type = _PBDAILYACTIVITYGOAL_PBACTIVITYGOALTYPE
_PBDAILYACTIVITYGOAL.fields_by_name['activity_metmin_goal'].message_type = _PBACTIVITYMETMINGOAL
_PBDAILYACTIVITYGOAL.fields_by_name['last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
_PBDAILYACTIVITYGOAL.fields_by_name['polar_balance_goal'].message_type = _PBPOLARBALANCEGOAL
_PBDAILYACTIVITYGOAL_PBACTIVITYGOALTYPE.containing_type = _PBDAILYACTIVITYGOAL
DESCRIPTOR.message_types_by_name['PbActivityMetMinGoal'] = _PBACTIVITYMETMINGOAL
DESCRIPTOR.message_types_by_name['PbPolarBalanceGoal'] = _PBPOLARBALANCEGOAL
DESCRIPTOR.message_types_by_name['PbDailyActivityGoal'] = _PBDAILYACTIVITYGOAL
PbActivityMetMinGoal = _reflection.GeneratedProtocolMessageType('PbActivityMetMinGoal', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYMETMINGOAL,
__module__ = 'act_dailygoal_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivityMetMinGoal)
))
_sym_db.RegisterMessage(PbActivityMetMinGoal)
PbPolarBalanceGoal = _reflection.GeneratedProtocolMessageType('PbPolarBalanceGoal', (_message.Message,), dict(
DESCRIPTOR = _PBPOLARBALANCEGOAL,
__module__ = 'act_dailygoal_pb2'
# @@protoc_insertion_point(class_scope:data.PbPolarBalanceGoal)
))
_sym_db.RegisterMessage(PbPolarBalanceGoal)
PbDailyActivityGoal = _reflection.GeneratedProtocolMessageType('PbDailyActivityGoal', (_message.Message,), dict(
DESCRIPTOR = _PBDAILYACTIVITYGOAL,
__module__ = 'act_dailygoal_pb2'
# @@protoc_insertion_point(class_scope:data.PbDailyActivityGoal)
))
_sym_db.RegisterMessage(PbDailyActivityGoal)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_id_pb2.py | loophole/polar/pb/user_id_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_id.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_id.proto',
package='data',
serialized_pb=_b('\n\ruser_id.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"3\n\x0fPbPasswordToken\x12\r\n\x05token\x18\x01 \x02(\x0c\x12\x11\n\tencrypted\x18\x02 \x02(\x08\"\xd6\x01\n\x10PbUserIdentifier\x12\x19\n\x11master_identifier\x18\x01 \x01(\x04\x12\r\n\x05\x65mail\x18\x02 \x01(\t\x12-\n\x0epassword_token\x18\x03 \x01(\x0b\x32\x15.data.PbPasswordToken\x12\x10\n\x08nickname\x18\x04 \x01(\t\x12\x12\n\nfirst_name\x18\x05 \x01(\t\x12\x11\n\tlast_name\x18\x06 \x01(\t\x12\x30\n\x15user_id_last_modified\x18\x64 \x01(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPASSWORDTOKEN = _descriptor.Descriptor(
name='PbPasswordToken',
full_name='data.PbPasswordToken',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='token', full_name='data.PbPasswordToken.token', index=0,
number=1, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='encrypted', full_name='data.PbPasswordToken.encrypted', index=1,
number=2, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=36,
serialized_end=87,
)
_PBUSERIDENTIFIER = _descriptor.Descriptor(
name='PbUserIdentifier',
full_name='data.PbUserIdentifier',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='master_identifier', full_name='data.PbUserIdentifier.master_identifier', index=0,
number=1, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='email', full_name='data.PbUserIdentifier.email', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='password_token', full_name='data.PbUserIdentifier.password_token', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='nickname', full_name='data.PbUserIdentifier.nickname', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='first_name', full_name='data.PbUserIdentifier.first_name', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_name', full_name='data.PbUserIdentifier.last_name', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='user_id_last_modified', full_name='data.PbUserIdentifier.user_id_last_modified', index=6,
number=100, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=90,
serialized_end=304,
)
_PBUSERIDENTIFIER.fields_by_name['password_token'].message_type = _PBPASSWORDTOKEN
_PBUSERIDENTIFIER.fields_by_name['user_id_last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbPasswordToken'] = _PBPASSWORDTOKEN
DESCRIPTOR.message_types_by_name['PbUserIdentifier'] = _PBUSERIDENTIFIER
PbPasswordToken = _reflection.GeneratedProtocolMessageType('PbPasswordToken', (_message.Message,), dict(
DESCRIPTOR = _PBPASSWORDTOKEN,
__module__ = 'user_id_pb2'
# @@protoc_insertion_point(class_scope:data.PbPasswordToken)
))
_sym_db.RegisterMessage(PbPasswordToken)
PbUserIdentifier = _reflection.GeneratedProtocolMessageType('PbUserIdentifier', (_message.Message,), dict(
DESCRIPTOR = _PBUSERIDENTIFIER,
__module__ = 'user_id_pb2'
# @@protoc_insertion_point(class_scope:data.PbUserIdentifier)
))
_sym_db.RegisterMessage(PbUserIdentifier)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/orthostatictestresult_pb2.py | loophole/polar/pb/orthostatictestresult_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: orthostatictestresult.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='orthostatictestresult.proto',
package='data',
serialized_pb=_b('\n\x1borthostatictestresult.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xa6\x02\n\x17PbOrthostaticTestResult\x12$\n\nstart_time\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12$\n\nreset_time\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x15\n\rrr_avg_supine\x18\x03 \x02(\r\x12\"\n\x1arr_long_term_avg_of_supine\x18\x04 \x02(\r\x12\x1c\n\x14rr_min_after_standup\x18\x05 \x02(\r\x12-\n%rr_long_term_avg_of_min_after_standup\x18\x06 \x02(\r\x12\x14\n\x0crr_avg_stand\x18\x07 \x02(\r\x12!\n\x19rr_long_term_avg_of_stand\x18\x08 \x02(\r')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBORTHOSTATICTESTRESULT = _descriptor.Descriptor(
name='PbOrthostaticTestResult',
full_name='data.PbOrthostaticTestResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbOrthostaticTestResult.start_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='reset_time', full_name='data.PbOrthostaticTestResult.reset_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_avg_supine', full_name='data.PbOrthostaticTestResult.rr_avg_supine', index=2,
number=3, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_long_term_avg_of_supine', full_name='data.PbOrthostaticTestResult.rr_long_term_avg_of_supine', index=3,
number=4, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_min_after_standup', full_name='data.PbOrthostaticTestResult.rr_min_after_standup', index=4,
number=5, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_long_term_avg_of_min_after_standup', full_name='data.PbOrthostaticTestResult.rr_long_term_avg_of_min_after_standup', index=5,
number=6, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_avg_stand', full_name='data.PbOrthostaticTestResult.rr_avg_stand', index=6,
number=7, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_long_term_avg_of_stand', full_name='data.PbOrthostaticTestResult.rr_long_term_avg_of_stand', index=7,
number=8, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=51,
serialized_end=345,
)
_PBORTHOSTATICTESTRESULT.fields_by_name['start_time'].message_type = types_pb2._PBLOCALDATETIME
_PBORTHOSTATICTESTRESULT.fields_by_name['reset_time'].message_type = types_pb2._PBLOCALDATETIME
DESCRIPTOR.message_types_by_name['PbOrthostaticTestResult'] = _PBORTHOSTATICTESTRESULT
PbOrthostaticTestResult = _reflection.GeneratedProtocolMessageType('PbOrthostaticTestResult', (_message.Message,), dict(
DESCRIPTOR = _PBORTHOSTATICTESTRESULT,
__module__ = 'orthostatictestresult_pb2'
# @@protoc_insertion_point(class_scope:data.PbOrthostaticTestResult)
))
_sym_db.RegisterMessage(PbOrthostaticTestResult)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/recovery_times_pb2.py | loophole/polar/pb/recovery_times_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: recovery_times.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='recovery_times.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x14recovery_times.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xa2\x03\n\x0fPbRecoveryTimes\x12(\n\x0estart_of_times\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x16\n\x0erecovery_times\x18\x02 \x03(\x02\x12!\n\x19\x65nd_glycogen_left_percent\x18\x03 \x01(\x02\x12\x1d\n\x15\x65nd_carbo_consumption\x18\x04 \x01(\x02\x12\x1f\n\x17\x65nd_protein_consumption\x18\x05 \x01(\x02\x12*\n\"end_cumulative_mechanical_stimulus\x18\x06 \x01(\x02\x12\x1e\n\x16last_half_hour_avg_met\x18\x07 \x01(\x02\x12\x19\n\x11\x65xercise_calories\x18\x08 \x01(\x02\x12\x19\n\x11\x61\x63tivity_calories\x18\t \x01(\x02\x12\x14\n\x0c\x62mr_calories\x18\n \x01(\x02\x12\r\n\x05steps\x18\x0b \x01(\r\x12\x1c\n\x14\x61\x63\x63umulated_activity\x18\x0c \x01(\x02\x12%\n\x1dnumber_of_exercise_half_hours\x18\r \x01(\r')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBRECOVERYTIMES = _descriptor.Descriptor(
name='PbRecoveryTimes',
full_name='data.PbRecoveryTimes',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_of_times', full_name='data.PbRecoveryTimes.start_of_times', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recovery_times', full_name='data.PbRecoveryTimes.recovery_times', index=1,
number=2, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_glycogen_left_percent', full_name='data.PbRecoveryTimes.end_glycogen_left_percent', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_carbo_consumption', full_name='data.PbRecoveryTimes.end_carbo_consumption', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_protein_consumption', full_name='data.PbRecoveryTimes.end_protein_consumption', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_cumulative_mechanical_stimulus', full_name='data.PbRecoveryTimes.end_cumulative_mechanical_stimulus', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_half_hour_avg_met', full_name='data.PbRecoveryTimes.last_half_hour_avg_met', index=6,
number=7, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exercise_calories', full_name='data.PbRecoveryTimes.exercise_calories', index=7,
number=8, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_calories', full_name='data.PbRecoveryTimes.activity_calories', index=8,
number=9, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='bmr_calories', full_name='data.PbRecoveryTimes.bmr_calories', index=9,
number=10, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steps', full_name='data.PbRecoveryTimes.steps', index=10,
number=11, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='accumulated_activity', full_name='data.PbRecoveryTimes.accumulated_activity', index=11,
number=12, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='number_of_exercise_half_hours', full_name='data.PbRecoveryTimes.number_of_exercise_half_hours', index=12,
number=13, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=44,
serialized_end=462,
)
_PBRECOVERYTIMES.fields_by_name['start_of_times'].message_type = types__pb2._PBLOCALDATETIME
DESCRIPTOR.message_types_by_name['PbRecoveryTimes'] = _PBRECOVERYTIMES
PbRecoveryTimes = _reflection.GeneratedProtocolMessageType('PbRecoveryTimes', (_message.Message,), dict(
DESCRIPTOR = _PBRECOVERYTIMES,
__module__ = 'recovery_times_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecoveryTimes)
))
_sym_db.RegisterMessage(PbRecoveryTimes)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_route2_pb2.py | loophole/polar/pb/exercise_route2_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: data/exercise_route2.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='data/exercise_route2.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x1a\x64\x61ta/exercise_route2.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\":\n\x13PbLocationSyncPoint\x12\x10\n\x08latitude\x18\x01 \x02(\x01\x12\x11\n\tlongitude\x18\x02 \x02(\x01\"\x83\x02\n\x18PbExerciseRouteSyncPoint\x12\r\n\x05index\x18\x01 \x02(\r\x12+\n\x08location\x18\x02 \x01(\x0b\x32\x19.data.PbLocationSyncPoint\x12(\n\rgps_date_time\x18\x03 \x01(\x0b\x32\x11.PbSystemDateTime\x12\x13\n\x08\x61ltitude\x18\x04 \x01(\x11:\x01\x30\x12#\n\x16\x63oordinate_granularity\x18\x05 \x01(\r:\x03\x31\x30\x30\x12#\n\x15timestamp_granularity\x18\x06 \x01(\r:\x04\x31\x30\x30\x30\x12\"\n\x14\x61ltitude_granularity\x18\x07 \x01(\r:\x04\x31\x30\x30\x30\"\xb1\x01\n\x17PbExerciseRouteSamples2\x12\x32\n\nsync_point\x18\x01 \x03(\x0b\x32\x1e.data.PbExerciseRouteSyncPoint\x12\x18\n\x10satellite_amount\x18\x02 \x03(\r\x12\x10\n\x08latitude\x18\x03 \x03(\x12\x12\x11\n\tlongitude\x18\x04 \x03(\x12\x12\x11\n\ttimestamp\x18\x05 \x03(\x11\x12\x10\n\x08\x61ltitude\x18\x06 \x03(\x12')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBLOCATIONSYNCPOINT = _descriptor.Descriptor(
name='PbLocationSyncPoint',
full_name='data.PbLocationSyncPoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbLocationSyncPoint.latitude', index=0,
number=1, type=1, cpp_type=5, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbLocationSyncPoint.longitude', index=1,
number=2, type=1, cpp_type=5, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=49,
serialized_end=107,
)
_PBEXERCISEROUTESYNCPOINT = _descriptor.Descriptor(
name='PbExerciseRouteSyncPoint',
full_name='data.PbExerciseRouteSyncPoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='index', full_name='data.PbExerciseRouteSyncPoint.index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='location', full_name='data.PbExerciseRouteSyncPoint.location', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='gps_date_time', full_name='data.PbExerciseRouteSyncPoint.gps_date_time', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude', full_name='data.PbExerciseRouteSyncPoint.altitude', index=3,
number=4, type=17, cpp_type=1, label=1,
has_default_value=True, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='coordinate_granularity', full_name='data.PbExerciseRouteSyncPoint.coordinate_granularity', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=100,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='timestamp_granularity', full_name='data.PbExerciseRouteSyncPoint.timestamp_granularity', index=5,
number=6, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=1000,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude_granularity', full_name='data.PbExerciseRouteSyncPoint.altitude_granularity', index=6,
number=7, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=1000,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=110,
serialized_end=369,
)
_PBEXERCISEROUTESAMPLES2 = _descriptor.Descriptor(
name='PbExerciseRouteSamples2',
full_name='data.PbExerciseRouteSamples2',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sync_point', full_name='data.PbExerciseRouteSamples2.sync_point', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='satellite_amount', full_name='data.PbExerciseRouteSamples2.satellite_amount', index=1,
number=2, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbExerciseRouteSamples2.latitude', index=2,
number=3, type=18, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbExerciseRouteSamples2.longitude', index=3,
number=4, type=18, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='timestamp', full_name='data.PbExerciseRouteSamples2.timestamp', index=4,
number=5, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='altitude', full_name='data.PbExerciseRouteSamples2.altitude', index=5,
number=6, type=18, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=372,
serialized_end=549,
)
_PBEXERCISEROUTESYNCPOINT.fields_by_name['location'].message_type = _PBLOCATIONSYNCPOINT
_PBEXERCISEROUTESYNCPOINT.fields_by_name['gps_date_time'].message_type = types__pb2._PBSYSTEMDATETIME
_PBEXERCISEROUTESAMPLES2.fields_by_name['sync_point'].message_type = _PBEXERCISEROUTESYNCPOINT
DESCRIPTOR.message_types_by_name['PbLocationSyncPoint'] = _PBLOCATIONSYNCPOINT
DESCRIPTOR.message_types_by_name['PbExerciseRouteSyncPoint'] = _PBEXERCISEROUTESYNCPOINT
DESCRIPTOR.message_types_by_name['PbExerciseRouteSamples2'] = _PBEXERCISEROUTESAMPLES2
PbLocationSyncPoint = _reflection.GeneratedProtocolMessageType('PbLocationSyncPoint', (_message.Message,), dict(
DESCRIPTOR = _PBLOCATIONSYNCPOINT,
__module__ = 'data.exercise_route2_pb2'
# @@protoc_insertion_point(class_scope:data.PbLocationSyncPoint)
))
_sym_db.RegisterMessage(PbLocationSyncPoint)
PbExerciseRouteSyncPoint = _reflection.GeneratedProtocolMessageType('PbExerciseRouteSyncPoint', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISEROUTESYNCPOINT,
__module__ = 'data.exercise_route2_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseRouteSyncPoint)
))
_sym_db.RegisterMessage(PbExerciseRouteSyncPoint)
PbExerciseRouteSamples2 = _reflection.GeneratedProtocolMessageType('PbExerciseRouteSamples2', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISEROUTESAMPLES2,
__module__ = 'data.exercise_route2_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseRouteSamples2)
))
_sym_db.RegisterMessage(PbExerciseRouteSamples2)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sport_pb2.py | loophole/polar/pb/sport_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sport.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='sport.proto',
package='data',
serialized_pb=_b('\n\x0bsport.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"M\n\x12PbSportTranslation\x12\x19\n\x02id\x18\x01 \x02(\x0b\x32\r.PbLanguageId\x12\x1c\n\x04text\x18\x02 \x02(\x0b\x32\x0e.PbOneLineText\"\x81\x04\n\x07PbSport\x12&\n\nidentifier\x18\x01 \x02(\x0b\x32\x12.PbSportIdentifier\x12-\n\x11parent_identifier\x18\x02 \x02(\x0b\x32\x12.PbSportIdentifier\x12-\n\x0btranslation\x18\x03 \x03(\x0b\x32\x18.data.PbSportTranslation\x12\x0e\n\x06\x66\x61\x63tor\x18\x04 \x01(\x02\x12\"\n\x06stages\x18\x05 \x03(\x0b\x32\x12.PbSportIdentifier\x12\x46\n\nsport_type\x18\x06 \x01(\x0e\x32\x19.data.PbSport.PbSportType:\x17SPORT_TYPE_SINGLE_SPORT\x12\"\n\x13speed_zones_enabled\x18\x07 \x01(\x08:\x05\x66\x61lse\x12\"\n\x07\x63reated\x18\x64 \x01(\x0b\x32\x11.PbSystemDateTime\x12(\n\rlast_modified\x18\x65 \x01(\x0b\x32\x11.PbSystemDateTime\"\x81\x01\n\x0bPbSportType\x12\x1b\n\x17SPORT_TYPE_SINGLE_SPORT\x10\x01\x12\x1a\n\x16SPORT_TYPE_MULTI_SPORT\x10\x02\x12\x18\n\x14SPORT_TYPE_SUB_SPORT\x10\x03\x12\x1f\n\x1bSPORT_TYPE_FREE_MULTI_SPORT\x10\x04')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSPORT_PBSPORTTYPE = _descriptor.EnumDescriptor(
name='PbSportType',
full_name='data.PbSport.PbSportType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SPORT_TYPE_SINGLE_SPORT', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TYPE_MULTI_SPORT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TYPE_SUB_SPORT', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPORT_TYPE_FREE_MULTI_SPORT', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=516,
serialized_end=645,
)
_sym_db.RegisterEnumDescriptor(_PBSPORT_PBSPORTTYPE)
_PBSPORTTRANSLATION = _descriptor.Descriptor(
name='PbSportTranslation',
full_name='data.PbSportTranslation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='id', full_name='data.PbSportTranslation.id', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='text', full_name='data.PbSportTranslation.text', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=52,
serialized_end=129,
)
_PBSPORT = _descriptor.Descriptor(
name='PbSport',
full_name='data.PbSport',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='identifier', full_name='data.PbSport.identifier', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='parent_identifier', full_name='data.PbSport.parent_identifier', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='translation', full_name='data.PbSport.translation', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='factor', full_name='data.PbSport.factor', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stages', full_name='data.PbSport.stages', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_type', full_name='data.PbSport.sport_type', index=5,
number=6, type=14, cpp_type=8, label=1,
has_default_value=True, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_zones_enabled', full_name='data.PbSport.speed_zones_enabled', index=6,
number=7, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='created', full_name='data.PbSport.created', index=7,
number=100, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbSport.last_modified', index=8,
number=101, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBSPORT_PBSPORTTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=132,
serialized_end=645,
)
_PBSPORTTRANSLATION.fields_by_name['id'].message_type = structures_pb2._PBLANGUAGEID
_PBSPORTTRANSLATION.fields_by_name['text'].message_type = structures_pb2._PBONELINETEXT
_PBSPORT.fields_by_name['identifier'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBSPORT.fields_by_name['parent_identifier'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBSPORT.fields_by_name['translation'].message_type = _PBSPORTTRANSLATION
_PBSPORT.fields_by_name['stages'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBSPORT.fields_by_name['sport_type'].enum_type = _PBSPORT_PBSPORTTYPE
_PBSPORT.fields_by_name['created'].message_type = types_pb2._PBSYSTEMDATETIME
_PBSPORT.fields_by_name['last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
_PBSPORT_PBSPORTTYPE.containing_type = _PBSPORT
DESCRIPTOR.message_types_by_name['PbSportTranslation'] = _PBSPORTTRANSLATION
DESCRIPTOR.message_types_by_name['PbSport'] = _PBSPORT
PbSportTranslation = _reflection.GeneratedProtocolMessageType('PbSportTranslation', (_message.Message,), dict(
DESCRIPTOR = _PBSPORTTRANSLATION,
__module__ = 'sport_pb2'
# @@protoc_insertion_point(class_scope:data.PbSportTranslation)
))
_sym_db.RegisterMessage(PbSportTranslation)
PbSport = _reflection.GeneratedProtocolMessageType('PbSport', (_message.Message,), dict(
DESCRIPTOR = _PBSPORT,
__module__ = 'sport_pb2'
# @@protoc_insertion_point(class_scope:data.PbSport)
))
_sym_db.RegisterMessage(PbSport)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_route_pb2.py | loophole/polar/pb/exercise_route_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: data/exercise_route.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='data/exercise_route.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x19\x64\x61ta/exercise_route.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xa8\x02\n\x16PbExerciseRouteSamples\x12\x10\n\x08\x64uration\x18\x01 \x03(\r\x12\x10\n\x08latitude\x18\x02 \x03(\x01\x12\x11\n\tlongitude\x18\x03 \x03(\x01\x12\x14\n\x0cgps_altitude\x18\x04 \x03(\x11\x12\x18\n\x10satellite_amount\x18\x05 \x03(\r\x12\x14\n\x0cOBSOLETE_fix\x18\x06 \x03(\x08\x12.\n\x14OBSOLETE_gps_offline\x18\x07 \x03(\x0b\x32\x10.PbSensorOffline\x12\x31\n\x16OBSOLETE_gps_date_time\x18\x08 \x03(\x0b\x32\x11.PbSystemDateTime\x12.\n\x13\x66irst_location_time\x18\t \x01(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBEXERCISEROUTESAMPLES = _descriptor.Descriptor(
name='PbExerciseRouteSamples',
full_name='data.PbExerciseRouteSamples',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbExerciseRouteSamples.duration', index=0,
number=1, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbExerciseRouteSamples.latitude', index=1,
number=2, type=1, cpp_type=5, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbExerciseRouteSamples.longitude', index=2,
number=3, type=1, cpp_type=5, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='gps_altitude', full_name='data.PbExerciseRouteSamples.gps_altitude', index=3,
number=4, type=17, cpp_type=1, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='satellite_amount', full_name='data.PbExerciseRouteSamples.satellite_amount', index=4,
number=5, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_fix', full_name='data.PbExerciseRouteSamples.OBSOLETE_fix', index=5,
number=6, type=8, cpp_type=7, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_gps_offline', full_name='data.PbExerciseRouteSamples.OBSOLETE_gps_offline', index=6,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_gps_date_time', full_name='data.PbExerciseRouteSamples.OBSOLETE_gps_date_time', index=7,
number=8, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='first_location_time', full_name='data.PbExerciseRouteSamples.first_location_time', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=49,
serialized_end=345,
)
_PBEXERCISEROUTESAMPLES.fields_by_name['OBSOLETE_gps_offline'].message_type = types__pb2._PBSENSOROFFLINE
_PBEXERCISEROUTESAMPLES.fields_by_name['OBSOLETE_gps_date_time'].message_type = types__pb2._PBSYSTEMDATETIME
_PBEXERCISEROUTESAMPLES.fields_by_name['first_location_time'].message_type = types__pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbExerciseRouteSamples'] = _PBEXERCISEROUTESAMPLES
PbExerciseRouteSamples = _reflection.GeneratedProtocolMessageType('PbExerciseRouteSamples', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISEROUTESAMPLES,
__module__ = 'data.exercise_route_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseRouteSamples)
))
_sym_db.RegisterMessage(PbExerciseRouteSamples)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_astra_settings_pb2.py | loophole/polar/pb/sportprofile_astra_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_astra_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_astra_settings.proto',
package='data',
serialized_pb=_b('\n!sportprofile_astra_settings.proto\x12\x04\x64\x61ta\"0\n\x1bPbAstraSportProfileSettings\x12\x11\n\tvibration\x18\x03 \x01(\x08')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBASTRASPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbAstraSportProfileSettings',
full_name='data.PbAstraSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='vibration', full_name='data.PbAstraSportProfileSettings.vibration', index=0,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=43,
serialized_end=91,
)
DESCRIPTOR.message_types_by_name['PbAstraSportProfileSettings'] = _PBASTRASPORTPROFILESETTINGS
PbAstraSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbAstraSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBASTRASPORTPROFILESETTINGS,
__module__ = 'sportprofile_astra_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbAstraSportProfileSettings)
))
_sym_db.RegisterMessage(PbAstraSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_prefs_pb2.py | loophole/polar/pb/user_prefs_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_prefs.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2 as structures__pb2
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_prefs.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x10user_prefs.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"\xc3\x02\n\x19PbLocalizationPreferences\x12\x1f\n\x08language\x18\x01 \x01(\x0b\x32\r.PbLanguageId\x12\"\n\x0bunit_system\x18\x02 \x01(\x0e\x32\r.PbUnitSystem\x12\"\n\x0btime_format\x18\x03 \x01(\x0e\x32\r.PbTimeFormat\x12\x35\n\x15time_format_separator\x18\x04 \x01(\x0e\x32\x16.PbTimeFormatSeparator\x12\"\n\x0b\x64\x61te_format\x18\x05 \x01(\x0e\x32\r.PbDateFormat\x12\x35\n\x15\x64\x61te_format_separator\x18\x06 \x01(\x0e\x32\x16.PbDateFormatSeparator\x12+\n\x10\x66irstday_of_week\x18\x07 \x01(\x0e\x32\x11.PbStartDayOfWeek\"r\n\x15PbTrainingPreferences\x12%\n\x1dOBSOLETE_heart_rate_zone_lock\x18\x01 \x01(\r\x12\x32\n\x18OBSOLETE_heart_rate_view\x18\x02 \x01(\x0e\x32\x10.PbHeartRateView\",\n\x19PbActivityGoalPreferences\x12\x0f\n\x07visible\x18\x01 \x02(\x08\"\x82\x02\n\x14PbGeneralPreferences\x12\x41\n\x18localization_preferences\x18\x01 \x01(\x0b\x32\x1f.data.PbLocalizationPreferences\x12\x39\n\x14training_preferences\x18\x02 \x01(\x0b\x32\x1b.data.PbTrainingPreferences\x12\x42\n\x19\x61\x63tivity_goal_preferences\x18\x03 \x01(\x0b\x32\x1f.data.PbActivityGoalPreferences\x12(\n\rlast_modified\x18\x65 \x02(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[structures__pb2.DESCRIPTOR,types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBLOCALIZATIONPREFERENCES = _descriptor.Descriptor(
name='PbLocalizationPreferences',
full_name='data.PbLocalizationPreferences',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='language', full_name='data.PbLocalizationPreferences.language', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='unit_system', full_name='data.PbLocalizationPreferences.unit_system', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_format', full_name='data.PbLocalizationPreferences.time_format', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_format_separator', full_name='data.PbLocalizationPreferences.time_format_separator', index=3,
number=4, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='date_format', full_name='data.PbLocalizationPreferences.date_format', index=4,
number=5, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='date_format_separator', full_name='data.PbLocalizationPreferences.date_format_separator', index=5,
number=6, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='firstday_of_week', full_name='data.PbLocalizationPreferences.firstday_of_week', index=6,
number=7, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=58,
serialized_end=381,
)
_PBTRAININGPREFERENCES = _descriptor.Descriptor(
name='PbTrainingPreferences',
full_name='data.PbTrainingPreferences',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='OBSOLETE_heart_rate_zone_lock', full_name='data.PbTrainingPreferences.OBSOLETE_heart_rate_zone_lock', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_heart_rate_view', full_name='data.PbTrainingPreferences.OBSOLETE_heart_rate_view', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=383,
serialized_end=497,
)
_PBACTIVITYGOALPREFERENCES = _descriptor.Descriptor(
name='PbActivityGoalPreferences',
full_name='data.PbActivityGoalPreferences',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='visible', full_name='data.PbActivityGoalPreferences.visible', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=499,
serialized_end=543,
)
_PBGENERALPREFERENCES = _descriptor.Descriptor(
name='PbGeneralPreferences',
full_name='data.PbGeneralPreferences',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='localization_preferences', full_name='data.PbGeneralPreferences.localization_preferences', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_preferences', full_name='data.PbGeneralPreferences.training_preferences', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_goal_preferences', full_name='data.PbGeneralPreferences.activity_goal_preferences', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbGeneralPreferences.last_modified', index=3,
number=101, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=546,
serialized_end=804,
)
_PBLOCALIZATIONPREFERENCES.fields_by_name['language'].message_type = structures__pb2._PBLANGUAGEID
_PBLOCALIZATIONPREFERENCES.fields_by_name['unit_system'].enum_type = types__pb2._PBUNITSYSTEM
_PBLOCALIZATIONPREFERENCES.fields_by_name['time_format'].enum_type = types__pb2._PBTIMEFORMAT
_PBLOCALIZATIONPREFERENCES.fields_by_name['time_format_separator'].enum_type = types__pb2._PBTIMEFORMATSEPARATOR
_PBLOCALIZATIONPREFERENCES.fields_by_name['date_format'].enum_type = types__pb2._PBDATEFORMAT
_PBLOCALIZATIONPREFERENCES.fields_by_name['date_format_separator'].enum_type = types__pb2._PBDATEFORMATSEPARATOR
_PBLOCALIZATIONPREFERENCES.fields_by_name['firstday_of_week'].enum_type = types__pb2._PBSTARTDAYOFWEEK
_PBTRAININGPREFERENCES.fields_by_name['OBSOLETE_heart_rate_view'].enum_type = types__pb2._PBHEARTRATEVIEW
_PBGENERALPREFERENCES.fields_by_name['localization_preferences'].message_type = _PBLOCALIZATIONPREFERENCES
_PBGENERALPREFERENCES.fields_by_name['training_preferences'].message_type = _PBTRAININGPREFERENCES
_PBGENERALPREFERENCES.fields_by_name['activity_goal_preferences'].message_type = _PBACTIVITYGOALPREFERENCES
_PBGENERALPREFERENCES.fields_by_name['last_modified'].message_type = types__pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbLocalizationPreferences'] = _PBLOCALIZATIONPREFERENCES
DESCRIPTOR.message_types_by_name['PbTrainingPreferences'] = _PBTRAININGPREFERENCES
DESCRIPTOR.message_types_by_name['PbActivityGoalPreferences'] = _PBACTIVITYGOALPREFERENCES
DESCRIPTOR.message_types_by_name['PbGeneralPreferences'] = _PBGENERALPREFERENCES
PbLocalizationPreferences = _reflection.GeneratedProtocolMessageType('PbLocalizationPreferences', (_message.Message,), dict(
DESCRIPTOR = _PBLOCALIZATIONPREFERENCES,
__module__ = 'user_prefs_pb2'
# @@protoc_insertion_point(class_scope:data.PbLocalizationPreferences)
))
_sym_db.RegisterMessage(PbLocalizationPreferences)
PbTrainingPreferences = _reflection.GeneratedProtocolMessageType('PbTrainingPreferences', (_message.Message,), dict(
DESCRIPTOR = _PBTRAININGPREFERENCES,
__module__ = 'user_prefs_pb2'
# @@protoc_insertion_point(class_scope:data.PbTrainingPreferences)
))
_sym_db.RegisterMessage(PbTrainingPreferences)
PbActivityGoalPreferences = _reflection.GeneratedProtocolMessageType('PbActivityGoalPreferences', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYGOALPREFERENCES,
__module__ = 'user_prefs_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivityGoalPreferences)
))
_sym_db.RegisterMessage(PbActivityGoalPreferences)
PbGeneralPreferences = _reflection.GeneratedProtocolMessageType('PbGeneralPreferences', (_message.Message,), dict(
DESCRIPTOR = _PBGENERALPREFERENCES,
__module__ = 'user_prefs_pb2'
# @@protoc_insertion_point(class_scope:data.PbGeneralPreferences)
))
_sym_db.RegisterMessage(PbGeneralPreferences)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_archer_settings_pb2.py | loophole/polar/pb/sportprofile_archer_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_archer_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_archer_settings.proto',
package='data',
serialized_pb=_b('\n\"sportprofile_archer_settings.proto\x12\x04\x64\x61ta\"\x87\x02\n\x1cPbArcherSportProfileSettings\x12\x44\n\x0bheart_touch\x18\x01 \x01(\x0e\x32/.data.PbArcherSportProfileSettings.PbHeartTouch\x12\x12\n\nauto_start\x18\x04 \x01(\x08\"\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBARCHERSPORTPROFILESETTINGS_PBHEARTTOUCH = _descriptor.EnumDescriptor(
name='PbHeartTouch',
full_name='data.PbArcherSportProfileSettings.PbHeartTouch',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_PREVIOUS_LAP', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_TIME_OF_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=168,
serialized_end=308,
)
_sym_db.RegisterEnumDescriptor(_PBARCHERSPORTPROFILESETTINGS_PBHEARTTOUCH)
_PBARCHERSPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbArcherSportProfileSettings',
full_name='data.PbArcherSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_touch', full_name='data.PbArcherSportProfileSettings.heart_touch', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbArcherSportProfileSettings.auto_start', index=1,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBARCHERSPORTPROFILESETTINGS_PBHEARTTOUCH,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=45,
serialized_end=308,
)
_PBARCHERSPORTPROFILESETTINGS.fields_by_name['heart_touch'].enum_type = _PBARCHERSPORTPROFILESETTINGS_PBHEARTTOUCH
_PBARCHERSPORTPROFILESETTINGS_PBHEARTTOUCH.containing_type = _PBARCHERSPORTPROFILESETTINGS
DESCRIPTOR.message_types_by_name['PbArcherSportProfileSettings'] = _PBARCHERSPORTPROFILESETTINGS
PbArcherSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbArcherSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBARCHERSPORTPROFILESETTINGS,
__module__ = 'sportprofile_archer_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbArcherSportProfileSettings)
))
_sym_db.RegisterMessage(PbArcherSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_targetinfo_pb2.py | loophole/polar/pb/exercise_targetinfo_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_targetinfo.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import exercise_phases_pb2
import training_session_target_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_targetinfo.proto',
package='data',
serialized_pb=_b('\n\x19\x65xercise_targetinfo.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x15\x65xercise_phases.proto\x1a\x1dtraining_session_target.proto\x1a\x0btypes.proto\"o\n\x16PbSteadyRacePaceResult\x12#\n\x0e\x63ompleted_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x19\n\x11\x61verage_heartrate\x18\x02 \x01(\r\x12\x15\n\raverage_speed\x18\x03 \x01(\x02\"\xa0\x03\n\x14PbExerciseTargetInfo\x12*\n\x0btarget_type\x18\x01 \x02(\x0e\x32\x15.PbExerciseTargetType\x12\r\n\x05index\x18\x02 \x02(\r\x12\x1c\n\x04name\x18\x03 \x01(\x0b\x32\x0e.PbOneLineText\x12\x16\n\x0etarget_reached\x18\x04 \x01(\x08\x12\x1d\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x0b.PbDuration\x12$\n\x08sport_id\x18\x06 \x01(\x0b\x32\x12.PbSportIdentifier\x12&\n\rvolume_target\x18\x07 \x01(\x0b\x32\x0f.PbVolumeTarget\x12\x1e\n\x06phases\x18\x08 \x01(\x0b\x32\x0e.data.PbPhases\x12\x19\n\x05route\x18\t \x01(\x0b\x32\n.PbRouteId\x12\x30\n\x10steady_race_pace\x18\n \x01(\x0b\x32\x16.data.PbSteadyRacePace\x12=\n\x17steady_race_pace_result\x18\x0b \x01(\x0b\x32\x1c.data.PbSteadyRacePaceResult')
,
dependencies=[structures_pb2.DESCRIPTOR,exercise_phases_pb2.DESCRIPTOR,training_session_target_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSTEADYRACEPACERESULT = _descriptor.Descriptor(
name='PbSteadyRacePaceResult',
full_name='data.PbSteadyRacePaceResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='completed_time', full_name='data.PbSteadyRacePaceResult.completed_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_heartrate', full_name='data.PbSteadyRacePaceResult.average_heartrate', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_speed', full_name='data.PbSteadyRacePaceResult.average_speed', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=120,
serialized_end=231,
)
_PBEXERCISETARGETINFO = _descriptor.Descriptor(
name='PbExerciseTargetInfo',
full_name='data.PbExerciseTargetInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='target_type', full_name='data.PbExerciseTargetInfo.target_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='index', full_name='data.PbExerciseTargetInfo.index', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='data.PbExerciseTargetInfo.name', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_reached', full_name='data.PbExerciseTargetInfo.target_reached', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_time', full_name='data.PbExerciseTargetInfo.end_time', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_id', full_name='data.PbExerciseTargetInfo.sport_id', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='volume_target', full_name='data.PbExerciseTargetInfo.volume_target', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='phases', full_name='data.PbExerciseTargetInfo.phases', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='route', full_name='data.PbExerciseTargetInfo.route', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steady_race_pace', full_name='data.PbExerciseTargetInfo.steady_race_pace', index=9,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steady_race_pace_result', full_name='data.PbExerciseTargetInfo.steady_race_pace_result', index=10,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=234,
serialized_end=650,
)
_PBSTEADYRACEPACERESULT.fields_by_name['completed_time'].message_type = types_pb2._PBDURATION
_PBEXERCISETARGETINFO.fields_by_name['target_type'].enum_type = types_pb2._PBEXERCISETARGETTYPE
_PBEXERCISETARGETINFO.fields_by_name['name'].message_type = structures_pb2._PBONELINETEXT
_PBEXERCISETARGETINFO.fields_by_name['end_time'].message_type = types_pb2._PBDURATION
_PBEXERCISETARGETINFO.fields_by_name['sport_id'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBEXERCISETARGETINFO.fields_by_name['volume_target'].message_type = structures_pb2._PBVOLUMETARGET
_PBEXERCISETARGETINFO.fields_by_name['phases'].message_type = exercise_phases_pb2._PBPHASES
_PBEXERCISETARGETINFO.fields_by_name['route'].message_type = structures_pb2._PBROUTEID
_PBEXERCISETARGETINFO.fields_by_name['steady_race_pace'].message_type = training_session_target_pb2._PBSTEADYRACEPACE
_PBEXERCISETARGETINFO.fields_by_name['steady_race_pace_result'].message_type = _PBSTEADYRACEPACERESULT
DESCRIPTOR.message_types_by_name['PbSteadyRacePaceResult'] = _PBSTEADYRACEPACERESULT
DESCRIPTOR.message_types_by_name['PbExerciseTargetInfo'] = _PBEXERCISETARGETINFO
PbSteadyRacePaceResult = _reflection.GeneratedProtocolMessageType('PbSteadyRacePaceResult', (_message.Message,), dict(
DESCRIPTOR = _PBSTEADYRACEPACERESULT,
__module__ = 'exercise_targetinfo_pb2'
# @@protoc_insertion_point(class_scope:data.PbSteadyRacePaceResult)
))
_sym_db.RegisterMessage(PbSteadyRacePaceResult)
PbExerciseTargetInfo = _reflection.GeneratedProtocolMessageType('PbExerciseTargetInfo', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISETARGETINFO,
__module__ = 'exercise_targetinfo_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseTargetInfo)
))
_sym_db.RegisterMessage(PbExerciseTargetInfo)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/training_session_pb2.py | loophole/polar/pb/training_session_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: training_session.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='training_session.proto',
package='data',
serialized_pb=_b('\n\x16training_session.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"@\n\x1cPbSessionHeartRateStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\"\xcc\x05\n\x11PbTrainingSession\x12\x1f\n\x05start\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x1d\n\x03\x65nd\x18\x14 \x01(\x0b\x32\x10.PbLocalDateTime\x12\x16\n\x0e\x65xercise_count\x18\x02 \x02(\r\x12\x11\n\tdevice_id\x18\x03 \x01(\t\x12\x12\n\nmodel_name\x18\x04 \x01(\t\x12\x1d\n\x08\x64uration\x18\x05 \x01(\x0b\x32\x0b.PbDuration\x12\x10\n\x08\x64istance\x18\x06 \x01(\x02\x12\x10\n\x08\x63\x61lories\x18\x07 \x01(\r\x12\x36\n\nheart_rate\x18\x08 \x01(\x0b\x32\".data.PbSessionHeartRateStatistics\x12-\n\x18heart_rate_zone_duration\x18\t \x03(\x0b\x32\x0b.PbDuration\x12&\n\rtraining_load\x18\n \x01(\x0b\x32\x0f.PbTrainingLoad\x12$\n\x0csession_name\x18\x0b \x01(\x0b\x32\x0e.PbOneLineText\x12\x0f\n\x07\x66\x65\x65ling\x18\x0c \x01(\x02\x12\x1e\n\x04note\x18\r \x01(\x0b\x32\x10.PbMultiLineText\x12\x1d\n\x05place\x18\x0e \x01(\x0b\x32\x0e.PbOneLineText\x12\x10\n\x08latitude\x18\x0f \x01(\x01\x12\x11\n\tlongitude\x18\x10 \x01(\x01\x12$\n\x07\x62\x65nefit\x18\x11 \x01(\x0e\x32\x13.PbExerciseFeedback\x12!\n\x05sport\x18\x12 \x01(\x0b\x32\x12.PbSportIdentifier\x12>\n\x1atraining_session_target_id\x18\x13 \x01(\x0b\x32\x1a.PbTrainingSessionTargetId\x12\x42\n\x1ctraining_session_favorite_id\x18\x15 \x01(\x0b\x32\x1c.PbTrainingSessionFavoriteId')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSESSIONHEARTRATESTATISTICS = _descriptor.Descriptor(
name='PbSessionHeartRateStatistics',
full_name='data.PbSessionHeartRateStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbSessionHeartRateStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbSessionHeartRateStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=63,
serialized_end=127,
)
_PBTRAININGSESSION = _descriptor.Descriptor(
name='PbTrainingSession',
full_name='data.PbTrainingSession',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start', full_name='data.PbTrainingSession.start', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end', full_name='data.PbTrainingSession.end', index=1,
number=20, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exercise_count', full_name='data.PbTrainingSession.exercise_count', index=2,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_id', full_name='data.PbTrainingSession.device_id', index=3,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='model_name', full_name='data.PbTrainingSession.model_name', index=4,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbTrainingSession.duration', index=5,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbTrainingSession.distance', index=6,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calories', full_name='data.PbTrainingSession.calories', index=7,
number=7, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate', full_name='data.PbTrainingSession.heart_rate', index=8,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_zone_duration', full_name='data.PbTrainingSession.heart_rate_zone_duration', index=9,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_load', full_name='data.PbTrainingSession.training_load', index=10,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='session_name', full_name='data.PbTrainingSession.session_name', index=11,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='feeling', full_name='data.PbTrainingSession.feeling', index=12,
number=12, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='note', full_name='data.PbTrainingSession.note', index=13,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='place', full_name='data.PbTrainingSession.place', index=14,
number=14, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbTrainingSession.latitude', index=15,
number=15, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbTrainingSession.longitude', index=16,
number=16, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='benefit', full_name='data.PbTrainingSession.benefit', index=17,
number=17, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport', full_name='data.PbTrainingSession.sport', index=18,
number=18, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_session_target_id', full_name='data.PbTrainingSession.training_session_target_id', index=19,
number=19, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_session_favorite_id', full_name='data.PbTrainingSession.training_session_favorite_id', index=20,
number=21, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=130,
serialized_end=846,
)
_PBTRAININGSESSION.fields_by_name['start'].message_type = types_pb2._PBLOCALDATETIME
_PBTRAININGSESSION.fields_by_name['end'].message_type = types_pb2._PBLOCALDATETIME
_PBTRAININGSESSION.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBTRAININGSESSION.fields_by_name['heart_rate'].message_type = _PBSESSIONHEARTRATESTATISTICS
_PBTRAININGSESSION.fields_by_name['heart_rate_zone_duration'].message_type = types_pb2._PBDURATION
_PBTRAININGSESSION.fields_by_name['training_load'].message_type = structures_pb2._PBTRAININGLOAD
_PBTRAININGSESSION.fields_by_name['session_name'].message_type = structures_pb2._PBONELINETEXT
_PBTRAININGSESSION.fields_by_name['note'].message_type = structures_pb2._PBMULTILINETEXT
_PBTRAININGSESSION.fields_by_name['place'].message_type = structures_pb2._PBONELINETEXT
_PBTRAININGSESSION.fields_by_name['benefit'].enum_type = types_pb2._PBEXERCISEFEEDBACK
_PBTRAININGSESSION.fields_by_name['sport'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBTRAININGSESSION.fields_by_name['training_session_target_id'].message_type = structures_pb2._PBTRAININGSESSIONTARGETID
_PBTRAININGSESSION.fields_by_name['training_session_favorite_id'].message_type = structures_pb2._PBTRAININGSESSIONFAVORITEID
DESCRIPTOR.message_types_by_name['PbSessionHeartRateStatistics'] = _PBSESSIONHEARTRATESTATISTICS
DESCRIPTOR.message_types_by_name['PbTrainingSession'] = _PBTRAININGSESSION
PbSessionHeartRateStatistics = _reflection.GeneratedProtocolMessageType('PbSessionHeartRateStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBSESSIONHEARTRATESTATISTICS,
__module__ = 'training_session_pb2'
# @@protoc_insertion_point(class_scope:data.PbSessionHeartRateStatistics)
))
_sym_db.RegisterMessage(PbSessionHeartRateStatistics)
PbTrainingSession = _reflection.GeneratedProtocolMessageType('PbTrainingSession', (_message.Message,), dict(
DESCRIPTOR = _PBTRAININGSESSION,
__module__ = 'training_session_pb2'
# @@protoc_insertion_point(class_scope:data.PbTrainingSession)
))
_sym_db.RegisterMessage(PbTrainingSession)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/personalbest_pb2.py | loophole/polar/pb/personalbest_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: personalbest.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='personalbest.proto',
package='data',
serialized_pb=_b('\n\x12personalbest.proto\x12\x04\x64\x61ta\"[\n\x0ePbPersonalBest\x12\x10\n\x08\x64istance\x18\x01 \x01(\x02\x12\x15\n\raverage_speed\x18\x02 \x01(\x02\x12\x10\n\x08\x63\x61lories\x18\x03 \x01(\r\x12\x0e\n\x06\x61scent\x18\x04 \x01(\x02')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPERSONALBEST = _descriptor.Descriptor(
name='PbPersonalBest',
full_name='data.PbPersonalBest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbPersonalBest.distance', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_speed', full_name='data.PbPersonalBest.average_speed', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calories', full_name='data.PbPersonalBest.calories', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ascent', full_name='data.PbPersonalBest.ascent', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=28,
serialized_end=119,
)
DESCRIPTOR.message_types_by_name['PbPersonalBest'] = _PBPERSONALBEST
PbPersonalBest = _reflection.GeneratedProtocolMessageType('PbPersonalBest', (_message.Message,), dict(
DESCRIPTOR = _PBPERSONALBEST,
__module__ = 'personalbest_pb2'
# @@protoc_insertion_point(class_scope:data.PbPersonalBest)
))
_sym_db.RegisterMessage(PbPersonalBest)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/pftp_request_pb2.py | loophole/polar/pb/pftp_request_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pftp/pftp_request.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='pftp/pftp_request.proto',
package='protocol',
syntax='proto2',
serialized_pb=_b('\n\x17pftp/pftp_request.proto\x12\x08protocol\x1a\x0btypes.proto\"\x87\x01\n\x0fPbPFtpOperation\x12\x32\n\x07\x63ommand\x18\x01 \x02(\x0e\x32!.protocol.PbPFtpOperation.Command\x12\x0c\n\x04path\x18\x02 \x02(\t\"2\n\x07\x43ommand\x12\x07\n\x03GET\x10\x00\x12\x07\n\x03PUT\x10\x01\x12\t\n\x05MERGE\x10\x02\x12\n\n\x06REMOVE\x10\x03\"Z\n\x19PbPFtpSetSystemTimeParams\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x0f\n\x07trusted\x18\x03 \x02(\x08\"\x90\x01\n!PbPFtpRequestStartRecordingParams\x12\"\n\x0bsample_type\x18\x01 \x02(\x0e\x32\r.PbSampleType\x12\'\n\x12recording_interval\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12\x1e\n\x16sample_data_identifier\x18\x03 \x01(\t\"[\n\x18PbPFtpSetLocalTimeParams\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x11\n\ttz_offset\x18\x03 \x01(\x05\"D\n\"PbPFtpGenerateChallengeTokenParams\x12\x0f\n\x07user_id\x18\x01 \x02(\r\x12\r\n\x05nonse\x18\x02 \x02(\x0c\"(\n\x16PbPFtpSetAdbModeParams\x12\x0e\n\x06\x65nable\x18\x01 \x02(\x08\"6\n\x1cPbPFtpCleanupDiskSpaceParams\x12\x16\n\x0erequired_bytes\x18\x01 \x02(\x04*\xfd\x03\n\x0bPbPFtpQuery\x12\x13\n\x0fIDENTIFY_DEVICE\x10\x00\x12\x13\n\x0fSET_SYSTEM_TIME\x10\x01\x12\x13\n\x0fGET_SYSTEM_TIME\x10\x02\x12\x12\n\x0eSET_LOCAL_TIME\x10\x03\x12\x12\n\x0eGET_LOCAL_TIME\x10\x04\x12\x12\n\x0eGET_DISK_SPACE\x10\x05\x12\x1c\n\x18GENERATE_CHALLENGE_TOKEN\x10\x06\x12\x15\n\x11SET_INTERNAL_TEST\x10\x07\x12\x16\n\x12GET_BATTERY_STATUS\x10\x08\x12\x10\n\x0cSET_ADB_MODE\x10\t\x12\x16\n\x12\x43LEANUP_DISK_SPACE\x10\n\x12\x1c\n\x18GET_INACTIVITY_PRE_ALERT\x10\x0b\x12\x1b\n\x17PREPARE_FIRMWARE_UPDATE\x10\x0c\x12\x1b\n\x17REQUEST_SYNCHRONIZATION\x10\r\x12\x1b\n\x17REQUEST_START_RECORDING\x10\x0e\x12\x1a\n\x16REQUEST_STOP_RECORDING\x10\x0f\x12\x1c\n\x18REQUEST_RECORDING_STATUS\x10\x10\x12\x1c\n\x18GENERATE_ASYMMETRIC_KEYS\x10\x11\x12\x16\n\x12GET_DISPLAY_STATUS\x10\x12\x12\x17\n\x13GET_VISUAL_ELEMENTS\x10\x13')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPFTPQUERY = _descriptor.EnumDescriptor(
name='PbPFtpQuery',
full_name='protocol.PbPFtpQuery',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='IDENTIFY_DEVICE', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SET_SYSTEM_TIME', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_SYSTEM_TIME', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SET_LOCAL_TIME', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_LOCAL_TIME', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_DISK_SPACE', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GENERATE_CHALLENGE_TOKEN', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SET_INTERNAL_TEST', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_BATTERY_STATUS', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SET_ADB_MODE', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CLEANUP_DISK_SPACE', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_INACTIVITY_PRE_ALERT', index=11, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREPARE_FIRMWARE_UPDATE', index=12, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REQUEST_SYNCHRONIZATION', index=13, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REQUEST_START_RECORDING', index=14, number=14,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REQUEST_STOP_RECORDING', index=15, number=15,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REQUEST_RECORDING_STATUS', index=16, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GENERATE_ASYMMETRIC_KEYS', index=17, number=17,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_DISPLAY_STATUS', index=18, number=18,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GET_VISUAL_ELEMENTS', index=19, number=19,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=689,
serialized_end=1198,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPQUERY)
PbPFtpQuery = enum_type_wrapper.EnumTypeWrapper(_PBPFTPQUERY)
IDENTIFY_DEVICE = 0
SET_SYSTEM_TIME = 1
GET_SYSTEM_TIME = 2
SET_LOCAL_TIME = 3
GET_LOCAL_TIME = 4
GET_DISK_SPACE = 5
GENERATE_CHALLENGE_TOKEN = 6
SET_INTERNAL_TEST = 7
GET_BATTERY_STATUS = 8
SET_ADB_MODE = 9
CLEANUP_DISK_SPACE = 10
GET_INACTIVITY_PRE_ALERT = 11
PREPARE_FIRMWARE_UPDATE = 12
REQUEST_SYNCHRONIZATION = 13
REQUEST_START_RECORDING = 14
REQUEST_STOP_RECORDING = 15
REQUEST_RECORDING_STATUS = 16
GENERATE_ASYMMETRIC_KEYS = 17
GET_DISPLAY_STATUS = 18
GET_VISUAL_ELEMENTS = 19
_PBPFTPOPERATION_COMMAND = _descriptor.EnumDescriptor(
name='Command',
full_name='protocol.PbPFtpOperation.Command',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='GET', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PUT', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MERGE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOVE', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=136,
serialized_end=186,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPOPERATION_COMMAND)
_PBPFTPOPERATION = _descriptor.Descriptor(
name='PbPFtpOperation',
full_name='protocol.PbPFtpOperation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='command', full_name='protocol.PbPFtpOperation.command', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='path', full_name='protocol.PbPFtpOperation.path', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBPFTPOPERATION_COMMAND,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=51,
serialized_end=186,
)
_PBPFTPSETSYSTEMTIMEPARAMS = _descriptor.Descriptor(
name='PbPFtpSetSystemTimeParams',
full_name='protocol.PbPFtpSetSystemTimeParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='date', full_name='protocol.PbPFtpSetSystemTimeParams.date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time', full_name='protocol.PbPFtpSetSystemTimeParams.time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='trusted', full_name='protocol.PbPFtpSetSystemTimeParams.trusted', index=2,
number=3, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=188,
serialized_end=278,
)
_PBPFTPREQUESTSTARTRECORDINGPARAMS = _descriptor.Descriptor(
name='PbPFtpRequestStartRecordingParams',
full_name='protocol.PbPFtpRequestStartRecordingParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sample_type', full_name='protocol.PbPFtpRequestStartRecordingParams.sample_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='recording_interval', full_name='protocol.PbPFtpRequestStartRecordingParams.recording_interval', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sample_data_identifier', full_name='protocol.PbPFtpRequestStartRecordingParams.sample_data_identifier', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=281,
serialized_end=425,
)
_PBPFTPSETLOCALTIMEPARAMS = _descriptor.Descriptor(
name='PbPFtpSetLocalTimeParams',
full_name='protocol.PbPFtpSetLocalTimeParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='date', full_name='protocol.PbPFtpSetLocalTimeParams.date', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time', full_name='protocol.PbPFtpSetLocalTimeParams.time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tz_offset', full_name='protocol.PbPFtpSetLocalTimeParams.tz_offset', index=2,
number=3, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=427,
serialized_end=518,
)
_PBPFTPGENERATECHALLENGETOKENPARAMS = _descriptor.Descriptor(
name='PbPFtpGenerateChallengeTokenParams',
full_name='protocol.PbPFtpGenerateChallengeTokenParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_id', full_name='protocol.PbPFtpGenerateChallengeTokenParams.user_id', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='nonse', full_name='protocol.PbPFtpGenerateChallengeTokenParams.nonse', index=1,
number=2, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=520,
serialized_end=588,
)
_PBPFTPSETADBMODEPARAMS = _descriptor.Descriptor(
name='PbPFtpSetAdbModeParams',
full_name='protocol.PbPFtpSetAdbModeParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='enable', full_name='protocol.PbPFtpSetAdbModeParams.enable', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=590,
serialized_end=630,
)
_PBPFTPCLEANUPDISKSPACEPARAMS = _descriptor.Descriptor(
name='PbPFtpCleanupDiskSpaceParams',
full_name='protocol.PbPFtpCleanupDiskSpaceParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='required_bytes', full_name='protocol.PbPFtpCleanupDiskSpaceParams.required_bytes', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=632,
serialized_end=686,
)
_PBPFTPOPERATION.fields_by_name['command'].enum_type = _PBPFTPOPERATION_COMMAND
_PBPFTPOPERATION_COMMAND.containing_type = _PBPFTPOPERATION
_PBPFTPSETSYSTEMTIMEPARAMS.fields_by_name['date'].message_type = types__pb2._PBDATE
_PBPFTPSETSYSTEMTIMEPARAMS.fields_by_name['time'].message_type = types__pb2._PBTIME
_PBPFTPREQUESTSTARTRECORDINGPARAMS.fields_by_name['sample_type'].enum_type = types__pb2._PBSAMPLETYPE
_PBPFTPREQUESTSTARTRECORDINGPARAMS.fields_by_name['recording_interval'].message_type = types__pb2._PBDURATION
_PBPFTPSETLOCALTIMEPARAMS.fields_by_name['date'].message_type = types__pb2._PBDATE
_PBPFTPSETLOCALTIMEPARAMS.fields_by_name['time'].message_type = types__pb2._PBTIME
DESCRIPTOR.message_types_by_name['PbPFtpOperation'] = _PBPFTPOPERATION
DESCRIPTOR.message_types_by_name['PbPFtpSetSystemTimeParams'] = _PBPFTPSETSYSTEMTIMEPARAMS
DESCRIPTOR.message_types_by_name['PbPFtpRequestStartRecordingParams'] = _PBPFTPREQUESTSTARTRECORDINGPARAMS
DESCRIPTOR.message_types_by_name['PbPFtpSetLocalTimeParams'] = _PBPFTPSETLOCALTIMEPARAMS
DESCRIPTOR.message_types_by_name['PbPFtpGenerateChallengeTokenParams'] = _PBPFTPGENERATECHALLENGETOKENPARAMS
DESCRIPTOR.message_types_by_name['PbPFtpSetAdbModeParams'] = _PBPFTPSETADBMODEPARAMS
DESCRIPTOR.message_types_by_name['PbPFtpCleanupDiskSpaceParams'] = _PBPFTPCLEANUPDISKSPACEPARAMS
DESCRIPTOR.enum_types_by_name['PbPFtpQuery'] = _PBPFTPQUERY
PbPFtpOperation = _reflection.GeneratedProtocolMessageType('PbPFtpOperation', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPOPERATION,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpOperation)
))
_sym_db.RegisterMessage(PbPFtpOperation)
PbPFtpSetSystemTimeParams = _reflection.GeneratedProtocolMessageType('PbPFtpSetSystemTimeParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPSETSYSTEMTIMEPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpSetSystemTimeParams)
))
_sym_db.RegisterMessage(PbPFtpSetSystemTimeParams)
PbPFtpRequestStartRecordingParams = _reflection.GeneratedProtocolMessageType('PbPFtpRequestStartRecordingParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPREQUESTSTARTRECORDINGPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpRequestStartRecordingParams)
))
_sym_db.RegisterMessage(PbPFtpRequestStartRecordingParams)
PbPFtpSetLocalTimeParams = _reflection.GeneratedProtocolMessageType('PbPFtpSetLocalTimeParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPSETLOCALTIMEPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpSetLocalTimeParams)
))
_sym_db.RegisterMessage(PbPFtpSetLocalTimeParams)
PbPFtpGenerateChallengeTokenParams = _reflection.GeneratedProtocolMessageType('PbPFtpGenerateChallengeTokenParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPGENERATECHALLENGETOKENPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpGenerateChallengeTokenParams)
))
_sym_db.RegisterMessage(PbPFtpGenerateChallengeTokenParams)
PbPFtpSetAdbModeParams = _reflection.GeneratedProtocolMessageType('PbPFtpSetAdbModeParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPSETADBMODEPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpSetAdbModeParams)
))
_sym_db.RegisterMessage(PbPFtpSetAdbModeParams)
PbPFtpCleanupDiskSpaceParams = _reflection.GeneratedProtocolMessageType('PbPFtpCleanupDiskSpaceParams', (_message.Message,), dict(
DESCRIPTOR = _PBPFTPCLEANUPDISKSPACEPARAMS,
__module__ = 'pftp.pftp_request_pb2'
# @@protoc_insertion_point(class_scope:protocol.PbPFtpCleanupDiskSpaceParams)
))
_sym_db.RegisterMessage(PbPFtpCleanupDiskSpaceParams)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_base_pb2.py | loophole/polar/pb/exercise_base_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_base.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_base.proto',
package='data',
serialized_pb=_b('\n\x13\x65xercise_base.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"*\n\x12PbExerciseCounters\x12\x14\n\x0csprint_count\x18\x01 \x01(\r\"\x8a\x04\n\x0ePbExerciseBase\x12\x1f\n\x05start\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x1d\n\x08\x64uration\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12!\n\x05sport\x18\x03 \x02(\x0b\x32\x12.PbSportIdentifier\x12\x10\n\x08\x64istance\x18\x04 \x01(\x02\x12\x10\n\x08\x63\x61lories\x18\x05 \x01(\r\x12&\n\rtraining_load\x18\x06 \x01(\x0b\x32\x0f.PbTrainingLoad\x12\x31\n\x19\x61vailable_sensor_features\x18\x07 \x03(\x0e\x32\x0e.PbFeatureType\x12&\n\rrunning_index\x18\t \x01(\x0b\x32\x0f.PbRunningIndex\x12\x0e\n\x06\x61scent\x18\n \x01(\x02\x12\x0f\n\x07\x64\x65scent\x18\x0b \x01(\x02\x12\x10\n\x08latitude\x18\x0c \x01(\x01\x12\x11\n\tlongitude\x18\r \x01(\x01\x12\r\n\x05place\x18\x0e \x01(\t\x12\x33\n\x11\x65xercise_counters\x18\x10 \x01(\x0b\x32\x18.data.PbExerciseCounters\x12#\n\x18speed_calibration_offset\x18\x11 \x01(\x02:\x01\x30\x12\x18\n\x10walking_distance\x18\x12 \x01(\x02\x12%\n\x10walking_duration\x18\x13 \x01(\x0b\x32\x0b.PbDuration')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBEXERCISECOUNTERS = _descriptor.Descriptor(
name='PbExerciseCounters',
full_name='data.PbExerciseCounters',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sprint_count', full_name='data.PbExerciseCounters.sprint_count', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=60,
serialized_end=102,
)
_PBEXERCISEBASE = _descriptor.Descriptor(
name='PbExerciseBase',
full_name='data.PbExerciseBase',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start', full_name='data.PbExerciseBase.start', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbExerciseBase.duration', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport', full_name='data.PbExerciseBase.sport', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbExerciseBase.distance', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calories', full_name='data.PbExerciseBase.calories', index=4,
number=5, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='training_load', full_name='data.PbExerciseBase.training_load', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='available_sensor_features', full_name='data.PbExerciseBase.available_sensor_features', index=6,
number=7, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='running_index', full_name='data.PbExerciseBase.running_index', index=7,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ascent', full_name='data.PbExerciseBase.ascent', index=8,
number=10, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='descent', full_name='data.PbExerciseBase.descent', index=9,
number=11, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='latitude', full_name='data.PbExerciseBase.latitude', index=10,
number=12, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='data.PbExerciseBase.longitude', index=11,
number=13, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='place', full_name='data.PbExerciseBase.place', index=12,
number=14, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='exercise_counters', full_name='data.PbExerciseBase.exercise_counters', index=13,
number=16, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_calibration_offset', full_name='data.PbExerciseBase.speed_calibration_offset', index=14,
number=17, type=2, cpp_type=6, label=1,
has_default_value=True, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='walking_distance', full_name='data.PbExerciseBase.walking_distance', index=15,
number=18, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='walking_duration', full_name='data.PbExerciseBase.walking_duration', index=16,
number=19, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=105,
serialized_end=627,
)
_PBEXERCISEBASE.fields_by_name['start'].message_type = types_pb2._PBLOCALDATETIME
_PBEXERCISEBASE.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBEXERCISEBASE.fields_by_name['sport'].message_type = structures_pb2._PBSPORTIDENTIFIER
_PBEXERCISEBASE.fields_by_name['training_load'].message_type = structures_pb2._PBTRAININGLOAD
_PBEXERCISEBASE.fields_by_name['available_sensor_features'].enum_type = types_pb2._PBFEATURETYPE
_PBEXERCISEBASE.fields_by_name['running_index'].message_type = structures_pb2._PBRUNNINGINDEX
_PBEXERCISEBASE.fields_by_name['exercise_counters'].message_type = _PBEXERCISECOUNTERS
_PBEXERCISEBASE.fields_by_name['walking_duration'].message_type = types_pb2._PBDURATION
DESCRIPTOR.message_types_by_name['PbExerciseCounters'] = _PBEXERCISECOUNTERS
DESCRIPTOR.message_types_by_name['PbExerciseBase'] = _PBEXERCISEBASE
PbExerciseCounters = _reflection.GeneratedProtocolMessageType('PbExerciseCounters', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISECOUNTERS,
__module__ = 'exercise_base_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseCounters)
))
_sym_db.RegisterMessage(PbExerciseCounters)
PbExerciseBase = _reflection.GeneratedProtocolMessageType('PbExerciseBase', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISEBASE,
__module__ = 'exercise_base_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseBase)
))
_sym_db.RegisterMessage(PbExerciseBase)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_physdata_pb2.py | loophole/polar/pb/user_physdata_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_physdata.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_physdata.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x13user_physdata.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"R\n\x0ePbUserBirthday\x12\x16\n\x05value\x18\x01 \x02(\x0b\x32\x07.PbDate\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"\x82\x01\n\x0cPbUserGender\x12(\n\x05value\x18\x01 \x02(\x0e\x32\x19.data.PbUserGender.Gender\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"\x1e\n\x06Gender\x12\x08\n\x04MALE\x10\x01\x12\n\n\x06\x46\x45MALE\x10\x02\"\x81\x02\n\x11PbUserHrAttribute\x12\r\n\x05value\x18\x01 \x02(\r\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12?\n\x0esetting_source\x18\x03 \x01(\x0e\x32\'.data.PbUserHrAttribute.HrSettingSource\"r\n\x0fHrSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x14\n\x10SOURCE_AGE_BASED\x10\x01\x12\x0f\n\x0bSOURCE_USER\x10\x02\x12\x13\n\x0fSOURCE_MEASURED\x10\x03\x12\x0f\n\x0bSOURCE_KEEP\x10\x04\"\xd8\x01\n\x0cPbUserWeight\x12\r\n\x05value\x18\x01 \x02(\x02\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12>\n\x0esetting_source\x18\x03 \x01(\x0e\x32&.data.PbUserWeight.WeightSettingSource\"O\n\x13WeightSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x0f\n\x0bSOURCE_USER\x10\x02\x12\x13\n\x0fSOURCE_MEASURED\x10\x03\"G\n\x0cPbUserHeight\x12\r\n\x05value\x18\x01 \x02(\x02\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"\xf0\x01\n\x0cPbUserVo2Max\x12\r\n\x05value\x18\x01 \x02(\r\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12>\n\x0esetting_source\x18\x03 \x01(\x0e\x32&.data.PbUserVo2Max.Vo2MaxSettingSource\"g\n\x13Vo2MaxSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x13\n\x0fSOURCE_ESTIMATE\x10\x01\x12\x0f\n\x0bSOURCE_USER\x10\x02\x12\x16\n\x12SOURCE_FITNESSTEST\x10\x03\"\xe9\x01\n\x18PbUserTrainingBackground\x12@\n\x05value\x18\x01 \x02(\x0e\x32\x31.data.PbUserTrainingBackground.TrainingBackground\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"a\n\x12TrainingBackground\x12\x0e\n\nOCCASIONAL\x10\n\x12\x0b\n\x07REGULAR\x10\x14\x12\x0c\n\x08\x46REQUENT\x10\x1e\x12\t\n\x05HEAVY\x10(\x12\x0c\n\x08SEMI_PRO\x10\x32\x12\x07\n\x03PRO\x10<\"\xb8\x01\n\x10PbUserTypicalDay\x12\x30\n\x05value\x18\x01 \x02(\x0e\x32!.data.PbUserTypicalDay.TypicalDay\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"H\n\nTypicalDay\x12\x12\n\x0eMOSTLY_SITTING\x10\x01\x12\x13\n\x0fMOSTLY_STANDING\x10\x02\x12\x11\n\rMOSTLY_MOVING\x10\x03\"R\n\x17PbWeeklyRecoveryTimeSum\x12\r\n\x05value\x18\x01 \x02(\x02\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"S\n\x18PbSpeedCalibrationOffset\x12\r\n\x05value\x18\x01 \x02(\x02\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\"\xf6\x01\n\x1ePbUserFunctionalThresholdPower\x12\r\n\x05value\x18\x01 \x02(\r\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12M\n\x0esetting_source\x18\x03 \x01(\x0e\x32\x35.data.PbUserFunctionalThresholdPower.FTPSettingSource\"L\n\x10\x46TPSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x13\n\x0fSOURCE_ESTIMATE\x10\x01\x12\x0f\n\x0bSOURCE_USER\x10\x02\"\xec\x01\n\x19PbUserMaximumAerobicPower\x12\r\n\x05value\x18\x01 \x02(\r\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12H\n\x0esetting_source\x18\x03 \x01(\x0e\x32\x30.data.PbUserMaximumAerobicPower.MAPSettingSource\"L\n\x10MAPSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x13\n\x0fSOURCE_ESTIMATE\x10\x01\x12\x0f\n\x0bSOURCE_USER\x10\x02\"\xec\x01\n\x19PbUserMaximumAerobicSpeed\x12\r\n\x05value\x18\x01 \x02(\x02\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12H\n\x0esetting_source\x18\x03 \x01(\x0e\x32\x30.data.PbUserMaximumAerobicSpeed.MASSettingSource\"L\n\x10MASSettingSource\x12\x12\n\x0eSOURCE_DEFAULT\x10\x00\x12\x13\n\x0fSOURCE_ESTIMATE\x10\x01\x12\x0f\n\x0bSOURCE_USER\x10\x02\"S\n\x0bPbSleepGoal\x12\x1a\n\x12sleep_goal_minutes\x18\x01 \x01(\r\x12(\n\rlast_modified\x18\x02 \x01(\x0b\x32\x11.PbSystemDateTime\"\xe6\x08\n\x0ePbUserPhysData\x12&\n\x08\x62irthday\x18\x01 \x02(\x0b\x32\x14.data.PbUserBirthday\x12\"\n\x06gender\x18\x02 \x02(\x0b\x32\x12.data.PbUserGender\x12\"\n\x06weight\x18\x03 \x01(\x0b\x32\x12.data.PbUserWeight\x12\"\n\x06height\x18\x04 \x01(\x0b\x32\x12.data.PbUserHeight\x12\x32\n\x11maximum_heartrate\x18\x05 \x01(\x0b\x32\x17.data.PbUserHrAttribute\x12\x32\n\x11resting_heartrate\x18\x06 \x01(\x0b\x32\x17.data.PbUserHrAttribute\x12;\n\x1aOBSOLETE_sitting_heartrate\x18\x07 \x01(\x0b\x32\x17.data.PbUserHrAttribute\x12\x32\n\x11\x61\x65robic_threshold\x18\x08 \x01(\x0b\x32\x17.data.PbUserHrAttribute\x12\x34\n\x13\x61naerobic_threshold\x18\t \x01(\x0b\x32\x17.data.PbUserHrAttribute\x12\"\n\x06vo2max\x18\n \x01(\x0b\x32\x12.data.PbUserVo2Max\x12;\n\x13training_background\x18\x0b \x01(\x0b\x32\x1e.data.PbUserTrainingBackground\x12+\n\x0btypical_day\x18\x0c \x01(\x0b\x32\x16.data.PbUserTypicalDay\x12?\n\x18weekly_recovery_time_sum\x18\r \x01(\x0b\x32\x1d.data.PbWeeklyRecoveryTimeSum\x12I\n!OBSOLETE_speed_calibration_offset\x18\x0e \x01(\x0b\x32\x1e.data.PbSpeedCalibrationOffset\x12H\n\x1a\x66unctional_threshold_power\x18\x0f \x01(\x0b\x32$.data.PbUserFunctionalThresholdPower\x12=\n\x19sensor_calibration_offset\x18\x10 \x03(\x0b\x32\x1a.PbSensorCalibrationOffset\x12%\n\nsleep_goal\x18\x11 \x01(\x0b\x32\x11.data.PbSleepGoal\x12\x46\n\x1drunning_maximum_aerobic_power\x18\x12 \x01(\x0b\x32\x1f.data.PbUserMaximumAerobicPower\x12\x46\n\x1drunning_maximum_aerobic_speed\x18\x13 \x01(\x0b\x32\x1f.data.PbUserMaximumAerobicSpeed\x12(\n\rlast_modified\x18\x64 \x01(\x0b\x32\x11.PbSystemDateTime\x12-\n\x13snapshot_start_time\x18\x65 \x01(\x0b\x32\x10.PbLocalDateTime')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBUSERGENDER_GENDER = _descriptor.EnumDescriptor(
name='Gender',
full_name='data.PbUserGender.Gender',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='MALE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEMALE', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=227,
serialized_end=257,
)
_sym_db.RegisterEnumDescriptor(_PBUSERGENDER_GENDER)
_PBUSERHRATTRIBUTE_HRSETTINGSOURCE = _descriptor.EnumDescriptor(
name='HrSettingSource',
full_name='data.PbUserHrAttribute.HrSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_AGE_BASED', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_MEASURED', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_KEEP', index=4, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=403,
serialized_end=517,
)
_sym_db.RegisterEnumDescriptor(_PBUSERHRATTRIBUTE_HRSETTINGSOURCE)
_PBUSERWEIGHT_WEIGHTSETTINGSOURCE = _descriptor.EnumDescriptor(
name='WeightSettingSource',
full_name='data.PbUserWeight.WeightSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_MEASURED', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=657,
serialized_end=736,
)
_sym_db.RegisterEnumDescriptor(_PBUSERWEIGHT_WEIGHTSETTINGSOURCE)
_PBUSERVO2MAX_VO2MAXSETTINGSOURCE = _descriptor.EnumDescriptor(
name='Vo2MaxSettingSource',
full_name='data.PbUserVo2Max.Vo2MaxSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_ESTIMATE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_FITNESSTEST', index=3, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=949,
serialized_end=1052,
)
_sym_db.RegisterEnumDescriptor(_PBUSERVO2MAX_VO2MAXSETTINGSOURCE)
_PBUSERTRAININGBACKGROUND_TRAININGBACKGROUND = _descriptor.EnumDescriptor(
name='TrainingBackground',
full_name='data.PbUserTrainingBackground.TrainingBackground',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='OCCASIONAL', index=0, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REGULAR', index=1, number=20,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FREQUENT', index=2, number=30,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEAVY', index=3, number=40,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SEMI_PRO', index=4, number=50,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PRO', index=5, number=60,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1191,
serialized_end=1288,
)
_sym_db.RegisterEnumDescriptor(_PBUSERTRAININGBACKGROUND_TRAININGBACKGROUND)
_PBUSERTYPICALDAY_TYPICALDAY = _descriptor.EnumDescriptor(
name='TypicalDay',
full_name='data.PbUserTypicalDay.TypicalDay',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='MOSTLY_SITTING', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MOSTLY_STANDING', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MOSTLY_MOVING', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1403,
serialized_end=1475,
)
_sym_db.RegisterEnumDescriptor(_PBUSERTYPICALDAY_TYPICALDAY)
_PBUSERFUNCTIONALTHRESHOLDPOWER_FTPSETTINGSOURCE = _descriptor.EnumDescriptor(
name='FTPSettingSource',
full_name='data.PbUserFunctionalThresholdPower.FTPSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_ESTIMATE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1817,
serialized_end=1893,
)
_sym_db.RegisterEnumDescriptor(_PBUSERFUNCTIONALTHRESHOLDPOWER_FTPSETTINGSOURCE)
_PBUSERMAXIMUMAEROBICPOWER_MAPSETTINGSOURCE = _descriptor.EnumDescriptor(
name='MAPSettingSource',
full_name='data.PbUserMaximumAerobicPower.MAPSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_ESTIMATE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2056,
serialized_end=2132,
)
_sym_db.RegisterEnumDescriptor(_PBUSERMAXIMUMAEROBICPOWER_MAPSETTINGSOURCE)
_PBUSERMAXIMUMAEROBICSPEED_MASSETTINGSOURCE = _descriptor.EnumDescriptor(
name='MASSettingSource',
full_name='data.PbUserMaximumAerobicSpeed.MASSettingSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SOURCE_DEFAULT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_ESTIMATE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SOURCE_USER', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2295,
serialized_end=2371,
)
_sym_db.RegisterEnumDescriptor(_PBUSERMAXIMUMAEROBICSPEED_MASSETTINGSOURCE)
_PBUSERBIRTHDAY = _descriptor.Descriptor(
name='PbUserBirthday',
full_name='data.PbUserBirthday',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserBirthday.value', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserBirthday.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=42,
serialized_end=124,
)
_PBUSERGENDER = _descriptor.Descriptor(
name='PbUserGender',
full_name='data.PbUserGender',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserGender.value', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserGender.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERGENDER_GENDER,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=127,
serialized_end=257,
)
_PBUSERHRATTRIBUTE = _descriptor.Descriptor(
name='PbUserHrAttribute',
full_name='data.PbUserHrAttribute',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserHrAttribute.value', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserHrAttribute.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserHrAttribute.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERHRATTRIBUTE_HRSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=260,
serialized_end=517,
)
_PBUSERWEIGHT = _descriptor.Descriptor(
name='PbUserWeight',
full_name='data.PbUserWeight',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserWeight.value', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserWeight.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserWeight.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERWEIGHT_WEIGHTSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=520,
serialized_end=736,
)
_PBUSERHEIGHT = _descriptor.Descriptor(
name='PbUserHeight',
full_name='data.PbUserHeight',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserHeight.value', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserHeight.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=738,
serialized_end=809,
)
_PBUSERVO2MAX = _descriptor.Descriptor(
name='PbUserVo2Max',
full_name='data.PbUserVo2Max',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserVo2Max.value', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserVo2Max.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserVo2Max.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERVO2MAX_VO2MAXSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=812,
serialized_end=1052,
)
_PBUSERTRAININGBACKGROUND = _descriptor.Descriptor(
name='PbUserTrainingBackground',
full_name='data.PbUserTrainingBackground',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserTrainingBackground.value', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=10,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserTrainingBackground.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERTRAININGBACKGROUND_TRAININGBACKGROUND,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1055,
serialized_end=1288,
)
_PBUSERTYPICALDAY = _descriptor.Descriptor(
name='PbUserTypicalDay',
full_name='data.PbUserTypicalDay',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserTypicalDay.value', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserTypicalDay.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERTYPICALDAY_TYPICALDAY,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1291,
serialized_end=1475,
)
_PBWEEKLYRECOVERYTIMESUM = _descriptor.Descriptor(
name='PbWeeklyRecoveryTimeSum',
full_name='data.PbWeeklyRecoveryTimeSum',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbWeeklyRecoveryTimeSum.value', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbWeeklyRecoveryTimeSum.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1477,
serialized_end=1559,
)
_PBSPEEDCALIBRATIONOFFSET = _descriptor.Descriptor(
name='PbSpeedCalibrationOffset',
full_name='data.PbSpeedCalibrationOffset',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbSpeedCalibrationOffset.value', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbSpeedCalibrationOffset.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1561,
serialized_end=1644,
)
_PBUSERFUNCTIONALTHRESHOLDPOWER = _descriptor.Descriptor(
name='PbUserFunctionalThresholdPower',
full_name='data.PbUserFunctionalThresholdPower',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserFunctionalThresholdPower.value', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserFunctionalThresholdPower.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserFunctionalThresholdPower.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERFUNCTIONALTHRESHOLDPOWER_FTPSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1647,
serialized_end=1893,
)
_PBUSERMAXIMUMAEROBICPOWER = _descriptor.Descriptor(
name='PbUserMaximumAerobicPower',
full_name='data.PbUserMaximumAerobicPower',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserMaximumAerobicPower.value', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserMaximumAerobicPower.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserMaximumAerobicPower.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERMAXIMUMAEROBICPOWER_MAPSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=1896,
serialized_end=2132,
)
_PBUSERMAXIMUMAEROBICSPEED = _descriptor.Descriptor(
name='PbUserMaximumAerobicSpeed',
full_name='data.PbUserMaximumAerobicSpeed',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbUserMaximumAerobicSpeed.value', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbUserMaximumAerobicSpeed.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='setting_source', full_name='data.PbUserMaximumAerobicSpeed.setting_source', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBUSERMAXIMUMAEROBICSPEED_MASSETTINGSOURCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2135,
serialized_end=2371,
)
_PBSLEEPGOAL = _descriptor.Descriptor(
name='PbSleepGoal',
full_name='data.PbSleepGoal',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='sleep_goal_minutes', full_name='data.PbSleepGoal.sleep_goal_minutes', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbSleepGoal.last_modified', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=2373,
serialized_end=2456,
)
_PBUSERPHYSDATA = _descriptor.Descriptor(
name='PbUserPhysData',
full_name='data.PbUserPhysData',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='birthday', full_name='data.PbUserPhysData.birthday', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='gender', full_name='data.PbUserPhysData.gender', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='weight', full_name='data.PbUserPhysData.weight', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='height', full_name='data.PbUserPhysData.height', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/syncinfo_pb2.py | loophole/polar/pb/syncinfo_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: syncinfo.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='syncinfo.proto',
package='data',
serialized_pb=_b('\n\x0esyncinfo.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\x9c\x01\n\nPbSyncInfo\x12(\n\rlast_modified\x18\x01 \x02(\x0b\x32\x11.PbSystemDateTime\x12\x14\n\x0c\x63hanged_path\x18\x02 \x03(\t\x12,\n\x11last_synchronized\x18\x03 \x01(\x0b\x32\x11.PbSystemDateTime\x12 \n\x12\x66ull_sync_required\x18\x04 \x01(\x08:\x04true')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSYNCINFO = _descriptor.Descriptor(
name='PbSyncInfo',
full_name='data.PbSyncInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbSyncInfo.last_modified', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='changed_path', full_name='data.PbSyncInfo.changed_path', index=1,
number=2, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_synchronized', full_name='data.PbSyncInfo.last_synchronized', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='full_sync_required', full_name='data.PbSyncInfo.full_sync_required', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=True,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=38,
serialized_end=194,
)
_PBSYNCINFO.fields_by_name['last_modified'].message_type = types_pb2._PBSYSTEMDATETIME
_PBSYNCINFO.fields_by_name['last_synchronized'].message_type = types_pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbSyncInfo'] = _PBSYNCINFO
PbSyncInfo = _reflection.GeneratedProtocolMessageType('PbSyncInfo', (_message.Message,), dict(
DESCRIPTOR = _PBSYNCINFO,
__module__ = 'syncinfo_pb2'
# @@protoc_insertion_point(class_scope:data.PbSyncInfo)
))
_sym_db.RegisterMessage(PbSyncInfo)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/pftp_notification_pb2.py | loophole/polar/pb/pftp_notification_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pftp/pftp_notification.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='pftp/pftp_notification.proto',
package='protocol',
syntax='proto2',
serialized_pb=_b('\n\x1cpftp/pftp_notification.proto\x12\x08protocol\x1a\x0btypes.proto\"P\n\x1ePbPFtpFilesystemModifiedParams\x12 \n\x06\x61\x63tion\x18\x01 \x02(\x0e\x32\x10.protocol.Action\x12\x0c\n\x04path\x18\x02 \x02(\t\"*\n\x15PbPFtpInactivityAlert\x12\x11\n\tcountdown\x18\x01 \x02(\r\"1\n\x1bPbPFtpTrainingSessionStatus\x12\x12\n\ninprogress\x18\x01 \x02(\x08\"D\n\x1aPbPFtpAutoSyncStatusParams\x12\x11\n\tsucceeded\x18\x01 \x02(\x08\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"F\n\x1dPbPFtpPolarShellMessageParams\x12\x17\n\x0fpolarShellMsgId\x18\x01 \x02(\r\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\"H\n\x14PbPftpPnsDHAttribute\x12\x30\n\x04type\x18\x01 \x02(\x0e\x32\".protocol.PbPftpPnsDHAttributeType\"n\n\x1fPbPftpPnsDHNotificationResponse\x12\x17\n\x0fnotification_id\x18\x01 \x02(\r\x12\x32\n\nattributes\x18\x02 \x03(\x0b\x32\x1e.protocol.PbPftpPnsDHAttribute\"H\n\x0ePbPftpPnsState\x12\x1d\n\x15notifications_enabled\x18\x01 \x02(\x08\x12\x17\n\x0fpreview_enabled\x18\x02 \x01(\x08\"u\n\x19PbPftpStartGPSMeasurement\x12\x1e\n\x10minimum_interval\x18\x01 \x01(\r:\x04\x31\x30\x30\x30\x12\x13\n\x08\x61\x63\x63uracy\x18\x02 \x01(\r:\x01\x32\x12\x10\n\x08latitude\x18\x03 \x01(\x01\x12\x11\n\tlongitude\x18\x04 \x01(\x01\"B\n\x19PbInitializeSessionParams\x12%\n\x1duses_attribute_level_response\x18\x01 \x01(\x08\"4\n\x1fPbFirmwareUpdateAvailableParams\x12\x11\n\tmandatory\x18\x01 \x02(\x08\"X\n\x1fPbPFtpSimulateButtonPressParams\x12\x18\n\x06\x62utton\x18\x01 \x02(\x0e\x32\x08.Buttons\x12\x1b\n\x05state\x18\x02 \x02(\x0e\x32\x0c.ButtonState\"3\n\x13PbPFtpTouchPosition\x12\x0b\n\x03pos\x18\x01 \x02(\r\x12\x0f\n\x07max_pos\x18\x02 \x01(\r\"\xa2\x02\n\x1fPbPFtpSimulateTouchScreenParams\x12I\n\x05state\x18\x01 \x02(\x0e\x32:.protocol.PbPFtpSimulateTouchScreenParams.PbPFtpTouchState\x12,\n\x05x_pos\x18\x02 \x01(\x0b\x32\x1d.protocol.PbPFtpTouchPosition\x12,\n\x05y_pos\x18\x03 \x01(\x0b\x32\x1d.protocol.PbPFtpTouchPosition\"X\n\x10PbPFtpTouchState\x12\x15\n\x11TOUCH_STATE_START\x10\x00\x12\x18\n\x14TOUCH_STATE_POSITION\x10\x01\x12\x13\n\x0fTOUCH_STATE_END\x10\x02\">\n\x14PbPFtpStopSyncParams\x12\x11\n\tcompleted\x18\x01 \x02(\x08\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\"i\n\x18PbPFtpFactoryResetParams\x12\r\n\x05sleep\x18\x01 \x02(\x08\x12!\n\x13\x64o_factory_defaults\x18\x02 \x01(\x08:\x04true\x12\x1b\n\x0cota_fwupdate\x18\x03 \x01(\x08:\x05\x66\x61lse\",\n\x19PbPFtpStartAutosyncParams\x12\x0f\n\x07timeout\x18\x01 \x02(\r\"s\n\x14PbPftpPnsHDAttribute\x12\x30\n\x04type\x18\x01 \x02(\x0e\x32\".protocol.PbPftpPnsHDAttributeType\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\t\x12\x1b\n\x13\x61ttribute_full_size\x18\x03 \x01(\r\"\xb9\x02\n\x17PbPftpPnsHDNotification\x12\x17\n\x0fnotification_id\x18\x01 \x02(\r\x12\x34\n\x0b\x63\x61tegory_id\x18\x02 \x02(\x0e\x32\x1f.protocol.PbPftpPnsHDCategoryID\x12 \n\x06\x61\x63tion\x18\x03 \x02(\x0e\x32\x10.protocol.Action\x12$\n\nissue_time\x18\x04 \x02(\x0b\x32\x10.PbLocalDateTime\x12\'\n\x1fnew_same_category_notifications\x18\x05 \x01(\r\x12*\n\"unread_same_category_notifications\x18\x06 \x01(\r\x12\x32\n\nattributes\x18\x07 \x03(\x0b\x32\x1e.protocol.PbPftpPnsHDAttribute\"\x9c\x01\n\x13PbPFtpGPSDataParams\x12\x10\n\x08latitude\x18\x01 \x02(\x01\x12\x11\n\tlongitude\x18\x02 \x02(\x01\x12\r\n\x05speed\x18\x03 \x01(\x02\x12\x10\n\x08\x64istance\x18\x04 \x01(\x02\x12\x10\n\x08\x61ltitude\x18\x05 \x01(\x02\x12\x18\n\x10satellite_amount\x18\x06 \x01(\r\x12\x13\n\x0btime_offset\x18\x07 \x01(\r*\xe7\x02\n\x1bPbPFtpDevToHostNotification\x12\x17\n\x13\x46ILESYSTEM_MODIFIED\x10\x00\x12\x17\n\x13INTERNAL_TEST_EVENT\x10\x01\x12\n\n\x06IDLING\x10\x02\x12\x12\n\x0e\x42\x41TTERY_STATUS\x10\x03\x12\x14\n\x10INACTIVITY_ALERT\x10\x04\x12\x1b\n\x17TRAINING_SESSION_STATUS\x10\x05\x12\x11\n\rSYNC_REQUIRED\x10\x07\x12\x13\n\x0f\x41UTOSYNC_STATUS\x10\x08\x12 \n\x1cPNS_DH_NOTIFICATION_RESPONSE\x10\t\x12\x10\n\x0cPNS_SETTINGS\x10\n\x12\x19\n\x15START_GPS_MEASUREMENT\x10\x0b\x12\x18\n\x14STOP_GPS_MEASUREMENT\x10\x0c\x12\x19\n\x15KEEP_BACKGROUND_ALIVE\x10\r\x12\x17\n\x13POLAR_SHELL_DH_DATA\x10\x0e*/\n\x06\x41\x63tion\x12\x0b\n\x07\x43REATED\x10\x00\x12\x0b\n\x07UPDATED\x10\x01\x12\x0b\n\x07REMOVED\x10\x02*\xa2\x01\n\x18PbPftpPnsDHAttributeType\x12\x12\n\x0eUNKNOWN_ACTION\x10\x01\x12\x13\n\x0fPOSITIVE_ACTION\x10\x02\x12\x13\n\x0fNEGATIVE_ACTION\x10\x03\x12\x10\n\x0c\x43LEAR_ACTION\x10\x04\x12\x0c\n\x08\x41_ACTION\x10\x05\x12\x0c\n\x08\x42_ACTION\x10\x06\x12\x0c\n\x08\x43_ACTION\x10\x07\x12\x0c\n\x08\x44_ACTION\x10\x08*\x94\x03\n\x1bPbPFtpHostToDevNotification\x12\x0e\n\nSTART_SYNC\x10\x00\x12\r\n\tSTOP_SYNC\x10\x01\x12\t\n\x05RESET\x10\x02\x12\x18\n\x14LOCK_PRODUCTION_DATA\x10\x03\x12\x12\n\x0eTERMINATE_SYNC\x10\x04\x12\x0e\n\nKEEP_ALIVE\x10\x05\x12\x12\n\x0eSTART_AUTOSYNC\x10\x06\x12\x17\n\x13PNS_HD_NOTIFICATION\x10\x07\x12\x16\n\x12INITIALIZE_SESSION\x10\x08\x12\x15\n\x11TERMINATE_SESSION\x10\t\x12\x19\n\x15SIMULATE_BUTTON_PRESS\x10\n\x12\x19\n\x15SIMULATE_TOUCH_SCREEN\x10\x0b\x12\x10\n\x0cREQUEST_SYNC\x10\x0c\x12\x1d\n\x19\x46IRMWARE_UPDATE_AVAILABLE\x10\r\x12\x0c\n\x08GPS_DATA\x10\x0e\x12\x0c\n\x08GPS_LOST\x10\x0f\x12\x15\n\x11GPS_NO_PERMISSION\x10\x10\x12\x17\n\x13POLAR_SHELL_HD_DATA\x10\x11*\xf9\x03\n\x15PbPftpPnsHDCategoryID\x12\x15\n\x11\x43\x41TEGORY_ID_OTHER\x10\x00\x12\x15\n\x11\x43\x41TEGORY_ID_POLAR\x10\x01\x12\x1c\n\x18\x43\x41TEGORY_ID_INCOMINGCALL\x10\x02\x12\x1a\n\x16\x43\x41TEGORY_ID_MISSEDCALL\x10\x03\x12\x19\n\x15\x43\x41TEGORY_ID_VOICEMAIL\x10\x04\x12\x16\n\x12\x43\x41TEGORY_ID_SOCIAL\x10\x05\x12\x18\n\x14\x43\x41TEGORY_ID_SCHEDULE\x10\x06\x12\x15\n\x11\x43\x41TEGORY_ID_EMAIL\x10\x07\x12\x14\n\x10\x43\x41TEGORY_ID_NEWS\x10\x08\x12 \n\x1c\x43\x41TEGORY_ID_HEALTHANDFITNESS\x10\t\x12\"\n\x1e\x43\x41TEGORY_ID_BUSINESSANDFINANCE\x10\n\x12\x18\n\x14\x43\x41TEGORY_ID_LOCATION\x10\x0b\x12\x1d\n\x19\x43\x41TEGORY_ID_ENTERTAINMENT\x10\x0c\x12\x15\n\x11\x43\x41TEGORY_ID_ALARM\x10\r\x12\x15\n\x11\x43\x41TEGORY_ID_PROMO\x10\x0e\x12\x1e\n\x1a\x43\x41TEGORY_ID_RECOMMENDATION\x10\x0f\x12\x16\n\x12\x43\x41TEGORY_ID_STATUS\x10\x10\x12\x19\n\x15\x43\x41TEGORY_ID_TRANSPORT\x10\x11*\xf4\x01\n\x18PbPftpPnsHDAttributeType\x12\t\n\x05TITLE\x10\x00\x12\x0c\n\x08SUBTITLE\x10\x01\x12\x0b\n\x07MESSAGE\x10\x02\x12\x19\n\x15POSITIVE_ACTION_LABEL\x10\x03\x12\x19\n\x15NEGATIVE_ACTION_LABEL\x10\x04\x12\x14\n\x10\x41PPLICATION_NAME\x10\x05\x12\x16\n\x12\x43LEAR_ACTION_LABEL\x10\x06\x12\x12\n\x0e\x41_ACTION_LABEL\x10\x07\x12\x12\n\x0e\x42_ACTION_LABEL\x10\x08\x12\x12\n\x0e\x43_ACTION_LABEL\x10\t\x12\x12\n\x0e\x44_ACTION_LABEL\x10\n')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPFTPDEVTOHOSTNOTIFICATION = _descriptor.EnumDescriptor(
name='PbPFtpDevToHostNotification',
full_name='protocol.PbPFtpDevToHostNotification',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='FILESYSTEM_MODIFIED', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INTERNAL_TEST_EVENT', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='IDLING', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BATTERY_STATUS', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INACTIVITY_ALERT', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TRAINING_SESSION_STATUS', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SYNC_REQUIRED', index=6, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOSYNC_STATUS', index=7, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PNS_DH_NOTIFICATION_RESPONSE', index=8, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PNS_SETTINGS', index=9, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='START_GPS_MEASUREMENT', index=10, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STOP_GPS_MEASUREMENT', index=11, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEEP_BACKGROUND_ALIVE', index=12, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POLAR_SHELL_DH_DATA', index=13, number=14,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2121,
serialized_end=2480,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPDEVTOHOSTNOTIFICATION)
PbPFtpDevToHostNotification = enum_type_wrapper.EnumTypeWrapper(_PBPFTPDEVTOHOSTNOTIFICATION)
_ACTION = _descriptor.EnumDescriptor(
name='Action',
full_name='protocol.Action',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='CREATED', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='UPDATED', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOVED', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2482,
serialized_end=2529,
)
_sym_db.RegisterEnumDescriptor(_ACTION)
Action = enum_type_wrapper.EnumTypeWrapper(_ACTION)
_PBPFTPPNSDHATTRIBUTETYPE = _descriptor.EnumDescriptor(
name='PbPftpPnsDHAttributeType',
full_name='protocol.PbPftpPnsDHAttributeType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='UNKNOWN_ACTION', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POSITIVE_ACTION', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NEGATIVE_ACTION', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CLEAR_ACTION', index=3, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='A_ACTION', index=4, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='B_ACTION', index=5, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='C_ACTION', index=6, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='D_ACTION', index=7, number=8,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2532,
serialized_end=2694,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPPNSDHATTRIBUTETYPE)
PbPftpPnsDHAttributeType = enum_type_wrapper.EnumTypeWrapper(_PBPFTPPNSDHATTRIBUTETYPE)
_PBPFTPHOSTTODEVNOTIFICATION = _descriptor.EnumDescriptor(
name='PbPFtpHostToDevNotification',
full_name='protocol.PbPFtpHostToDevNotification',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='START_SYNC', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STOP_SYNC', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='RESET', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LOCK_PRODUCTION_DATA', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TERMINATE_SYNC', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='KEEP_ALIVE', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='START_AUTOSYNC', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PNS_HD_NOTIFICATION', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INITIALIZE_SESSION', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TERMINATE_SESSION', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SIMULATE_BUTTON_PRESS', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SIMULATE_TOUCH_SCREEN', index=11, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REQUEST_SYNC', index=12, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FIRMWARE_UPDATE_AVAILABLE', index=13, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GPS_DATA', index=14, number=14,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GPS_LOST', index=15, number=15,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GPS_NO_PERMISSION', index=16, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POLAR_SHELL_HD_DATA', index=17, number=17,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2697,
serialized_end=3101,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPHOSTTODEVNOTIFICATION)
PbPFtpHostToDevNotification = enum_type_wrapper.EnumTypeWrapper(_PBPFTPHOSTTODEVNOTIFICATION)
_PBPFTPPNSHDCATEGORYID = _descriptor.EnumDescriptor(
name='PbPftpPnsHDCategoryID',
full_name='protocol.PbPftpPnsHDCategoryID',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_OTHER', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_POLAR', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_INCOMINGCALL', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_MISSEDCALL', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_VOICEMAIL', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_SOCIAL', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_SCHEDULE', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_EMAIL', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_NEWS', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_HEALTHANDFITNESS', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_BUSINESSANDFINANCE', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_LOCATION', index=11, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_ENTERTAINMENT', index=12, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_ALARM', index=13, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_PROMO', index=14, number=14,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_RECOMMENDATION', index=15, number=15,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_STATUS', index=16, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CATEGORY_ID_TRANSPORT', index=17, number=17,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3104,
serialized_end=3609,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPPNSHDCATEGORYID)
PbPftpPnsHDCategoryID = enum_type_wrapper.EnumTypeWrapper(_PBPFTPPNSHDCATEGORYID)
_PBPFTPPNSHDATTRIBUTETYPE = _descriptor.EnumDescriptor(
name='PbPftpPnsHDAttributeType',
full_name='protocol.PbPftpPnsHDAttributeType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TITLE', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SUBTITLE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MESSAGE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POSITIVE_ACTION_LABEL', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NEGATIVE_ACTION_LABEL', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='APPLICATION_NAME', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CLEAR_ACTION_LABEL', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='A_ACTION_LABEL', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='B_ACTION_LABEL', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='C_ACTION_LABEL', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='D_ACTION_LABEL', index=10, number=10,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3612,
serialized_end=3856,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPPNSHDATTRIBUTETYPE)
PbPftpPnsHDAttributeType = enum_type_wrapper.EnumTypeWrapper(_PBPFTPPNSHDATTRIBUTETYPE)
FILESYSTEM_MODIFIED = 0
INTERNAL_TEST_EVENT = 1
IDLING = 2
BATTERY_STATUS = 3
INACTIVITY_ALERT = 4
TRAINING_SESSION_STATUS = 5
SYNC_REQUIRED = 7
AUTOSYNC_STATUS = 8
PNS_DH_NOTIFICATION_RESPONSE = 9
PNS_SETTINGS = 10
START_GPS_MEASUREMENT = 11
STOP_GPS_MEASUREMENT = 12
KEEP_BACKGROUND_ALIVE = 13
POLAR_SHELL_DH_DATA = 14
CREATED = 0
UPDATED = 1
REMOVED = 2
UNKNOWN_ACTION = 1
POSITIVE_ACTION = 2
NEGATIVE_ACTION = 3
CLEAR_ACTION = 4
A_ACTION = 5
B_ACTION = 6
C_ACTION = 7
D_ACTION = 8
START_SYNC = 0
STOP_SYNC = 1
RESET = 2
LOCK_PRODUCTION_DATA = 3
TERMINATE_SYNC = 4
KEEP_ALIVE = 5
START_AUTOSYNC = 6
PNS_HD_NOTIFICATION = 7
INITIALIZE_SESSION = 8
TERMINATE_SESSION = 9
SIMULATE_BUTTON_PRESS = 10
SIMULATE_TOUCH_SCREEN = 11
REQUEST_SYNC = 12
FIRMWARE_UPDATE_AVAILABLE = 13
GPS_DATA = 14
GPS_LOST = 15
GPS_NO_PERMISSION = 16
POLAR_SHELL_HD_DATA = 17
CATEGORY_ID_OTHER = 0
CATEGORY_ID_POLAR = 1
CATEGORY_ID_INCOMINGCALL = 2
CATEGORY_ID_MISSEDCALL = 3
CATEGORY_ID_VOICEMAIL = 4
CATEGORY_ID_SOCIAL = 5
CATEGORY_ID_SCHEDULE = 6
CATEGORY_ID_EMAIL = 7
CATEGORY_ID_NEWS = 8
CATEGORY_ID_HEALTHANDFITNESS = 9
CATEGORY_ID_BUSINESSANDFINANCE = 10
CATEGORY_ID_LOCATION = 11
CATEGORY_ID_ENTERTAINMENT = 12
CATEGORY_ID_ALARM = 13
CATEGORY_ID_PROMO = 14
CATEGORY_ID_RECOMMENDATION = 15
CATEGORY_ID_STATUS = 16
CATEGORY_ID_TRANSPORT = 17
TITLE = 0
SUBTITLE = 1
MESSAGE = 2
POSITIVE_ACTION_LABEL = 3
NEGATIVE_ACTION_LABEL = 4
APPLICATION_NAME = 5
CLEAR_ACTION_LABEL = 6
A_ACTION_LABEL = 7
B_ACTION_LABEL = 8
C_ACTION_LABEL = 9
D_ACTION_LABEL = 10
_PBPFTPSIMULATETOUCHSCREENPARAMS_PBPFTPTOUCHSTATE = _descriptor.EnumDescriptor(
name='PbPFtpTouchState',
full_name='protocol.PbPFtpSimulateTouchScreenParams.PbPFtpTouchState',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TOUCH_STATE_START', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOUCH_STATE_POSITION', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TOUCH_STATE_END', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1221,
serialized_end=1309,
)
_sym_db.RegisterEnumDescriptor(_PBPFTPSIMULATETOUCHSCREENPARAMS_PBPFTPTOUCHSTATE)
_PBPFTPFILESYSTEMMODIFIEDPARAMS = _descriptor.Descriptor(
name='PbPFtpFilesystemModifiedParams',
full_name='protocol.PbPFtpFilesystemModifiedParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='action', full_name='protocol.PbPFtpFilesystemModifiedParams.action', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='path', full_name='protocol.PbPFtpFilesystemModifiedParams.path', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=55,
serialized_end=135,
)
_PBPFTPINACTIVITYALERT = _descriptor.Descriptor(
name='PbPFtpInactivityAlert',
full_name='protocol.PbPFtpInactivityAlert',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='countdown', full_name='protocol.PbPFtpInactivityAlert.countdown', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=137,
serialized_end=179,
)
_PBPFTPTRAININGSESSIONSTATUS = _descriptor.Descriptor(
name='PbPFtpTrainingSessionStatus',
full_name='protocol.PbPFtpTrainingSessionStatus',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='inprogress', full_name='protocol.PbPFtpTrainingSessionStatus.inprogress', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=181,
serialized_end=230,
)
_PBPFTPAUTOSYNCSTATUSPARAMS = _descriptor.Descriptor(
name='PbPFtpAutoSyncStatusParams',
full_name='protocol.PbPFtpAutoSyncStatusParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='succeeded', full_name='protocol.PbPFtpAutoSyncStatusParams.succeeded', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='description', full_name='protocol.PbPFtpAutoSyncStatusParams.description', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=232,
serialized_end=300,
)
_PBPFTPPOLARSHELLMESSAGEPARAMS = _descriptor.Descriptor(
name='PbPFtpPolarShellMessageParams',
full_name='protocol.PbPFtpPolarShellMessageParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='polarShellMsgId', full_name='protocol.PbPFtpPolarShellMessageParams.polarShellMsgId', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='data', full_name='protocol.PbPFtpPolarShellMessageParams.data', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=302,
serialized_end=372,
)
_PBPFTPPNSDHATTRIBUTE = _descriptor.Descriptor(
name='PbPftpPnsDHAttribute',
full_name='protocol.PbPftpPnsDHAttribute',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='protocol.PbPftpPnsDHAttribute.type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=374,
serialized_end=446,
)
_PBPFTPPNSDHNOTIFICATIONRESPONSE = _descriptor.Descriptor(
name='PbPftpPnsDHNotificationResponse',
full_name='protocol.PbPftpPnsDHNotificationResponse',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='notification_id', full_name='protocol.PbPftpPnsDHNotificationResponse.notification_id', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='attributes', full_name='protocol.PbPftpPnsDHNotificationResponse.attributes', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=448,
serialized_end=558,
)
_PBPFTPPNSSTATE = _descriptor.Descriptor(
name='PbPftpPnsState',
full_name='protocol.PbPftpPnsState',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='notifications_enabled', full_name='protocol.PbPftpPnsState.notifications_enabled', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='preview_enabled', full_name='protocol.PbPftpPnsState.preview_enabled', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=560,
serialized_end=632,
)
_PBPFTPSTARTGPSMEASUREMENT = _descriptor.Descriptor(
name='PbPftpStartGPSMeasurement',
full_name='protocol.PbPftpStartGPSMeasurement',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='minimum_interval', full_name='protocol.PbPftpStartGPSMeasurement.minimum_interval', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=1000,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='accuracy', full_name='protocol.PbPftpStartGPSMeasurement.accuracy', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=True, default_value=2,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='latitude', full_name='protocol.PbPftpStartGPSMeasurement.latitude', index=2,
number=3, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='longitude', full_name='protocol.PbPftpStartGPSMeasurement.longitude', index=3,
number=4, type=1, cpp_type=5, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=634,
serialized_end=751,
)
_PBINITIALIZESESSIONPARAMS = _descriptor.Descriptor(
name='PbInitializeSessionParams',
full_name='protocol.PbInitializeSessionParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='uses_attribute_level_response', full_name='protocol.PbInitializeSessionParams.uses_attribute_level_response', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=753,
serialized_end=819,
)
_PBFIRMWAREUPDATEAVAILABLEPARAMS = _descriptor.Descriptor(
name='PbFirmwareUpdateAvailableParams',
full_name='protocol.PbFirmwareUpdateAvailableParams',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='mandatory', full_name='protocol.PbFirmwareUpdateAvailableParams.mandatory', index=0,
number=1, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=821,
serialized_end=873,
)
_PBPFTPSIMULATEBUTTONPRESSPARAMS = _descriptor.Descriptor(
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/user_database_pb2.py | loophole/polar/pb/user_database_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: user_database.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='user_database.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x13user_database.proto\x12\x04\x64\x61ta\"&\n\x08PbUserDb\x12\x1a\n\x12\x63urrent_user_index\x18\x01 \x02(\r')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBUSERDB = _descriptor.Descriptor(
name='PbUserDb',
full_name='data.PbUserDb',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='current_user_index', full_name='data.PbUserDb.current_user_index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=29,
serialized_end=67,
)
DESCRIPTOR.message_types_by_name['PbUserDb'] = _PBUSERDB
PbUserDb = _reflection.GeneratedProtocolMessageType('PbUserDb', (_message.Message,), dict(
DESCRIPTOR = _PBUSERDB,
__module__ = 'user_database_pb2'
# @@protoc_insertion_point(class_scope:data.PbUserDb)
))
_sym_db.RegisterMessage(PbUserDb)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/identification_pb2.py | loophole/polar/pb/identification_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: identification.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='identification.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x14identification.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\x83\x01\n\x0cPbIdentifier\x12\x14\n\x0c\x65\x63osystem_id\x18\x01 \x02(\x04\x12\"\n\x07\x63reated\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12(\n\rlast_modified\x18\x03 \x02(\x0b\x32\x11.PbSystemDateTime\x12\x0f\n\x07\x64\x65leted\x18\x04 \x01(\x08')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBIDENTIFIER = _descriptor.Descriptor(
name='PbIdentifier',
full_name='data.PbIdentifier',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ecosystem_id', full_name='data.PbIdentifier.ecosystem_id', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='created', full_name='data.PbIdentifier.created', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbIdentifier.last_modified', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='deleted', full_name='data.PbIdentifier.deleted', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=44,
serialized_end=175,
)
_PBIDENTIFIER.fields_by_name['created'].message_type = types__pb2._PBSYSTEMDATETIME
_PBIDENTIFIER.fields_by_name['last_modified'].message_type = types__pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbIdentifier'] = _PBIDENTIFIER
PbIdentifier = _reflection.GeneratedProtocolMessageType('PbIdentifier', (_message.Message,), dict(
DESCRIPTOR = _PBIDENTIFIER,
__module__ = 'identification_pb2'
# @@protoc_insertion_point(class_scope:data.PbIdentifier)
))
_sym_db.RegisterMessage(PbIdentifier)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/act_samples_pb2.py | loophole/polar/pb/act_samples_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: act_samples.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='act_samples.proto',
package='data',
serialized_pb=_b('\n\x11\x61\x63t_samples.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"]\n\x0bPbSportInfo\x12\x0e\n\x06\x66\x61\x63tor\x18\x01 \x02(\x02\x12$\n\ntime_stamp\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x18\n\x10sport_profile_id\x18\x03 \x01(\x04\"\xa6\x02\n\x0ePbActivityInfo\x12\x31\n\x05value\x18\x01 \x02(\x0e\x32\".data.PbActivityInfo.ActivityClass\x12$\n\ntime_stamp\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x0e\n\x06\x66\x61\x63tor\x18\x03 \x01(\x02\"\xaa\x01\n\rActivityClass\x12\t\n\x05SLEEP\x10\x01\x12\r\n\tSEDENTARY\x10\x02\x12\t\n\x05LIGHT\x10\x03\x12\x17\n\x13\x43ONTINUOUS_MODERATE\x10\x04\x12\x19\n\x15INTERMITTENT_MODERATE\x10\x05\x12\x17\n\x13\x43ONTINUOUS_VIGOROUS\x10\x06\x12\x19\n\x15INTERMITTENT_VIGOROUS\x10\x07\x12\x0c\n\x08NON_WEAR\x10\x08\"?\n\x17PbInActivityTriggerInfo\x12$\n\ntime_stamp\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\"v\n\x1ePbInActivityNonWearTriggerInfo\x12*\n\x10start_time_stamp\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12(\n\x0e\x65nd_time_stamp\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\"\x9b\x03\n\x11PbActivitySamples\x12$\n\nstart_time\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12+\n\x16met_recording_interval\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12-\n\x18steps_recording_interval\x18\x03 \x02(\x0b\x32\x0b.PbDuration\x12\x13\n\x0bmet_samples\x18\x04 \x03(\x02\x12\x15\n\rsteps_samples\x18\x05 \x03(\r\x12%\n\nsport_info\x18\x06 \x03(\x0b\x32\x11.data.PbSportInfo\x12+\n\ractivity_info\x18\x07 \x03(\x0b\x32\x14.data.PbActivityInfo\x12\x39\n\x12inactivity_trigger\x18\x08 \x03(\x0b\x32\x1d.data.PbInActivityTriggerInfo\x12I\n\x1binactivity_non_wear_trigger\x18\t \x03(\x0b\x32$.data.PbInActivityNonWearTriggerInfo')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBACTIVITYINFO_ACTIVITYCLASS = _descriptor.EnumDescriptor(
name='ActivityClass',
full_name='data.PbActivityInfo.ActivityClass',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SLEEP', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SEDENTARY', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LIGHT', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CONTINUOUS_MODERATE', index=3, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INTERMITTENT_MODERATE', index=4, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CONTINUOUS_VIGOROUS', index=5, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INTERMITTENT_VIGOROUS', index=6, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NON_WEAR', index=7, number=8,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=260,
serialized_end=430,
)
_sym_db.RegisterEnumDescriptor(_PBACTIVITYINFO_ACTIVITYCLASS)
_PBSPORTINFO = _descriptor.Descriptor(
name='PbSportInfo',
full_name='data.PbSportInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='factor', full_name='data.PbSportInfo.factor', index=0,
number=1, type=2, cpp_type=6, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_stamp', full_name='data.PbSportInfo.time_stamp', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_profile_id', full_name='data.PbSportInfo.sport_profile_id', index=2,
number=3, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=40,
serialized_end=133,
)
_PBACTIVITYINFO = _descriptor.Descriptor(
name='PbActivityInfo',
full_name='data.PbActivityInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='value', full_name='data.PbActivityInfo.value', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_stamp', full_name='data.PbActivityInfo.time_stamp', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='factor', full_name='data.PbActivityInfo.factor', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBACTIVITYINFO_ACTIVITYCLASS,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=136,
serialized_end=430,
)
_PBINACTIVITYTRIGGERINFO = _descriptor.Descriptor(
name='PbInActivityTriggerInfo',
full_name='data.PbInActivityTriggerInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='time_stamp', full_name='data.PbInActivityTriggerInfo.time_stamp', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=432,
serialized_end=495,
)
_PBINACTIVITYNONWEARTRIGGERINFO = _descriptor.Descriptor(
name='PbInActivityNonWearTriggerInfo',
full_name='data.PbInActivityNonWearTriggerInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time_stamp', full_name='data.PbInActivityNonWearTriggerInfo.start_time_stamp', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_time_stamp', full_name='data.PbInActivityNonWearTriggerInfo.end_time_stamp', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=497,
serialized_end=615,
)
_PBACTIVITYSAMPLES = _descriptor.Descriptor(
name='PbActivitySamples',
full_name='data.PbActivitySamples',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbActivitySamples.start_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='met_recording_interval', full_name='data.PbActivitySamples.met_recording_interval', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steps_recording_interval', full_name='data.PbActivitySamples.steps_recording_interval', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='met_samples', full_name='data.PbActivitySamples.met_samples', index=3,
number=4, type=2, cpp_type=6, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='steps_samples', full_name='data.PbActivitySamples.steps_samples', index=4,
number=5, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sport_info', full_name='data.PbActivitySamples.sport_info', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='activity_info', full_name='data.PbActivitySamples.activity_info', index=6,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='inactivity_trigger', full_name='data.PbActivitySamples.inactivity_trigger', index=7,
number=8, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='inactivity_non_wear_trigger', full_name='data.PbActivitySamples.inactivity_non_wear_trigger', index=8,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=618,
serialized_end=1029,
)
_PBSPORTINFO.fields_by_name['time_stamp'].message_type = types_pb2._PBLOCALDATETIME
_PBACTIVITYINFO.fields_by_name['value'].enum_type = _PBACTIVITYINFO_ACTIVITYCLASS
_PBACTIVITYINFO.fields_by_name['time_stamp'].message_type = types_pb2._PBLOCALDATETIME
_PBACTIVITYINFO_ACTIVITYCLASS.containing_type = _PBACTIVITYINFO
_PBINACTIVITYTRIGGERINFO.fields_by_name['time_stamp'].message_type = types_pb2._PBLOCALDATETIME
_PBINACTIVITYNONWEARTRIGGERINFO.fields_by_name['start_time_stamp'].message_type = types_pb2._PBLOCALDATETIME
_PBINACTIVITYNONWEARTRIGGERINFO.fields_by_name['end_time_stamp'].message_type = types_pb2._PBLOCALDATETIME
_PBACTIVITYSAMPLES.fields_by_name['start_time'].message_type = types_pb2._PBLOCALDATETIME
_PBACTIVITYSAMPLES.fields_by_name['met_recording_interval'].message_type = types_pb2._PBDURATION
_PBACTIVITYSAMPLES.fields_by_name['steps_recording_interval'].message_type = types_pb2._PBDURATION
_PBACTIVITYSAMPLES.fields_by_name['sport_info'].message_type = _PBSPORTINFO
_PBACTIVITYSAMPLES.fields_by_name['activity_info'].message_type = _PBACTIVITYINFO
_PBACTIVITYSAMPLES.fields_by_name['inactivity_trigger'].message_type = _PBINACTIVITYTRIGGERINFO
_PBACTIVITYSAMPLES.fields_by_name['inactivity_non_wear_trigger'].message_type = _PBINACTIVITYNONWEARTRIGGERINFO
DESCRIPTOR.message_types_by_name['PbSportInfo'] = _PBSPORTINFO
DESCRIPTOR.message_types_by_name['PbActivityInfo'] = _PBACTIVITYINFO
DESCRIPTOR.message_types_by_name['PbInActivityTriggerInfo'] = _PBINACTIVITYTRIGGERINFO
DESCRIPTOR.message_types_by_name['PbInActivityNonWearTriggerInfo'] = _PBINACTIVITYNONWEARTRIGGERINFO
DESCRIPTOR.message_types_by_name['PbActivitySamples'] = _PBACTIVITYSAMPLES
PbSportInfo = _reflection.GeneratedProtocolMessageType('PbSportInfo', (_message.Message,), dict(
DESCRIPTOR = _PBSPORTINFO,
__module__ = 'act_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbSportInfo)
))
_sym_db.RegisterMessage(PbSportInfo)
PbActivityInfo = _reflection.GeneratedProtocolMessageType('PbActivityInfo', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYINFO,
__module__ = 'act_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivityInfo)
))
_sym_db.RegisterMessage(PbActivityInfo)
PbInActivityTriggerInfo = _reflection.GeneratedProtocolMessageType('PbInActivityTriggerInfo', (_message.Message,), dict(
DESCRIPTOR = _PBINACTIVITYTRIGGERINFO,
__module__ = 'act_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbInActivityTriggerInfo)
))
_sym_db.RegisterMessage(PbInActivityTriggerInfo)
PbInActivityNonWearTriggerInfo = _reflection.GeneratedProtocolMessageType('PbInActivityNonWearTriggerInfo', (_message.Message,), dict(
DESCRIPTOR = _PBINACTIVITYNONWEARTRIGGERINFO,
__module__ = 'act_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbInActivityNonWearTriggerInfo)
))
_sym_db.RegisterMessage(PbInActivityNonWearTriggerInfo)
PbActivitySamples = _reflection.GeneratedProtocolMessageType('PbActivitySamples', (_message.Message,), dict(
DESCRIPTOR = _PBACTIVITYSAMPLES,
__module__ = 'act_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbActivitySamples)
))
_sym_db.RegisterMessage(PbActivitySamples)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/team_member_pb2.py | loophole/polar/pb/team_member_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: team_member.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='team_member.proto',
package='data',
serialized_pb=_b('\n\x11team_member.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\"c\n\x0cPbTeamMember\x12\x17\n\x0fteam_identifier\x18\x01 \x02(\x04\x12\x15\n\rplayer_number\x18\x02 \x01(\r\x12#\n\x0bplayer_role\x18\x03 \x01(\x0b\x32\x0e.PbOneLineText')
,
dependencies=[structures_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBTEAMMEMBER = _descriptor.Descriptor(
name='PbTeamMember',
full_name='data.PbTeamMember',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='team_identifier', full_name='data.PbTeamMember.team_identifier', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='player_number', full_name='data.PbTeamMember.player_number', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='player_role', full_name='data.PbTeamMember.player_role', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=45,
serialized_end=144,
)
_PBTEAMMEMBER.fields_by_name['player_role'].message_type = structures_pb2._PBONELINETEXT
DESCRIPTOR.message_types_by_name['PbTeamMember'] = _PBTEAMMEMBER
PbTeamMember = _reflection.GeneratedProtocolMessageType('PbTeamMember', (_message.Message,), dict(
DESCRIPTOR = _PBTEAMMEMBER,
__module__ = 'team_member_pb2'
# @@protoc_insertion_point(class_scope:data.PbTeamMember)
))
_sym_db.RegisterMessage(PbTeamMember)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/nanopb_pb2.py | loophole/polar/pb/nanopb_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: nanopb.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='nanopb.proto',
package='',
serialized_pb=_b('\n\x0cnanopb.proto\"4\n\rNanoPBOptions\x12\x10\n\x08max_size\x18\x01 \x01(\x05\x12\x11\n\tmax_count\x18\x02 \x01(\x05')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_NANOPBOPTIONS = _descriptor.Descriptor(
name='NanoPBOptions',
full_name='NanoPBOptions',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='max_size', full_name='NanoPBOptions.max_size', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='max_count', full_name='NanoPBOptions.max_count', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=16,
serialized_end=68,
)
DESCRIPTOR.message_types_by_name['NanoPBOptions'] = _NANOPBOPTIONS
NanoPBOptions = _reflection.GeneratedProtocolMessageType('NanoPBOptions', (_message.Message,), dict(
DESCRIPTOR = _NANOPBOPTIONS,
__module__ = 'nanopb_pb2'
# @@protoc_insertion_point(class_scope:NanoPBOptions)
))
_sym_db.RegisterMessage(NanoPBOptions)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_pb2.py | loophole/polar/pb/sportprofile_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import sportprofile_archer_settings_pb2
import sportprofile_guitar_settings_pb2
import sportprofile_avalon_settings_pb2
import sportprofile_maserati_settings_pb2
import sportprofile_ace_settings_pb2
import sportprofile_mclaren_settings_pb2
import structures_pb2
import sportprofile_astra_settings_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile.proto',
package='data',
serialized_pb=_b('\n\x12sportprofile.proto\x12\x04\x64\x61ta\x1a\"sportprofile_archer_settings.proto\x1a\"sportprofile_guitar_settings.proto\x1a\"sportprofile_avalon_settings.proto\x1a$sportprofile_maserati_settings.proto\x1a\x1fsportprofile_ace_settings.proto\x1a#sportprofile_mclaren_settings.proto\x1a\x10structures.proto\x1a!sportprofile_astra_settings.proto\x1a\x0btypes.proto\"E\n\x18PbSirius2TrainingDisplay\x12)\n\x04item\x18\x01 \x03(\x0e\x32\x1b.data.PbTrainingDisplayItem\"\x87\x01\n\x18PbSirius2DisplaySettings\x12/\n\x07\x64isplay\x18\x01 \x03(\x0b\x32\x1e.data.PbSirius2TrainingDisplay\x12\x1a\n\x12last_shown_display\x18\x02 \x01(\r\x12\x1e\n\x16\x61\x64\x64\x65\x64_default_displays\x18\x03 \x01(\r\"\x9c\x02\n\x11PbAutoLapSettings\x12=\n\rautomatic_lap\x18\x01 \x02(\x0e\x32&.data.PbAutoLapSettings.PbAutomaticLap\x12\x1e\n\x16\x61utomatic_lap_distance\x18\x02 \x01(\x02\x12+\n\x16\x61utomatic_lap_duration\x18\x03 \x01(\x0b\x32\x0b.PbDuration\"{\n\x0ePbAutomaticLap\x12\x15\n\x11\x41UTOMATIC_LAP_OFF\x10\x01\x12\x1a\n\x16\x41UTOMATIC_LAP_DISTANCE\x10\x02\x12\x1a\n\x16\x41UTOMATIC_LAP_DURATION\x10\x03\x12\x1a\n\x16\x41UTOMATIC_LAP_LOCATION\x10\x04\"\x92\x03\n\x12PbTrainingReminder\x12\x46\n\rreminder_type\x18\x01 \x02(\x0e\x32/.data.PbTrainingReminder.PbTrainingReminderType\x12%\n\rreminder_text\x18\x02 \x01(\x0b\x32\x0e.PbOneLineText\x12\x1e\n\x16\x63\x61lorie_reminder_value\x18\x03 \x01(\r\x12(\n\x13time_reminder_value\x18\x04 \x01(\x0b\x32\x0b.PbDuration\x12\x1f\n\x17\x64istance_reminder_value\x18\x05 \x01(\x02\"\xa1\x01\n\x16PbTrainingReminderType\x12\x19\n\x15TRAINING_REMINDER_OFF\x10\x01\x12$\n TRAINING_REMINDER_CALORIES_BASED\x10\x02\x12$\n TRAINING_REMINDER_DISTANCE_BASED\x10\x03\x12 \n\x1cTRAINING_REMINDER_TIME_BASED\x10\x04\"\xd2\r\n\x16PbSportProfileSettings\x12\x19\n\x06volume\x18\x01 \x01(\x0b\x32\t.PbVolume\x12<\n\nspeed_view\x18\x02 \x01(\x0e\x32(.data.PbSportProfileSettings.PbSpeedView\x12S\n\x16zone_optimizer_setting\x18\x03 \x01(\x0e\x32\x33.data.PbSportProfileSettings.PbZoneOptimizerSetting\x12)\n\x0fheart_rate_view\x18\x04 \x01(\x0e\x32\x10.PbHeartRateView\x12\x1e\n\x16sensor_broadcasting_hr\x18\x05 \x01(\x08\x12\x1d\n\x0bzone_limits\x18\x06 \x01(\x0b\x32\x08.PbZones\x12\x33\n\x11training_reminder\x18\x07 \x01(\x0b\x32\x18.data.PbTrainingReminder\x12\x16\n\x0evoice_guidance\x18\x08 \x01(\x08\x12>\n\x0bgps_setting\x18\t \x01(\x0e\x32).data.PbSportProfileSettings.PbGPSSetting\x12\x31\n\x10\x61utolap_settings\x18\n \x01(\x0b\x32\x17.data.PbAutoLapSettings\x12H\n\x10\x61ltitude_setting\x18\x0b \x01(\x0e\x32..data.PbSportProfileSettings.PbAltitudeSetting\x12<\n\npower_view\x18\x0c \x01(\x0e\x32(.data.PbSportProfileSettings.PbPowerView\x12i\n\x13stride_speed_source\x18\r \x01(\x0e\x32\x30.data.PbSportProfileSettings.PbStrideSpeedSource:\x1aSTRIDE_SPEED_SOURCE_STRIDE\x12P\n\x15remote_button_actions\x18\x0e \x03(\x0e\x32\x31.data.PbSportProfileSettings.PbRemoteButtonAction\x12\x1e\n\x16hr_zone_lock_available\x18\x0f \x01(\x08\x12!\n\x19speed_zone_lock_available\x18\x10 \x01(\x08\x12!\n\x19power_zone_lock_available\x18\x11 \x01(\x08\x12\x44\n\x0eswimming_units\x18\x12 \x01(\x0e\x32,.data.PbSportProfileSettings.PbSwimmingUnits\"8\n\x0bPbSpeedView\x12\x13\n\x0fSPEED_VIEW_PACE\x10\x01\x12\x14\n\x10SPEED_VIEW_SPEED\x10\x02\"\x86\x01\n\x16PbZoneOptimizerSetting\x12\x15\n\x11ZONEOPTIMIZER_OFF\x10\x01\x12\x1e\n\x1aZONEOPTIMIZER_MODIFIED_OFF\x10\x02\x12\x19\n\x15ZONEOPTIMIZER_DEFAULT\x10\x03\x12\x1a\n\x16ZONEOPTIMIZER_MODIFIED\x10\x04\"?\n\x0cPbGPSSetting\x12\x0b\n\x07GPS_OFF\x10\x00\x12\x11\n\rGPS_ON_NORMAL\x10\x01\x12\x0f\n\x0bGPS_ON_LONG\x10\x02\"6\n\x11PbAltitudeSetting\x12\x10\n\x0c\x41LTITUDE_OFF\x10\x00\x12\x0f\n\x0b\x41LTITUDE_ON\x10\x01\"Z\n\x0bPbPowerView\x12\x13\n\x0fPOWER_VIEW_WATT\x10\x01\x12\x1a\n\x16POWER_VIEW_WATT_PER_KG\x10\x02\x12\x1a\n\x16POWER_VIEW_FTP_PERCENT\x10\x03\"R\n\x13PbStrideSpeedSource\x12\x1e\n\x1aSTRIDE_SPEED_SOURCE_STRIDE\x10\x01\x12\x1b\n\x17STRIDE_SPEED_SOURCE_GPS\x10\x02\"\xc6\x01\n\x14PbRemoteButtonAction\x12\x1b\n\x17REMOTE_BUTTON_RING_BELL\x10\x01\x12$\n REMOTE_BUTTON_ACTIVATE_BACKLIGHT\x10\x02\x12&\n\"REMOTE_BUTTON_CHANGE_TRAINING_VIEW\x10\x03\x12\x1a\n\x16REMOTE_BUTTON_TAKE_LAP\x10\x04\x12\'\n#REMOTE_BUTTON_ACTIVATE_SAFETY_LIGHT\x10\x05\":\n\x0fPbSwimmingUnits\x12\x13\n\x0fSWIMMING_METERS\x10\x00\x12\x12\n\x0eSWIMMING_YARDS\x10\x01\"\xa5\x01\n\x0bPbAutoPause\x12\x35\n\x07trigger\x18\x01 \x02(\x0e\x32$.data.PbAutoPause.PbAutoPauseTrigger\x12\x17\n\x0fspeed_threshold\x18\x02 \x01(\x02\"F\n\x12PbAutoPauseTrigger\x12\x12\n\x0e\x41UTO_PAUSE_OFF\x10\x00\x12\x1c\n\x18\x41UTO_PAUSE_TRIGGER_SPEED\x10\x01\"\xad\x06\n\x0ePbSportProfile\x12\x12\n\nidentifier\x18\x01 \x01(\x04\x12,\n\x10sport_identifier\x18\x02 \x02(\x0b\x32\x12.PbSportIdentifier\x12.\n\x08settings\x18\x03 \x01(\x0b\x32\x1c.data.PbSportProfileSettings\x12@\n\x18sirius2_display_settings\x18\x04 \x01(\x0b\x32\x1e.data.PbSirius2DisplaySettings\x12\x14\n\x0csport_factor\x18\x05 \x01(\x02\x12\x19\n\x11\x61\x65robic_threshold\x18\x06 \x01(\r\x12\x1b\n\x13\x61naerobic_threshold\x18\x07 \x01(\r\x12(\n\rlast_modified\x18\x08 \x02(\x0b\x32\x11.PbSystemDateTime\x12\x18\n\x10sprint_threshold\x18\t \x01(\x02\x12%\n\nauto_pause\x18\n \x01(\x0b\x32\x11.data.PbAutoPause\x12<\n\x0fguitar_settings\x18\xc8\x01 \x01(\x0b\x32\".data.PbGuitarSportProfileSettings\x12>\n\x10mclaren_settings\x18\xc9\x01 \x01(\x0b\x32#.data.PbMcLarenSportProfileSettings\x12\x36\n\x0c\x61\x63\x65_settings\x18\xca\x01 \x01(\x0b\x32\x1f.data.PbAceSportProfileSettings\x12<\n\x0f\x61valon_settings\x18\xcb\x01 \x01(\x0b\x32\".data.PbAvalonSportProfileSettings\x12<\n\x0f\x61rcher_settings\x18\xcc\x01 \x01(\x0b\x32\".data.PbArcherSportProfileSettings\x12:\n\x0e\x61stra_settings\x18\xcd\x01 \x01(\x0b\x32!.data.PbAstraSportProfileSettings\x12@\n\x11maserati_settings\x18\xce\x01 \x01(\x0b\x32$.data.PbMaseratiSportProfileSettings*\x97\x11\n\x15PbTrainingDisplayItem\x12\x0f\n\x0bTIME_OF_DAY\x10\x02\x12\r\n\tSTOPWATCH\x10\x03\x12\x14\n\x10\x43URRENT_LAP_TIME\x10\x06\x12\x11\n\rLAST_LAP_TIME\x10\x07\x12\x1b\n\x17LAST_AUTOMATIC_LAP_TIME\x10\x08\x12\x0c\n\x08\x41LTITUDE\x10\n\x12\n\n\x06\x41SCENT\x10\x0b\x12\x0b\n\x07\x44\x45SCENT\x10\x0c\x12\x10\n\x0cINCLINOMETER\x10\r\x12\x0f\n\x0bTEMPERATURE\x10\x0f\x12\x16\n\x12\x43URRENT_LAP_ASCENT\x10\x10\x12\x17\n\x13\x43URRENT_LAP_DESCENT\x10\x11\x12\x13\n\x0f\x43URRENT_LAP_VAM\x10\x12\x12\x16\n\x12\x43URRENT_HEART_RATE\x10\x14\x12\x16\n\x12\x41VERAGE_HEART_RATE\x10\x15\x12\x16\n\x12MAXIMUM_HEART_RATE\x10\x16\x12\"\n\x1e\x43URRENT_LAP_AVERAGE_HEART_RATE\x10\x18\x12\x1e\n\x1a\x43URRENT_LAP_MAX_HEART_RATE\x10\x19\x12#\n\x1fPREVIOUS_LAP_AVERAGE_HEART_RATE\x10\x1a\x12\x1f\n\x1bPREVIOUS_LAP_MAX_HEART_RATE\x10\x1c\x12\x0c\n\x08\x43\x41LORIES\x10\x1b\x12\x10\n\x0cZONE_POINTER\x10 \x12\x10\n\x0cTIME_IN_ZONE\x10!\x12\x10\n\x0cRR_VARIATION\x10#\x12\x0c\n\x08\x44ISTANCE\x10%\x12\x18\n\x14\x43URRENT_LAP_DISTANCE\x10&\x12\x19\n\x15PREVIOUS_LAP_DISTANCE\x10\'\x12\x11\n\rSPEED_OR_PACE\x10)\x12\x19\n\x15SPEED_OR_PACE_AVERAGE\x10*\x12\x19\n\x15SPEED_OR_PACE_MAXIMUM\x10+\x12\x1d\n\x19\x43URRENT_LAP_SPEED_OR_PACE\x10,\x12\x16\n\x12SPEED_ZONE_POINTER\x10-\x12\x16\n\x12TIME_IN_SPEED_ZONE\x10.\x12!\n\x1d\x43URRENT_LAP_MAX_PACE_OR_SPEED\x10/\x12\"\n\x1ePREVIOUS_LAP_MAX_PACE_OR_SPEED\x10\x30\x12\x1f\n\x1aPREVIOUS_LAP_SPEED_OR_PACE\x10\xdc\x01\x12\"\n\x1dVERTICAL_SPEED_MOVING_AVERAGE\x10\xdd\x01\x12\x0b\n\x07\x43\x41\x44\x45NCE\x10\x31\x12\x13\n\x0f\x41VERAGE_CADENCE\x10\x32\x12\x14\n\x0fMAXIMUM_CADENCE\x10\xf0\x01\x12\x17\n\x13\x43URRENT_LAP_CADENCE\x10\x33\x12\x1b\n\x17\x43URRENT_LAP_MAX_CADENCE\x10\x34\x12\x18\n\x14PREVIOUS_LAP_CADENCE\x10\x35\x12\x11\n\rSTRIDE_LENGTH\x10\x36\x12\x19\n\x15\x41VERAGE_STRIDE_LENGTH\x10\x37\x12\x11\n\rCURRENT_POWER\x10\x38\x12$\n CURRENT_POWER_LEFT_RIGHT_BALANCE\x10\x39\x12\x11\n\rMAXIMUM_FORCE\x10:\x12\x16\n\x12POWER_ZONE_POINTER\x10;\x12\x11\n\rAVERAGE_POWER\x10<\x12\x11\n\rMAXIMUM_POWER\x10=\x12$\n AVERAGE_POWER_LEFT_RIGHT_BALANCE\x10>\x12\x1d\n\x19\x43URRENT_LAP_AVERAGE_POWER\x10?\x12\x1d\n\x19\x43URRENT_LAP_MAXIMUM_POWER\x10@\x12(\n$CURRENT_LAP_AVERAGE_POWER_LR_BALANCE\x10\x41\x12\x16\n\x12TIME_IN_POWER_ZONE\x10\x42\x12\x1e\n\x1aPREVIOUS_LAP_AVERAGE_POWER\x10\x43\x12\x1e\n\x1aPREVIOUS_LAP_MAXIMUM_POWER\x10\x44\x12*\n%PREVIOUS_LAP_AVERAGE_POWER_LR_BALANCE\x10\xe6\x01\x12\r\n\tREST_TIME\x10\x45\x12\x10\n\x0cPOOL_COUNTER\x10\x46\x12\x17\n\x13MULTISPORT_DURATION\x10X\x12\x17\n\x13MULTISPORT_DISTANCE\x10Y\x12\x17\n\x13MULTISPORT_CALORIES\x10Z\x12\x15\n\x11MULTISPORT_ASCENT\x10[\x12\x16\n\x12MULTISPORT_DESCENT\x10\\\x12\x14\n\x10HEART_RATE_ZONES\x10\x64\x12\x1f\n\x1bMULTISPORT_HEART_RATE_ZONES\x10\x65\x12\x12\n\x0eLOCATION_GUIDE\x10\x66\x12\x0f\n\x0bPOWER_ZONES\x10g\x12\x0f\n\x0b\x46ORCE_GRAPH\x10h\x12\x1a\n\x16TIME_BASED_SPEED_ZONES\x10i\x12$\n\x1f\x43URRENT_ALAP_AVERAGE_HEART_RATE\x10\xc8\x01\x12\x16\n\x11\x43URRENT_ALAP_TIME\x10\xc9\x01\x12\x1f\n\x1a\x43URRENT_ALAP_AVERAGE_POWER\x10\xca\x01\x12\x1f\n\x1a\x43URRENT_ALAP_MAXIMUM_POWER\x10\xcb\x01\x12\x1f\n\x1a\x43URRENT_ALAP_SPEED_OR_PACE\x10\xcc\x01\x12\x1a\n\x15\x43URRENT_ALAP_DISTANCE\x10\xcd\x01\x12\x18\n\x13\x43URRENT_ALAP_ASCENT\x10\xce\x01\x12\x19\n\x14\x43URRENT_ALAP_DESCENT\x10\xcf\x01\x12\x19\n\x14\x43URRENT_ALAP_CADENCE\x10\xd0\x01\x12*\n%CURRENT_ALAP_AVERAGE_POWER_LR_BALANCE\x10\xd1\x01\x12 \n\x1b\x43URRENT_ALAP_MAX_HEART_RATE\x10\xd2\x01\x12\x1b\n\x16\x43URRENT_ALAP_MAX_SPEED\x10\xd3\x01\x12\x1d\n\x18\x43URRENT_ALAP_MAX_CADENCE\x10\xd4\x01')
,
dependencies=[sportprofile_archer_settings_pb2.DESCRIPTOR,sportprofile_guitar_settings_pb2.DESCRIPTOR,sportprofile_avalon_settings_pb2.DESCRIPTOR,sportprofile_maserati_settings_pb2.DESCRIPTOR,sportprofile_ace_settings_pb2.DESCRIPTOR,sportprofile_mclaren_settings_pb2.DESCRIPTOR,structures_pb2.DESCRIPTOR,sportprofile_astra_settings_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBTRAININGDISPLAYITEM = _descriptor.EnumDescriptor(
name='PbTrainingDisplayItem',
full_name='data.PbTrainingDisplayItem',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TIME_OF_DAY', index=0, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STOPWATCH', index=1, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_TIME', index=2, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LAST_LAP_TIME', index=3, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LAST_AUTOMATIC_LAP_TIME', index=4, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALTITUDE', index=5, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ASCENT', index=6, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DESCENT', index=7, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INCLINOMETER', index=8, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TEMPERATURE', index=9, number=15,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_ASCENT', index=10, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_DESCENT', index=11, number=17,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_VAM', index=12, number=18,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_HEART_RATE', index=13, number=20,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AVERAGE_HEART_RATE', index=14, number=21,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_HEART_RATE', index=15, number=22,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_AVERAGE_HEART_RATE', index=16, number=24,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_MAX_HEART_RATE', index=17, number=25,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_AVERAGE_HEART_RATE', index=18, number=26,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_MAX_HEART_RATE', index=19, number=28,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CALORIES', index=20, number=27,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ZONE_POINTER', index=21, number=32,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_IN_ZONE', index=22, number=33,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='RR_VARIATION', index=23, number=35,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DISTANCE', index=24, number=37,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_DISTANCE', index=25, number=38,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_DISTANCE', index=26, number=39,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_OR_PACE', index=27, number=41,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_OR_PACE_AVERAGE', index=28, number=42,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_OR_PACE_MAXIMUM', index=29, number=43,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_SPEED_OR_PACE', index=30, number=44,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_ZONE_POINTER', index=31, number=45,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_IN_SPEED_ZONE', index=32, number=46,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_MAX_PACE_OR_SPEED', index=33, number=47,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_MAX_PACE_OR_SPEED', index=34, number=48,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_SPEED_OR_PACE', index=35, number=220,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='VERTICAL_SPEED_MOVING_AVERAGE', index=36, number=221,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CADENCE', index=37, number=49,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AVERAGE_CADENCE', index=38, number=50,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_CADENCE', index=39, number=240,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_CADENCE', index=40, number=51,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_MAX_CADENCE', index=41, number=52,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_CADENCE', index=42, number=53,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STRIDE_LENGTH', index=43, number=54,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AVERAGE_STRIDE_LENGTH', index=44, number=55,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_POWER', index=45, number=56,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_POWER_LEFT_RIGHT_BALANCE', index=46, number=57,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_FORCE', index=47, number=58,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_ZONE_POINTER', index=48, number=59,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AVERAGE_POWER', index=49, number=60,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_POWER', index=50, number=61,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AVERAGE_POWER_LEFT_RIGHT_BALANCE', index=51, number=62,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_AVERAGE_POWER', index=52, number=63,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_MAXIMUM_POWER', index=53, number=64,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_LAP_AVERAGE_POWER_LR_BALANCE', index=54, number=65,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_IN_POWER_ZONE', index=55, number=66,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_AVERAGE_POWER', index=56, number=67,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_MAXIMUM_POWER', index=57, number=68,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PREVIOUS_LAP_AVERAGE_POWER_LR_BALANCE', index=58, number=230,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REST_TIME', index=59, number=69,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POOL_COUNTER', index=60, number=70,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_DURATION', index=61, number=88,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_DISTANCE', index=62, number=89,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_CALORIES', index=63, number=90,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_ASCENT', index=64, number=91,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_DESCENT', index=65, number=92,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_RATE_ZONES', index=66, number=100,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MULTISPORT_HEART_RATE_ZONES', index=67, number=101,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LOCATION_GUIDE', index=68, number=102,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_ZONES', index=69, number=103,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FORCE_GRAPH', index=70, number=104,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_BASED_SPEED_ZONES', index=71, number=105,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_AVERAGE_HEART_RATE', index=72, number=200,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_TIME', index=73, number=201,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_AVERAGE_POWER', index=74, number=202,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_MAXIMUM_POWER', index=75, number=203,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_SPEED_OR_PACE', index=76, number=204,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_DISTANCE', index=77, number=205,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_ASCENT', index=78, number=206,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_DESCENT', index=79, number=207,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_CADENCE', index=80, number=208,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_AVERAGE_POWER_LR_BALANCE', index=81, number=209,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_MAX_HEART_RATE', index=82, number=210,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_MAX_SPEED', index=83, number=211,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CURRENT_ALAP_MAX_CADENCE', index=84, number=212,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3945,
serialized_end=6144,
)
_sym_db.RegisterEnumDescriptor(_PBTRAININGDISPLAYITEM)
PbTrainingDisplayItem = enum_type_wrapper.EnumTypeWrapper(_PBTRAININGDISPLAYITEM)
TIME_OF_DAY = 2
STOPWATCH = 3
CURRENT_LAP_TIME = 6
LAST_LAP_TIME = 7
LAST_AUTOMATIC_LAP_TIME = 8
ALTITUDE = 10
ASCENT = 11
DESCENT = 12
INCLINOMETER = 13
TEMPERATURE = 15
CURRENT_LAP_ASCENT = 16
CURRENT_LAP_DESCENT = 17
CURRENT_LAP_VAM = 18
CURRENT_HEART_RATE = 20
AVERAGE_HEART_RATE = 21
MAXIMUM_HEART_RATE = 22
CURRENT_LAP_AVERAGE_HEART_RATE = 24
CURRENT_LAP_MAX_HEART_RATE = 25
PREVIOUS_LAP_AVERAGE_HEART_RATE = 26
PREVIOUS_LAP_MAX_HEART_RATE = 28
CALORIES = 27
ZONE_POINTER = 32
TIME_IN_ZONE = 33
RR_VARIATION = 35
DISTANCE = 37
CURRENT_LAP_DISTANCE = 38
PREVIOUS_LAP_DISTANCE = 39
SPEED_OR_PACE = 41
SPEED_OR_PACE_AVERAGE = 42
SPEED_OR_PACE_MAXIMUM = 43
CURRENT_LAP_SPEED_OR_PACE = 44
SPEED_ZONE_POINTER = 45
TIME_IN_SPEED_ZONE = 46
CURRENT_LAP_MAX_PACE_OR_SPEED = 47
PREVIOUS_LAP_MAX_PACE_OR_SPEED = 48
PREVIOUS_LAP_SPEED_OR_PACE = 220
VERTICAL_SPEED_MOVING_AVERAGE = 221
CADENCE = 49
AVERAGE_CADENCE = 50
MAXIMUM_CADENCE = 240
CURRENT_LAP_CADENCE = 51
CURRENT_LAP_MAX_CADENCE = 52
PREVIOUS_LAP_CADENCE = 53
STRIDE_LENGTH = 54
AVERAGE_STRIDE_LENGTH = 55
CURRENT_POWER = 56
CURRENT_POWER_LEFT_RIGHT_BALANCE = 57
MAXIMUM_FORCE = 58
POWER_ZONE_POINTER = 59
AVERAGE_POWER = 60
MAXIMUM_POWER = 61
AVERAGE_POWER_LEFT_RIGHT_BALANCE = 62
CURRENT_LAP_AVERAGE_POWER = 63
CURRENT_LAP_MAXIMUM_POWER = 64
CURRENT_LAP_AVERAGE_POWER_LR_BALANCE = 65
TIME_IN_POWER_ZONE = 66
PREVIOUS_LAP_AVERAGE_POWER = 67
PREVIOUS_LAP_MAXIMUM_POWER = 68
PREVIOUS_LAP_AVERAGE_POWER_LR_BALANCE = 230
REST_TIME = 69
POOL_COUNTER = 70
MULTISPORT_DURATION = 88
MULTISPORT_DISTANCE = 89
MULTISPORT_CALORIES = 90
MULTISPORT_ASCENT = 91
MULTISPORT_DESCENT = 92
HEART_RATE_ZONES = 100
MULTISPORT_HEART_RATE_ZONES = 101
LOCATION_GUIDE = 102
POWER_ZONES = 103
FORCE_GRAPH = 104
TIME_BASED_SPEED_ZONES = 105
CURRENT_ALAP_AVERAGE_HEART_RATE = 200
CURRENT_ALAP_TIME = 201
CURRENT_ALAP_AVERAGE_POWER = 202
CURRENT_ALAP_MAXIMUM_POWER = 203
CURRENT_ALAP_SPEED_OR_PACE = 204
CURRENT_ALAP_DISTANCE = 205
CURRENT_ALAP_ASCENT = 206
CURRENT_ALAP_DESCENT = 207
CURRENT_ALAP_CADENCE = 208
CURRENT_ALAP_AVERAGE_POWER_LR_BALANCE = 209
CURRENT_ALAP_MAX_HEART_RATE = 210
CURRENT_ALAP_MAX_SPEED = 211
CURRENT_ALAP_MAX_CADENCE = 212
_PBAUTOLAPSETTINGS_PBAUTOMATICLAP = _descriptor.EnumDescriptor(
name='PbAutomaticLap',
full_name='data.PbAutoLapSettings.PbAutomaticLap',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='AUTOMATIC_LAP_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOMATIC_LAP_DISTANCE', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOMATIC_LAP_DURATION', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOMATIC_LAP_LOCATION', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=681,
serialized_end=804,
)
_sym_db.RegisterEnumDescriptor(_PBAUTOLAPSETTINGS_PBAUTOMATICLAP)
_PBTRAININGREMINDER_PBTRAININGREMINDERTYPE = _descriptor.EnumDescriptor(
name='PbTrainingReminderType',
full_name='data.PbTrainingReminder.PbTrainingReminderType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TRAINING_REMINDER_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TRAINING_REMINDER_CALORIES_BASED', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TRAINING_REMINDER_DISTANCE_BASED', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TRAINING_REMINDER_TIME_BASED', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1048,
serialized_end=1209,
)
_sym_db.RegisterEnumDescriptor(_PBTRAININGREMINDER_PBTRAININGREMINDERTYPE)
_PBSPORTPROFILESETTINGS_PBSPEEDVIEW = _descriptor.EnumDescriptor(
name='PbSpeedView',
full_name='data.PbSportProfileSettings.PbSpeedView',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SPEED_VIEW_PACE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_VIEW_SPEED', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2207,
serialized_end=2263,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBSPEEDVIEW)
_PBSPORTPROFILESETTINGS_PBZONEOPTIMIZERSETTING = _descriptor.EnumDescriptor(
name='PbZoneOptimizerSetting',
full_name='data.PbSportProfileSettings.PbZoneOptimizerSetting',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ZONEOPTIMIZER_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ZONEOPTIMIZER_MODIFIED_OFF', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ZONEOPTIMIZER_DEFAULT', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ZONEOPTIMIZER_MODIFIED', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2266,
serialized_end=2400,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBZONEOPTIMIZERSETTING)
_PBSPORTPROFILESETTINGS_PBGPSSETTING = _descriptor.EnumDescriptor(
name='PbGPSSetting',
full_name='data.PbSportProfileSettings.PbGPSSetting',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='GPS_OFF', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GPS_ON_NORMAL', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='GPS_ON_LONG', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2402,
serialized_end=2465,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBGPSSETTING)
_PBSPORTPROFILESETTINGS_PBALTITUDESETTING = _descriptor.EnumDescriptor(
name='PbAltitudeSetting',
full_name='data.PbSportProfileSettings.PbAltitudeSetting',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ALTITUDE_OFF', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALTITUDE_ON', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2467,
serialized_end=2521,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBALTITUDESETTING)
_PBSPORTPROFILESETTINGS_PBPOWERVIEW = _descriptor.EnumDescriptor(
name='PbPowerView',
full_name='data.PbSportProfileSettings.PbPowerView',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='POWER_VIEW_WATT', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_VIEW_WATT_PER_KG', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_VIEW_FTP_PERCENT', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2523,
serialized_end=2613,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBPOWERVIEW)
_PBSPORTPROFILESETTINGS_PBSTRIDESPEEDSOURCE = _descriptor.EnumDescriptor(
name='PbStrideSpeedSource',
full_name='data.PbSportProfileSettings.PbStrideSpeedSource',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='STRIDE_SPEED_SOURCE_STRIDE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STRIDE_SPEED_SOURCE_GPS', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2615,
serialized_end=2697,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBSTRIDESPEEDSOURCE)
_PBSPORTPROFILESETTINGS_PBREMOTEBUTTONACTION = _descriptor.EnumDescriptor(
name='PbRemoteButtonAction',
full_name='data.PbSportProfileSettings.PbRemoteButtonAction',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='REMOTE_BUTTON_RING_BELL', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOTE_BUTTON_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOTE_BUTTON_CHANGE_TRAINING_VIEW', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOTE_BUTTON_TAKE_LAP', index=3, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='REMOTE_BUTTON_ACTIVATE_SAFETY_LIGHT', index=4, number=5,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2700,
serialized_end=2898,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBREMOTEBUTTONACTION)
_PBSPORTPROFILESETTINGS_PBSWIMMINGUNITS = _descriptor.EnumDescriptor(
name='PbSwimmingUnits',
full_name='data.PbSportProfileSettings.PbSwimmingUnits',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SWIMMING_METERS', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SWIMMING_YARDS', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2900,
serialized_end=2958,
)
_sym_db.RegisterEnumDescriptor(_PBSPORTPROFILESETTINGS_PBSWIMMINGUNITS)
_PBAUTOPAUSE_PBAUTOPAUSETRIGGER = _descriptor.EnumDescriptor(
name='PbAutoPauseTrigger',
full_name='data.PbAutoPause.PbAutoPauseTrigger',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='AUTO_PAUSE_OFF', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTO_PAUSE_TRIGGER_SPEED', index=1, number=1,
options=None,
type=None),
],
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/__init__.py | loophole/polar/pb/__init__.py | python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false | |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_phases_reps_pb2.py | loophole/polar/pb/exercise_phases_reps_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_phases_reps.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import exercise_stats_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_phases_reps.proto',
package='data',
serialized_pb=_b('\n\x1a\x65xercise_phases_reps.proto\x12\x04\x64\x61ta\x1a\x14\x65xercise_stats.proto\x1a\x0btypes.proto\">\n\x1aPbPhaseHeartRateStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\"0\n\x1dPbPhaseStrideLengthStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"\xd7\x04\n\x11PbPhaseRepetition\x12\r\n\x05index\x18\x01 \x02(\r\x12\x1f\n\nsplit_time\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12\x1d\n\x08\x64uration\x18\x03 \x02(\x0b\x32\x0b.PbDuration\x12\x16\n\x0ephase_finished\x18\x04 \x01(\x08\x12\x16\n\x0esplit_distance\x18\x05 \x01(\x02\x12\x10\n\x08\x64istance\x18\x06 \x01(\x02\x12#\n\x0ein_target_zone\x18\x07 \x01(\x0b\x32\x0b.PbDuration\x12\x34\n\nheart_rate\x18\x08 \x01(\x0b\x32 .data.PbPhaseHeartRateStatistics\x12&\n\x05speed\x18\t \x01(\x0b\x32\x17.data.PbSpeedStatistics\x12*\n\x07\x63\x61\x64\x65nce\x18\n \x01(\x0b\x32\x19.data.PbCadenceStatistics\x12&\n\x05power\x18\x0b \x01(\x0b\x32\x17.data.PbPowerStatistics\x12\x37\n\x12left_right_balance\x18\x0c \x01(\x0b\x32\x1b.data.PbLRBalanceStatistics\x12:\n\rstride_length\x18\r \x01(\x0b\x32#.data.PbPhaseStrideLengthStatistics\x12\x14\n\x0cstroke_count\x18\x0e \x01(\r\x12\x15\n\raverage_swolf\x18\x0f \x01(\x02\x12\x17\n\x0fstrokes_per_min\x18\x10 \x01(\r\x12\x0e\n\x06\x61scent\x18\x11 \x01(\x02\x12\x0f\n\x07\x64\x65scent\x18\x12 \x01(\x02\"<\n\x12PbPhaseRepetitions\x12&\n\x05phase\x18\x01 \x03(\x0b\x32\x17.data.PbPhaseRepetition')
,
dependencies=[exercise_stats_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBPHASEHEARTRATESTATISTICS = _descriptor.Descriptor(
name='PbPhaseHeartRateStatistics',
full_name='data.PbPhaseHeartRateStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbPhaseHeartRateStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbPhaseHeartRateStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=71,
serialized_end=133,
)
_PBPHASESTRIDELENGTHSTATISTICS = _descriptor.Descriptor(
name='PbPhaseStrideLengthStatistics',
full_name='data.PbPhaseStrideLengthStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbPhaseStrideLengthStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=135,
serialized_end=183,
)
_PBPHASEREPETITION = _descriptor.Descriptor(
name='PbPhaseRepetition',
full_name='data.PbPhaseRepetition',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='index', full_name='data.PbPhaseRepetition.index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='split_time', full_name='data.PbPhaseRepetition.split_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbPhaseRepetition.duration', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='phase_finished', full_name='data.PbPhaseRepetition.phase_finished', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='split_distance', full_name='data.PbPhaseRepetition.split_distance', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbPhaseRepetition.distance', index=5,
number=6, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='in_target_zone', full_name='data.PbPhaseRepetition.in_target_zone', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate', full_name='data.PbPhaseRepetition.heart_rate', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed', full_name='data.PbPhaseRepetition.speed', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence', full_name='data.PbPhaseRepetition.cadence', index=9,
number=10, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power', full_name='data.PbPhaseRepetition.power', index=10,
number=11, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_right_balance', full_name='data.PbPhaseRepetition.left_right_balance', index=11,
number=12, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length', full_name='data.PbPhaseRepetition.stride_length', index=12,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stroke_count', full_name='data.PbPhaseRepetition.stroke_count', index=13,
number=14, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_swolf', full_name='data.PbPhaseRepetition.average_swolf', index=14,
number=15, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='strokes_per_min', full_name='data.PbPhaseRepetition.strokes_per_min', index=15,
number=16, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ascent', full_name='data.PbPhaseRepetition.ascent', index=16,
number=17, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='descent', full_name='data.PbPhaseRepetition.descent', index=17,
number=18, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=186,
serialized_end=785,
)
_PBPHASEREPETITIONS = _descriptor.Descriptor(
name='PbPhaseRepetitions',
full_name='data.PbPhaseRepetitions',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='phase', full_name='data.PbPhaseRepetitions.phase', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=787,
serialized_end=847,
)
_PBPHASEREPETITION.fields_by_name['split_time'].message_type = types_pb2._PBDURATION
_PBPHASEREPETITION.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBPHASEREPETITION.fields_by_name['in_target_zone'].message_type = types_pb2._PBDURATION
_PBPHASEREPETITION.fields_by_name['heart_rate'].message_type = _PBPHASEHEARTRATESTATISTICS
_PBPHASEREPETITION.fields_by_name['speed'].message_type = exercise_stats_pb2._PBSPEEDSTATISTICS
_PBPHASEREPETITION.fields_by_name['cadence'].message_type = exercise_stats_pb2._PBCADENCESTATISTICS
_PBPHASEREPETITION.fields_by_name['power'].message_type = exercise_stats_pb2._PBPOWERSTATISTICS
_PBPHASEREPETITION.fields_by_name['left_right_balance'].message_type = exercise_stats_pb2._PBLRBALANCESTATISTICS
_PBPHASEREPETITION.fields_by_name['stride_length'].message_type = _PBPHASESTRIDELENGTHSTATISTICS
_PBPHASEREPETITIONS.fields_by_name['phase'].message_type = _PBPHASEREPETITION
DESCRIPTOR.message_types_by_name['PbPhaseHeartRateStatistics'] = _PBPHASEHEARTRATESTATISTICS
DESCRIPTOR.message_types_by_name['PbPhaseStrideLengthStatistics'] = _PBPHASESTRIDELENGTHSTATISTICS
DESCRIPTOR.message_types_by_name['PbPhaseRepetition'] = _PBPHASEREPETITION
DESCRIPTOR.message_types_by_name['PbPhaseRepetitions'] = _PBPHASEREPETITIONS
PbPhaseHeartRateStatistics = _reflection.GeneratedProtocolMessageType('PbPhaseHeartRateStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBPHASEHEARTRATESTATISTICS,
__module__ = 'exercise_phases_reps_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseHeartRateStatistics)
))
_sym_db.RegisterMessage(PbPhaseHeartRateStatistics)
PbPhaseStrideLengthStatistics = _reflection.GeneratedProtocolMessageType('PbPhaseStrideLengthStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBPHASESTRIDELENGTHSTATISTICS,
__module__ = 'exercise_phases_reps_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseStrideLengthStatistics)
))
_sym_db.RegisterMessage(PbPhaseStrideLengthStatistics)
PbPhaseRepetition = _reflection.GeneratedProtocolMessageType('PbPhaseRepetition', (_message.Message,), dict(
DESCRIPTOR = _PBPHASEREPETITION,
__module__ = 'exercise_phases_reps_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseRepetition)
))
_sym_db.RegisterMessage(PbPhaseRepetition)
PbPhaseRepetitions = _reflection.GeneratedProtocolMessageType('PbPhaseRepetitions', (_message.Message,), dict(
DESCRIPTOR = _PBPHASEREPETITIONS,
__module__ = 'exercise_phases_reps_pb2'
# @@protoc_insertion_point(class_scope:data.PbPhaseRepetitions)
))
_sym_db.RegisterMessage(PbPhaseRepetitions)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/planned_route_pb2.py | loophole/polar/pb/planned_route_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: planned_route.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='planned_route.proto',
package='data',
serialized_pb=_b('\n\x13planned_route.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"Y\n\x0cPbRoutePoint\x12\x10\n\x08x_offset\x18\x01 \x02(\x11\x12\x10\n\x08y_offset\x18\x02 \x02(\x11\x12\x13\n\x0btime_offset\x18\x03 \x01(\r\x12\x10\n\x08z_offset\x18\x04 \x01(\x11\"\xbc\x01\n\x0ePbPlannedRoute\x12\x1c\n\x08route_id\x18\x01 \x02(\x0b\x32\n.PbRouteId\x12\x1c\n\x04name\x18\x02 \x02(\x0b\x32\x0e.PbOneLineText\x12\x0e\n\x06length\x18\x03 \x01(\x02\x12#\n\x0estart_location\x18\x04 \x01(\x0b\x32\x0b.PbLocation\x12\x16\n\x0estart_altitude\x18\x05 \x01(\x02\x12!\n\x05point\x18\x06 \x03(\x0b\x32\x12.data.PbRoutePoint')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBROUTEPOINT = _descriptor.Descriptor(
name='PbRoutePoint',
full_name='data.PbRoutePoint',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='x_offset', full_name='data.PbRoutePoint.x_offset', index=0,
number=1, type=17, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='y_offset', full_name='data.PbRoutePoint.y_offset', index=1,
number=2, type=17, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_offset', full_name='data.PbRoutePoint.time_offset', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='z_offset', full_name='data.PbRoutePoint.z_offset', index=3,
number=4, type=17, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=60,
serialized_end=149,
)
_PBPLANNEDROUTE = _descriptor.Descriptor(
name='PbPlannedRoute',
full_name='data.PbPlannedRoute',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='route_id', full_name='data.PbPlannedRoute.route_id', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='data.PbPlannedRoute.name', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='length', full_name='data.PbPlannedRoute.length', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_location', full_name='data.PbPlannedRoute.start_location', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_altitude', full_name='data.PbPlannedRoute.start_altitude', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='point', full_name='data.PbPlannedRoute.point', index=5,
number=6, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=152,
serialized_end=340,
)
_PBPLANNEDROUTE.fields_by_name['route_id'].message_type = structures_pb2._PBROUTEID
_PBPLANNEDROUTE.fields_by_name['name'].message_type = structures_pb2._PBONELINETEXT
_PBPLANNEDROUTE.fields_by_name['start_location'].message_type = types_pb2._PBLOCATION
_PBPLANNEDROUTE.fields_by_name['point'].message_type = _PBROUTEPOINT
DESCRIPTOR.message_types_by_name['PbRoutePoint'] = _PBROUTEPOINT
DESCRIPTOR.message_types_by_name['PbPlannedRoute'] = _PBPLANNEDROUTE
PbRoutePoint = _reflection.GeneratedProtocolMessageType('PbRoutePoint', (_message.Message,), dict(
DESCRIPTOR = _PBROUTEPOINT,
__module__ = 'planned_route_pb2'
# @@protoc_insertion_point(class_scope:data.PbRoutePoint)
))
_sym_db.RegisterMessage(PbRoutePoint)
PbPlannedRoute = _reflection.GeneratedProtocolMessageType('PbPlannedRoute', (_message.Message,), dict(
DESCRIPTOR = _PBPLANNEDROUTE,
__module__ = 'planned_route_pb2'
# @@protoc_insertion_point(class_scope:data.PbPlannedRoute)
))
_sym_db.RegisterMessage(PbPlannedRoute)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/swimming_samples_pb2.py | loophole/polar/pb/swimming_samples_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: swimming_samples.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='swimming_samples.proto',
package='data',
serialized_pb=_b('\n\x16swimming_samples.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"X\n\x15PbSwimmingStyleChange\x12\x1f\n\x05style\x18\x01 \x02(\x0e\x32\x10.PbSwimmingStyle\x12\x1e\n\ttimestamp\x18\x02 \x02(\x0b\x32\x0b.PbDuration\"\x8a\x01\n\x14PbSwimmingPoolMetric\x12!\n\x0cstart_offset\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x1d\n\x08\x64uration\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12\x1f\n\x05style\x18\x03 \x01(\x0e\x32\x10.PbSwimmingStyle\x12\x0f\n\x07strokes\x18\x04 \x01(\r\"e\n\x11PbSwimmingSamples\x12\x1f\n\x05start\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12/\n\x0bpool_metric\x18\x03 \x03(\x0b\x32\x1a.data.PbSwimmingPoolMetric')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBSWIMMINGSTYLECHANGE = _descriptor.Descriptor(
name='PbSwimmingStyleChange',
full_name='data.PbSwimmingStyleChange',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='style', full_name='data.PbSwimmingStyleChange.style', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=-1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='timestamp', full_name='data.PbSwimmingStyleChange.timestamp', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=45,
serialized_end=133,
)
_PBSWIMMINGPOOLMETRIC = _descriptor.Descriptor(
name='PbSwimmingPoolMetric',
full_name='data.PbSwimmingPoolMetric',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_offset', full_name='data.PbSwimmingPoolMetric.start_offset', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbSwimmingPoolMetric.duration', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='style', full_name='data.PbSwimmingPoolMetric.style', index=2,
number=3, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=-1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='strokes', full_name='data.PbSwimmingPoolMetric.strokes', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=136,
serialized_end=274,
)
_PBSWIMMINGSAMPLES = _descriptor.Descriptor(
name='PbSwimmingSamples',
full_name='data.PbSwimmingSamples',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start', full_name='data.PbSwimmingSamples.start', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='pool_metric', full_name='data.PbSwimmingSamples.pool_metric', index=1,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=276,
serialized_end=377,
)
_PBSWIMMINGSTYLECHANGE.fields_by_name['style'].enum_type = types_pb2._PBSWIMMINGSTYLE
_PBSWIMMINGSTYLECHANGE.fields_by_name['timestamp'].message_type = types_pb2._PBDURATION
_PBSWIMMINGPOOLMETRIC.fields_by_name['start_offset'].message_type = types_pb2._PBDURATION
_PBSWIMMINGPOOLMETRIC.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBSWIMMINGPOOLMETRIC.fields_by_name['style'].enum_type = types_pb2._PBSWIMMINGSTYLE
_PBSWIMMINGSAMPLES.fields_by_name['start'].message_type = types_pb2._PBLOCALDATETIME
_PBSWIMMINGSAMPLES.fields_by_name['pool_metric'].message_type = _PBSWIMMINGPOOLMETRIC
DESCRIPTOR.message_types_by_name['PbSwimmingStyleChange'] = _PBSWIMMINGSTYLECHANGE
DESCRIPTOR.message_types_by_name['PbSwimmingPoolMetric'] = _PBSWIMMINGPOOLMETRIC
DESCRIPTOR.message_types_by_name['PbSwimmingSamples'] = _PBSWIMMINGSAMPLES
PbSwimmingStyleChange = _reflection.GeneratedProtocolMessageType('PbSwimmingStyleChange', (_message.Message,), dict(
DESCRIPTOR = _PBSWIMMINGSTYLECHANGE,
__module__ = 'swimming_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbSwimmingStyleChange)
))
_sym_db.RegisterMessage(PbSwimmingStyleChange)
PbSwimmingPoolMetric = _reflection.GeneratedProtocolMessageType('PbSwimmingPoolMetric', (_message.Message,), dict(
DESCRIPTOR = _PBSWIMMINGPOOLMETRIC,
__module__ = 'swimming_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbSwimmingPoolMetric)
))
_sym_db.RegisterMessage(PbSwimmingPoolMetric)
PbSwimmingSamples = _reflection.GeneratedProtocolMessageType('PbSwimmingSamples', (_message.Message,), dict(
DESCRIPTOR = _PBSWIMMINGSAMPLES,
__module__ = 'swimming_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbSwimmingSamples)
))
_sym_db.RegisterMessage(PbSwimmingSamples)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/types_pb2.py | loophole/polar/pb/types_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: types.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='types.proto',
package='',
syntax='proto2',
serialized_pb=_b('\n\x0btypes.proto\"6\n\x0ePbRangeOptions\x12\x11\n\tmin_value\x18\x01 \x01(\x05\x12\x11\n\tmax_value\x18\x02 \x01(\x05\"2\n\x06PbDate\x12\x0c\n\x04year\x18\x01 \x02(\r\x12\r\n\x05month\x18\x02 \x02(\r\x12\x0b\n\x03\x64\x61y\x18\x03 \x02(\r\"J\n\x06PbTime\x12\x0c\n\x04hour\x18\x01 \x02(\r\x12\x0e\n\x06minute\x18\x02 \x02(\r\x12\x0f\n\x07seconds\x18\x03 \x02(\r\x12\x11\n\x06millis\x18\x04 \x01(\r:\x01\x30\"Q\n\x10PbSystemDateTime\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x0f\n\x07trusted\x18\x03 \x02(\x08\"s\n\x0fPbLocalDateTime\x12\x15\n\x04\x64\x61te\x18\x01 \x02(\x0b\x32\x07.PbDate\x12\x15\n\x04time\x18\x02 \x02(\x0b\x32\x07.PbTime\x12\x18\n\x10OBSOLETE_trusted\x18\x03 \x02(\x08\x12\x18\n\x10time_zone_offset\x18\x04 \x01(\x05\"Y\n\nPbDuration\x12\x10\n\x05hours\x18\x01 \x01(\r:\x01\x30\x12\x12\n\x07minutes\x18\x02 \x01(\r:\x01\x30\x12\x12\n\x07seconds\x18\x03 \x01(\r:\x01\x30\x12\x11\n\x06millis\x18\x04 \x01(\r:\x01\x30\"\xc3\x01\n\nPbLocation\x12\x10\n\x08latitude\x18\x01 \x02(\x01\x12\x11\n\tlongitude\x18\x02 \x02(\x01\x12$\n\ttimestamp\x18\x03 \x01(\x0b\x32\x11.PbSystemDateTime\x12&\n\x03\x66ix\x18\x04 \x01(\x0e\x32\x0f.PbLocation.Fix:\x08\x46IX_NONE\x12\x15\n\nsatellites\x18\x05 \x01(\r:\x01\x30\"+\n\x03\x46ix\x12\x0c\n\x08\x46IX_NONE\x10\x00\x12\n\n\x06\x46IX_2D\x10\x01\x12\n\n\x06\x46IX_3D\x10\x02\":\n\x0fPbSensorOffline\x12\x13\n\x0bstart_index\x18\x01 \x02(\r\x12\x12\n\nstop_index\x18\x02 \x02(\r\"\x1a\n\x08PbVolume\x12\x0e\n\x06volume\x18\x01 \x02(\r\"\xc7\x03\n\x1bPbStrideSensorCalibSettings\x12\x16\n\x0erunning_factor\x18\x01 \x02(\x02\x12\x42\n\ncalib_type\x18\x02 \x02(\x0e\x32..PbStrideSensorCalibSettings.PbStrideCalibType\x12p\n\x15running_factor_source\x18\x03 \x01(\x0e\x32\x32.PbStrideSensorCalibSettings.PbRunningFactorSource:\x1dRUNNING_FACTOR_SOURCE_DEFAULT\"C\n\x11PbStrideCalibType\x12\x17\n\x13STRIDE_CALIB_MANUAL\x10\x00\x12\x15\n\x11STRIDE_CALIB_AUTO\x10\x01\"\x94\x01\n\x15PbRunningFactorSource\x12!\n\x1dRUNNING_FACTOR_SOURCE_DEFAULT\x10\x00\x12*\n&RUNNING_FACTOR_SOURCE_AUTO_CALIBRATION\x10\x01\x12,\n(RUNNING_FACTOR_SOURCE_MANUAL_CALIBRATION\x10\x02\"x\n\x06PbWeek\x12\x1b\n\x13week_number_ISO8601\x18\x01 \x02(\r\x12\x0c\n\x04year\x18\x02 \x02(\r\x12\x18\n\x10time_zone_offset\x18\x03 \x02(\x05\x12)\n\x0eweek_start_day\x18\x04 \x02(\x0e\x32\x11.PbStartDayOfWeek\"j\n\x0ePbSampleSource\x12/\n\x12sample_source_type\x18\x01 \x02(\x0e\x32\x13.PbSampleSourceType\x12\x13\n\x0bstart_index\x18\x02 \x02(\r\x12\x12\n\nstop_index\x18\x03 \x02(\r\"f\n\x19PbSensorCalibrationOffset\x12/\n\x12sample_source_type\x18\x01 \x02(\x0e\x32\x13.PbSampleSourceType\x12\x18\n\x10speed_cal_offset\x18\x02 \x01(\x02\"\x81\x01\n\x15PbCalibrationSettings\x12\"\n\x0bsample_type\x18\x01 \x02(\x0e\x32\r.PbSampleType\x12\x1b\n\x13\x63\x61libration_enabled\x18\x02 \x01(\x08\x12\'\n\x1f\x63\x61libration_calculation_enabled\x18\x03 \x01(\x08\"~\n\x15PbAccelerationMetrics\x12/\n\x12sample_source_type\x18\x01 \x02(\x0e\x32\x13.PbSampleSourceType\x12\x34\n\x14\x63\x61libration_settings\x18\x02 \x03(\x0b\x32\x16.PbCalibrationSettings\"\xa0\x01\n\x0bPbAutoPause\x12\x30\n\x07trigger\x18\x01 \x02(\x0e\x32\x1f.PbAutoPause.PbAutoPauseTrigger\x12\x17\n\x0fspeed_threshold\x18\x02 \x01(\x02\"F\n\x12PbAutoPauseTrigger\x12\x12\n\x0e\x41UTO_PAUSE_OFF\x10\x00\x12\x1c\n\x18\x41UTO_PAUSE_TRIGGER_SPEED\x10\x01\"\x97\x02\n\x11PbAutoLapSettings\x12\x38\n\rautomatic_lap\x18\x01 \x02(\x0e\x32!.PbAutoLapSettings.PbAutomaticLap\x12\x1e\n\x16\x61utomatic_lap_distance\x18\x02 \x01(\x02\x12+\n\x16\x61utomatic_lap_duration\x18\x03 \x01(\x0b\x32\x0b.PbDuration\"{\n\x0ePbAutomaticLap\x12\x15\n\x11\x41UTOMATIC_LAP_OFF\x10\x01\x12\x1a\n\x16\x41UTOMATIC_LAP_DISTANCE\x10\x02\x12\x1a\n\x16\x41UTOMATIC_LAP_DURATION\x10\x03\x12\x1a\n\x16\x41UTOMATIC_LAP_LOCATION\x10\x04\"<\n\x0cPbCardioLoad\x12\x15\n\ractivity_load\x18\x01 \x02(\x02\x12\x15\n\rexercise_load\x18\x02 \x02(\x02\"U\n\x0fPbPerceivedLoad\x12\x30\n\x0bsession_rpe\x18\x01 \x02(\x0e\x32\r.PbSessionRPE:\x0cRPE_MODERATE\x12\x10\n\x08\x64uration\x18\x02 \x02(\r*\x97\x07\n\nPbDataType\x12\r\n\tUNDEFINED\x10\x00\x12\r\n\tINHERITED\x10\x01\x12\x08\n\x04\x45NUM\x10\x02\x12\n\n\x06MILLIS\x10\x03\x12\n\n\x06SECOND\x10\x04\x12\n\n\x06MINUTE\x10\x05\x12\x08\n\x04HOUR\x10\x06\x12\t\n\x05HOURS\x10\x07\x12\x07\n\x03\x44\x41Y\x10\x08\x12\t\n\x05MONTH\x10\t\x12\x08\n\x04YEAR\x10\n\x12\n\n\x06WEIGHT\x10\x0b\x12\n\n\x06HEIGHT\x10\x0c\x12\n\n\x06VO2MAX\x10\r\x12\r\n\tHEARTRATE\x10\x14\x12\x0e\n\nHR_PERCENT\x10\x15\x12\x0e\n\nHR_RESERVE\x10\x16\x12\t\n\x05SPEED\x10\x17\x12\x0b\n\x07\x43\x41\x44\x45NCE\x10\x18\x12\x0c\n\x08\x41LTITUDE\x10\x19\x12\t\n\x05POWER\x10\x1a\x12\r\n\tPOWER_LRB\x10\x1b\x12\x0c\n\x08POWER_PI\x10\x1c\x12\x0f\n\x0bTEMPERATURE\x10\x1d\x12\x0c\n\x08\x41\x43TIVITY\x10\x1e\x12\x11\n\rSTRIDE_LENGTH\x10\x1f\x12\x0b\n\x07INCLINE\x10 \x12\x0b\n\x07\x44\x45\x43LINE\x10!\x12\x0c\n\x08\x44ISTANCE\x10\x34\x12\n\n\x06\x45NERGY\x10\x35\x12\x10\n\x0c\x46\x41T_PERCENTS\x10\x36\x12\n\n\x06\x41SCENT\x10\x37\x12\x0b\n\x07\x44\x45SCENT\x10\x38\x12\x0c\n\x08LATITUDE\x10\x39\x12\r\n\tLONGITUDE\x10:\x12\t\n\x05HERTZ\x10;\x12\x0b\n\x07PERCENT\x10<\x12\x1a\n\x16\x43UMULATED_ACTIVITY_DAY\x10=\x12\x11\n\rRUNNING_INDEX\x10>\x12\x0f\n\x0bRR_INTERVAL\x10?\x12\x0b\n\x07Z_INDEX\x10@\x12\x19\n\x15\x45XERCISE_TARGET_INDEX\x10\x41\x12\x14\n\x10TIME_ZONE_OFFSET\x10\x42\x12\x0e\n\nWHEEL_SIZE\x10\x43\x12\x11\n\rFITNESS_CLASS\x10\x44\x12\x10\n\x0c\x41\x43\x43\x45LERATION\x10\x45\x12\x10\n\x0c\x43RANK_LENGTH\x10\x46\x12\x10\n\x0c\x41NGLE_DEGREE\x10G\x12\n\n\x06NEWTON\x10H\x12\x1e\n\x1a\x46UNCTIONAL_THRESHOLD_POWER\x10I\x12\x0c\n\x08\x43\x41LORIES\x10J\x12\x1c\n\x18SPEED_CALIBRATION_OFFSET\x10K\x12\x08\n\x04WEEK\x10L\x12\x0f\n\x0b\x43\x41RDIO_LOAD\x10M\x12\x19\n\x15MAXIMUM_AEROBIC_POWER\x10N\x12\x19\n\x15MAXIMUM_AEROBIC_SPEED\x10O\x12\x0f\n\x0bMUSCLE_LOAD\x10P\x12\x12\n\x0ePERCEIVED_LOAD\x10Q*~\n\x0fPbHeartRateView\x12\x17\n\x13HEART_RATE_VIEW_BPM\x10\x01\x12*\n&HEART_RATE_VIEW_PERCENTS_OF_HR_RESERVE\x10\x02\x12&\n\"HEART_RATE_VIEW_PERCENTS_OF_MAX_HR\x10\x03*(\n\x0cPbUnitSystem\x12\n\n\x06METRIC\x10\x01\x12\x0c\n\x08IMPERIAL\x10\x02*)\n\x0fPbTimeSelection\x12\n\n\x06TIME_1\x10\x01\x12\n\n\x06TIME_2\x10\x02*8\n\x0cPbTimeFormat\x12\x13\n\x0fTIME_FORMAT_24H\x10\x01\x12\x13\n\x0fTIME_FORMAT_12H\x10\x02*W\n\x15PbTimeFormatSeparator\x12\x1d\n\x19TIME_FORMAT_SEPARATOR_DOT\x10\x01\x12\x1f\n\x1bTIME_FORMAT_SEPARATOR_COLON\x10\x02*8\n\x10PbStartDayOfWeek\x12\n\n\x06MONDAY\x10\x01\x12\x0c\n\x08SATURDAY\x10\x02\x12\n\n\x06SUNDAY\x10\x03*7\n\x15PbDateFormatSeparator\x12\x07\n\x03\x44OT\x10\x01\x12\t\n\x05SLASH\x10\x02\x12\n\n\x06HYPHEN\x10\x03*>\n\x0cPbDateFormat\x12\x0e\n\nDD_MM_YYYY\x10\x01\x12\x0e\n\nMM_DD_YYYY\x10\x02\x12\x0e\n\nYYYY_MM_DD\x10\x03*\xe8\x07\n\rPbFeatureType\x12\x1b\n\x17\x46\x45\x41TURE_TYPE_HEART_RATE\x10\x01\x12\x1c\n\x18\x46\x45\x41TURE_TYPE_RR_INTERVAL\x10\x02\x12\x16\n\x12\x46\x45\x41TURE_TYPE_SPEED\x10\x03\x12\x19\n\x15\x46\x45\x41TURE_TYPE_DISTANCE\x10\x04\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_BIKE_CADENCE\x10\x05\x12\x1b\n\x17\x46\x45\x41TURE_TYPE_BIKE_POWER\x10\x06\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_GPS_LOCATION\x10\x07\x12 \n\x1c\x46\x45\x41TURE_TYPE_RUNNING_CADENCE\x10\x08\x12\"\n\x1e\x46\x45\x41TURE_TYPE_PRESS_TEMPERATURE\x10\t\x12\x19\n\x15\x46\x45\x41TURE_TYPE_ALTITUDE\x10\n\x12\x16\n\x12\x46\x45\x41TURE_TYPE_STEPS\x10\x0b\x12\x19\n\x15\x46\x45\x41TURE_TYPE_ACTIVITY\x10\x0c\x12\x1e\n\x1a\x46\x45\x41TURE_TYPE_STRIDE_LENGTH\x10\r\x12 \n\x1c\x46\x45\x41TURE_TYPE_RSC_MOVING_TYPE\x10\x0e\x12\x1c\n\x18\x46\x45\x41TURE_TYPE_JUMP_HEIGTH\x10\x0f\x12 \n\x1c\x46\x45\x41TURE_TYPE_COMPASS_HEADING\x10\x10\x12\x1a\n\x16\x46\x45\x41TURE_TYPE_GPS_SPEED\x10\x11\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_GPS_DISTANCE\x10\x12\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_GPS_ALTITUDE\x10\x13\x12&\n\"FEATURE_TYPE_BIKE_WHEEL_REVOLUTION\x10\x14\x12&\n\"FEATURE_TYPE_BIKE_CRANK_REVOLUTION\x10\x15\x12\x19\n\x15\x46\x45\x41TURE_TYPE_AS_SPEED\x10\x16\x12\x1b\n\x17\x46\x45\x41TURE_TYPE_AS_CADENCE\x10\x17\x12\x1c\n\x18\x46\x45\x41TURE_TYPE_AS_DISTANCE\x10\x18\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_AS_SWR_STATE\x10\x19\x12\x1e\n\x1a\x46\x45\x41TURE_TYPE_BATTERY_LEVEL\x10\x1a\x12\x1e\n\x1a\x46\x45\x41TURE_TYPE_FILE_TRANSFER\x10\x1b\x12#\n\x1f\x46\x45\x41TURE_TYPE_PUSH_NOTIFICATIONS\x10\x1c\x12\x1d\n\x19\x46\x45\x41TURE_TYPE_WEIGHT_SCALE\x10\x1d\x12\x1f\n\x1b\x46\x45\x41TURE_TYPE_REMOTE_BUTTONS\x10\x1e\x12\x16\n\x12\x46\x45\x41TURE_TYPE_GOPRO\x10\x1f\x12\x1c\n\x18\x46\x45\x41TURE_TYPE_PP_INTERVAL\x10 *6\n\x0cPbMovingType\x12\x0b\n\x07WALKING\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\x0c\n\x08STANDING\x10\x02*(\n\x0fPbOperationType\x12\x0c\n\x08MULTIPLY\x10\x01\x12\x07\n\x03SUM\x10\x02*\xbf\x02\n\x12PbExerciseFeedback\x12\x11\n\rFEEDBACK_NONE\x10\x01\x12\x0e\n\nFEEDBACK_1\x10\x02\x12\x0e\n\nFEEDBACK_2\x10\x03\x12\x0e\n\nFEEDBACK_3\x10\x04\x12\x0e\n\nFEEDBACK_4\x10\x05\x12\x0e\n\nFEEDBACK_5\x10\x06\x12\x0e\n\nFEEDBACK_6\x10\x07\x12\x0e\n\nFEEDBACK_7\x10\x08\x12\x0e\n\nFEEDBACK_8\x10\t\x12\x0e\n\nFEEDBACK_9\x10\n\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_10\x10\x0b\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_11\x10\x0c\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_12\x10\r\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_13\x10\x0e\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_14\x10\x0f\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_15\x10\x10\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_16\x10\x11\x12\x0f\n\x0b\x46\x45\x45\x44\x42\x41\x43K_17\x10\x12*\xa1\x01\n\x1cPbHeartRateZoneSettingSource\x12*\n&HEART_RATE_ZONE_SETTING_SOURCE_DEFAULT\x10\x00\x12,\n(HEART_RATE_ZONE_SETTING_SOURCE_THRESHOLD\x10\x01\x12\'\n#HEART_RATE_ZONE_SETTING_SOURCE_FREE\x10\x02*e\n\x18PbPowerZoneSettingSource\x12%\n!POWER_ZONE_SETTING_SOURCE_DEFAULT\x10\x00\x12\"\n\x1ePOWER_ZONE_SETTING_SOURCE_FREE\x10\x01*e\n\x18PbSpeedZoneSettingSource\x12%\n!SPEED_ZONE_SETTING_SOURCE_DEFAULT\x10\x00\x12\"\n\x1eSPEED_ZONE_SETTING_SOURCE_FREE\x10\x01*\x93\x01\n\tPbMacType\x12\x13\n\x0fMAC_TYPE_PUBLIC\x10\x00\x12\x13\n\x0fMAC_TYPE_STATIC\x10\x01\x12\"\n\x1eMAC_TYPE_PRIVATE_NONRESOLVABLE\x10\x02\x12\x1f\n\x1bMAC_TYPE_PRIVATE_RESOLVABLE\x10\x03\x12\x17\n\x13MAC_TYPE_BT_CLASSIC\x10\x04*\x8e\x01\n\x0fPbSwimmingStyle\x12\x12\n\x05OTHER\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x08\n\x04TURN\x10\x00\x12\x12\n\x0eOTHER_SWIMMING\x10\n\x12\r\n\tFREESTYLE\x10\x0b\x12\x10\n\x0c\x42REASTSTROKE\x10\x0c\x12\x0e\n\nBACKSTROKE\x10\r\x12\r\n\tBUTTERFLY\x10\x0e\x12\t\n\x05\x44RILL\x10\x0f*H\n\x13PbSwimmingPoolUnits\x12\x18\n\x14SWIMMING_POOL_METERS\x10\x00\x12\x17\n\x13SWIMMING_POOL_YARDS\x10\x01*\xc1\x02\n\x14PbExerciseTargetType\x12\x1d\n\x19\x45XERCISE_TARGET_TYPE_FREE\x10\x00\x12\x1f\n\x1b\x45XERCISE_TARGET_TYPE_VOLUME\x10\x01\x12\x1f\n\x1b\x45XERCISE_TARGET_TYPE_PHASED\x10\x02\x12\x1e\n\x1a\x45XERCISE_TARGET_TYPE_ROUTE\x10\x03\x12)\n%EXERCISE_TARGET_TYPE_STEADY_RACE_PACE\x10\x04\x12(\n$EXERCISE_TARGET_TYPE_ROUTE_RACE_PACE\x10\x05\x12\'\n#EXERCISE_TARGET_TYPE_STRAVA_SEGMENT\x10\x06\x12*\n&EXERCISE_TARGET_TYPE_STRENGTH_TRAINING\x10\x07*^\n\x07\x42uttons\x12\x0f\n\x0b\x42UTTON_PLUS\x10\x00\x12\x10\n\x0c\x42UTTON_MINUS\x10\x01\x12\r\n\tBUTTON_OK\x10\x02\x12\x10\n\x0c\x42UTTON_LIGHT\x10\x03\x12\x0f\n\x0b\x42UTTON_BACK\x10\x04*6\n\x0b\x42uttonState\x12\x12\n\x0e\x42UTTON_PRESSED\x10\x00\x12\x13\n\x0f\x42UTTON_RELEASED\x10\x01*\xd3\x04\n\x0cPbSampleType\x12\x19\n\x15SAMPLE_TYPE_UNDEFINED\x10\x00\x12\x1a\n\x16SAMPLE_TYPE_HEART_RATE\x10\x01\x12\x17\n\x13SAMPLE_TYPE_CADENCE\x10\x02\x12\x18\n\x14SAMPLE_TYPE_ALTITUDE\x10\x03\x12$\n SAMPLE_TYPE_ALTITUDE_CALIBRATION\x10\x04\x12\x1b\n\x17SAMPLE_TYPE_TEMPERATURE\x10\x05\x12\x15\n\x11SAMPLE_TYPE_SPEED\x10\x06\x12\x18\n\x14SAMPLE_TYPE_DISTANCE\x10\x07\x12\x1d\n\x19SAMPLE_TYPE_STRIDE_LENGTH\x10\x08\x12\"\n\x1eSAMPLE_TYPE_STRIDE_CALIBRATION\x10\t\x12$\n SAMPLE_TYPE_FORWARD_ACCELERATION\x10\n\x12\x1b\n\x17SAMPLE_TYPE_MOVING_TYPE\x10\x0b\x12 \n\x1cSAMPLE_TYPE_LEFT_PEDAL_POWER\x10\x0c\x12!\n\x1dSAMPLE_TYPE_RIGHT_PEDAL_POWER\x10\r\x12,\n(SAMPLE_TYPE_LEFT_PEDAL_POWER_CALIBRATION\x10\x0e\x12-\n)SAMPLE_TYPE_RIGHT_PEDAL_POWER_CALIBRATION\x10\x0f\x12\x1b\n\x17SAMPLE_TYPE_RR_INTERVAL\x10\x10\x12 \n\x1cSAMPLE_TYPE_ACCELERATION_MAD\x10\x11*\x82\x05\n\x12PbSampleSourceType\x12 \n\x1cSAMPLE_SOURCE_TYPE_UNDEFINED\x10\x00\x12\x1e\n\x1aSAMPLE_SOURCE_TYPE_OFFLINE\x10\x01\x12!\n\x1dSAMPLE_SOURCE_TYPE_HEART_RATE\x10\x02\x12%\n!SAMPLE_SOURCE_TYPE_HEART_RATE_BLE\x10\x03\x12\'\n#SAMPLE_SOURCE_TYPE_HEART_RATE_5_KHZ\x10\x04\x12)\n%SAMPLE_SOURCE_TYPE_HEART_RATE_OPTICAL\x10\x05\x12\x1a\n\x16SAMPLE_SOURCE_TYPE_GPS\x10\x06\x12\x1d\n\x19SAMPLE_SOURCE_TYPE_STRIDE\x10\x07\x12$\n SAMPLE_SOURCE_TYPE_WRIST_METRICS\x10\x08\x12$\n SAMPLE_SOURCE_TYPE_CHEST_METRICS\x10\t\x12!\n\x1dSAMPLE_SOURCE_TYPE_BIKE_PEDAL\x10\n\x12!\n\x1dSAMPLE_SOURCE_TYPE_BIKE_WHEEL\x10\x0b\x12!\n\x1dSAMPLE_SOURCE_TYPE_BIKE_CRANK\x10\x0c\x12\x35\n1SAMPLE_SOURCE_TYPE_COMBINED_CHEST_METRICS_AND_GPS\x10\r\x12)\n%SAMPLE_SOURCE_TYPE_UPPER_BACK_METRICS\x10\x0e\x12:\n6SAMPLE_SOURCE_TYPE_COMBINED_UPPER_BACK_METRICS_AND_GPS\x10\x0f*6\n\x11PbAltitudeSetting\x12\x10\n\x0c\x41LTITUDE_OFF\x10\x00\x12\x0f\n\x0b\x41LTITUDE_ON\x10\x01*d\n\x0cPbGPSSetting\x12\x0b\n\x07GPS_OFF\x10\x00\x12\x11\n\rGPS_ON_NORMAL\x10\x01\x12\x0f\n\x0bGPS_ON_LONG\x10\x02\x12\x10\n\x0cGPS_ON_10_HZ\x10\x03\x12\x11\n\rGPS_ON_MEDIUM\x10\x04*\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04*\x88\x01\n\x11PbTapButtonAction\x12\x12\n\x0eTAP_BUTTON_OFF\x10\x01\x12\x17\n\x13TAP_BUTTON_TAKE_LAP\x10\x02\x12#\n\x1fTAP_BUTTON_CHANGE_TRAINING_VIEW\x10\x03\x12!\n\x1dTAP_BUTTON_ACTIVATE_BACKLIGHT\x10\x04*M\n\x0cPbHandedness\x12\x13\n\x0fWU_IN_LEFT_HAND\x10\x01\x12\x14\n\x10WU_IN_RIGHT_HAND\x10\x02\x12\x12\n\x0eWU_IN_NECKLACE\x10\x03*\xd7\x03\n\x10PbDeviceLocation\x12\x1d\n\x19\x44\x45VICE_LOCATION_UNDEFINED\x10\x00\x12\x19\n\x15\x44\x45VICE_LOCATION_OTHER\x10\x01\x12\x1e\n\x1a\x44\x45VICE_LOCATION_WRIST_LEFT\x10\x02\x12\x1f\n\x1b\x44\x45VICE_LOCATION_WRIST_RIGHT\x10\x03\x12\x1c\n\x18\x44\x45VICE_LOCATION_NECKLACE\x10\x04\x12\x19\n\x15\x44\x45VICE_LOCATION_CHEST\x10\x05\x12\x1e\n\x1a\x44\x45VICE_LOCATION_UPPER_BACK\x10\x06\x12\x1d\n\x19\x44\x45VICE_LOCATION_FOOT_LEFT\x10\x07\x12\x1e\n\x1a\x44\x45VICE_LOCATION_FOOT_RIGHT\x10\x08\x12\"\n\x1e\x44\x45VICE_LOCATION_LOWER_ARM_LEFT\x10\t\x12#\n\x1f\x44\x45VICE_LOCATION_LOWER_ARM_RIGHT\x10\n\x12\"\n\x1e\x44\x45VICE_LOCATION_UPPER_ARM_LEFT\x10\x0b\x12#\n\x1f\x44\x45VICE_LOCATION_UPPER_ARM_RIGHT\x10\x0c\x12\x1e\n\x1a\x44\x45VICE_LOCATION_BIKE_MOUNT\x10\r*\xb8\x01\n\x0cPbSessionRPE\x12\x0c\n\x08RPE_NONE\x10\x01\x12\x0c\n\x08RPE_EASY\x10\x02\x12\r\n\tRPE_LIGHT\x10\x03\x12\x14\n\x10RPE_FAIRLY_BRISK\x10\x04\x12\r\n\tRPE_BRISK\x10\x05\x12\x10\n\x0cRPE_MODERATE\x10\x06\x12\x13\n\x0fRPE_FAIRLY_HARD\x10\x07\x12\x0c\n\x08RPE_HARD\x10\x08\x12\x12\n\x0eRPE_EXHAUSTING\x10\t\x12\x0f\n\x0bRPE_EXTREME\x10\n*T\n\x10PbMuscleSoreness\x12\x19\n\x0cMS_UNDEFINED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0b\n\x07MS_NONE\x10\x00\x12\x0b\n\x07MS_SOME\x10\x01\x12\x0b\n\x07MS_MUCH\x10\x02*Z\n\x10PbOverallFatigue\x12\x19\n\x0cOF_UNDEFINED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\r\n\tOF_NORMAL\x10\x00\x12\x0f\n\x0bOF_A_LITTLE\x10\x01\x12\x0b\n\x07OF_MUCH\x10\x02*\xbc\x01\n\x11PbSleepUserRating\x12\x1f\n\x12PB_SLEPT_UNDEFINED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x13\n\x0fPB_SLEPT_POORLY\x10\x00\x12\x1c\n\x18PB_SLEPT_SOMEWHAT_POORLY\x10\x01\x12$\n PB_SLEPT_NEITHER_POORLY_NOR_WELL\x10\x02\x12\x1a\n\x16PB_SLEPT_SOMEWHAT_WELL\x10\x03\x12\x11\n\rPB_SLEPT_WELL\x10\x04*\xf7\x03\n\x16PbDailyBalanceFeedback\x12\x1e\n\x11\x44\x42_NOT_CALCULATED\x10\xff\xff\xff\xff\xff\xff\xff\xff\xff\x01\x12\x0b\n\x07\x44\x42_SICK\x10\x00\x12\x32\n.DB_FATIGUE_TRY_TO_REDUCE_TRAINING_LOAD_INJURED\x10\x01\x12*\n&DB_FATIGUE_TRY_TO_REDUCE_TRAINING_LOAD\x10\x02\x12.\n*DB_LIMITED_TRAINING_RESPONSE_OTHER_INJURED\x10\x03\x12&\n\"DB_LIMITED_TRAINING_RESPONSE_OTHER\x10\x04\x12\x34\n0DB_RESPONDING_WELL_CAN_CONTINUE_IF_INJURY_ALLOWS\x10\x05\x12#\n\x1f\x44\x42_RESPONDING_WELL_CAN_CONTINUE\x10\x06\x12\x32\n.DB_YOU_COULD_DO_MORE_TRAINING_IF_INJURY_ALLOWS\x10\x07\x12!\n\x1d\x44\x42_YOU_COULD_DO_MORE_TRAINING\x10\x08\x12&\n\"DB_YOU_SEEM_TO_BE_STRAINED_INJURED\x10\t\x12\x1e\n\x1a\x44\x42_YOU_SEEM_TO_BE_STRAINED\x10\n*3\n%PbStrengthTrainingRoundRepetitionType\x12\n\n\x06NORMAL\x10\x00*F\n\x1ePbStrengthTrainingWorkoutPhase\x12\x08\n\x04WORK\x10\x00\x12\x0b\n\x07WARM_UP\x10\x01\x12\r\n\tCOOL_DOWN\x10\x02')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBDATATYPE = _descriptor.EnumDescriptor(
name='PbDataType',
full_name='PbDataType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='UNDEFINED', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INHERITED', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ENUM', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MILLIS', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SECOND', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MINUTE', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HOUR', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HOURS', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DAY', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MONTH', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='YEAR', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WEIGHT', index=11, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEIGHT', index=12, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='VO2MAX', index=13, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEARTRATE', index=14, number=20,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HR_PERCENT', index=15, number=21,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HR_RESERVE', index=16, number=22,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED', index=17, number=23,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CADENCE', index=18, number=24,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ALTITUDE', index=19, number=25,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER', index=20, number=26,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_LRB', index=21, number=27,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='POWER_PI', index=22, number=28,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TEMPERATURE', index=23, number=29,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACTIVITY', index=24, number=30,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='STRIDE_LENGTH', index=25, number=31,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='INCLINE', index=26, number=32,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DECLINE', index=27, number=33,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DISTANCE', index=28, number=52,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ENERGY', index=29, number=53,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FAT_PERCENTS', index=30, number=54,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ASCENT', index=31, number=55,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='DESCENT', index=32, number=56,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LATITUDE', index=33, number=57,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='LONGITUDE', index=34, number=58,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HERTZ', index=35, number=59,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PERCENT', index=36, number=60,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CUMULATED_ACTIVITY_DAY', index=37, number=61,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='RUNNING_INDEX', index=38, number=62,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='RR_INTERVAL', index=39, number=63,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Z_INDEX', index=40, number=64,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='EXERCISE_TARGET_INDEX', index=41, number=65,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_ZONE_OFFSET', index=42, number=66,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WHEEL_SIZE', index=43, number=67,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FITNESS_CLASS', index=44, number=68,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ACCELERATION', index=45, number=69,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CRANK_LENGTH', index=46, number=70,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ANGLE_DEGREE', index=47, number=71,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='NEWTON', index=48, number=72,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FUNCTIONAL_THRESHOLD_POWER', index=49, number=73,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CALORIES', index=50, number=74,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SPEED_CALIBRATION_OFFSET', index=51, number=75,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='WEEK', index=52, number=76,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CARDIO_LOAD', index=53, number=77,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_AEROBIC_POWER', index=54, number=78,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MAXIMUM_AEROBIC_SPEED', index=55, number=79,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MUSCLE_LOAD', index=56, number=80,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='PERCEIVED_LOAD', index=57, number=81,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2423,
serialized_end=3342,
)
_sym_db.RegisterEnumDescriptor(_PBDATATYPE)
PbDataType = enum_type_wrapper.EnumTypeWrapper(_PBDATATYPE)
_PBHEARTRATEVIEW = _descriptor.EnumDescriptor(
name='PbHeartRateView',
full_name='PbHeartRateView',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_RATE_VIEW_BPM', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_RATE_VIEW_PERCENTS_OF_HR_RESERVE', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_RATE_VIEW_PERCENTS_OF_MAX_HR', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3344,
serialized_end=3470,
)
_sym_db.RegisterEnumDescriptor(_PBHEARTRATEVIEW)
PbHeartRateView = enum_type_wrapper.EnumTypeWrapper(_PBHEARTRATEVIEW)
_PBUNITSYSTEM = _descriptor.EnumDescriptor(
name='PbUnitSystem',
full_name='PbUnitSystem',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='METRIC', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='IMPERIAL', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3472,
serialized_end=3512,
)
_sym_db.RegisterEnumDescriptor(_PBUNITSYSTEM)
PbUnitSystem = enum_type_wrapper.EnumTypeWrapper(_PBUNITSYSTEM)
_PBTIMESELECTION = _descriptor.EnumDescriptor(
name='PbTimeSelection',
full_name='PbTimeSelection',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TIME_1', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_2', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3514,
serialized_end=3555,
)
_sym_db.RegisterEnumDescriptor(_PBTIMESELECTION)
PbTimeSelection = enum_type_wrapper.EnumTypeWrapper(_PBTIMESELECTION)
_PBTIMEFORMAT = _descriptor.EnumDescriptor(
name='PbTimeFormat',
full_name='PbTimeFormat',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TIME_FORMAT_24H', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_FORMAT_12H', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3557,
serialized_end=3613,
)
_sym_db.RegisterEnumDescriptor(_PBTIMEFORMAT)
PbTimeFormat = enum_type_wrapper.EnumTypeWrapper(_PBTIMEFORMAT)
_PBTIMEFORMATSEPARATOR = _descriptor.EnumDescriptor(
name='PbTimeFormatSeparator',
full_name='PbTimeFormatSeparator',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TIME_FORMAT_SEPARATOR_DOT', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TIME_FORMAT_SEPARATOR_COLON', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3615,
serialized_end=3702,
)
_sym_db.RegisterEnumDescriptor(_PBTIMEFORMATSEPARATOR)
PbTimeFormatSeparator = enum_type_wrapper.EnumTypeWrapper(_PBTIMEFORMATSEPARATOR)
_PBSTARTDAYOFWEEK = _descriptor.EnumDescriptor(
name='PbStartDayOfWeek',
full_name='PbStartDayOfWeek',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='MONDAY', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SATURDAY', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SUNDAY', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3704,
serialized_end=3760,
)
_sym_db.RegisterEnumDescriptor(_PBSTARTDAYOFWEEK)
PbStartDayOfWeek = enum_type_wrapper.EnumTypeWrapper(_PBSTARTDAYOFWEEK)
_PBDATEFORMATSEPARATOR = _descriptor.EnumDescriptor(
name='PbDateFormatSeparator',
full_name='PbDateFormatSeparator',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='DOT', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SLASH', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HYPHEN', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3762,
serialized_end=3817,
)
_sym_db.RegisterEnumDescriptor(_PBDATEFORMATSEPARATOR)
PbDateFormatSeparator = enum_type_wrapper.EnumTypeWrapper(_PBDATEFORMATSEPARATOR)
_PBDATEFORMAT = _descriptor.EnumDescriptor(
name='PbDateFormat',
full_name='PbDateFormat',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='DD_MM_YYYY', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MM_DD_YYYY', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='YYYY_MM_DD', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3819,
serialized_end=3881,
)
_sym_db.RegisterEnumDescriptor(_PBDATEFORMAT)
PbDateFormat = enum_type_wrapper.EnumTypeWrapper(_PBDATEFORMAT)
_PBFEATURETYPE = _descriptor.EnumDescriptor(
name='PbFeatureType',
full_name='PbFeatureType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_HEART_RATE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_RR_INTERVAL', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_SPEED', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_DISTANCE', index=3, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_BIKE_CADENCE', index=4, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_BIKE_POWER', index=5, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_GPS_LOCATION', index=6, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_RUNNING_CADENCE', index=7, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_PRESS_TEMPERATURE', index=8, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_ALTITUDE', index=9, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_STEPS', index=10, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_ACTIVITY', index=11, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_STRIDE_LENGTH', index=12, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_RSC_MOVING_TYPE', index=13, number=14,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_JUMP_HEIGTH', index=14, number=15,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_COMPASS_HEADING', index=15, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_GPS_SPEED', index=16, number=17,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_GPS_DISTANCE', index=17, number=18,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FEATURE_TYPE_GPS_ALTITUDE', index=18, number=19,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | true |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/gpsalmanacinfo_pb2.py | loophole/polar/pb/gpsalmanacinfo_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: gpsalmanacinfo.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='gpsalmanacinfo.proto',
package='data',
serialized_pb=_b('\n\x14gpsalmanacinfo.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"7\n\x10PbGPSAlmanacInfo\x12#\n\x08\x65nd_time\x18\x01 \x02(\x0b\x32\x11.PbSystemDateTime')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBGPSALMANACINFO = _descriptor.Descriptor(
name='PbGPSAlmanacInfo',
full_name='data.PbGPSAlmanacInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='end_time', full_name='data.PbGPSAlmanacInfo.end_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=43,
serialized_end=98,
)
_PBGPSALMANACINFO.fields_by_name['end_time'].message_type = types_pb2._PBSYSTEMDATETIME
DESCRIPTOR.message_types_by_name['PbGPSAlmanacInfo'] = _PBGPSALMANACINFO
PbGPSAlmanacInfo = _reflection.GeneratedProtocolMessageType('PbGPSAlmanacInfo', (_message.Message,), dict(
DESCRIPTOR = _PBGPSALMANACINFO,
__module__ = 'gpsalmanacinfo_pb2'
# @@protoc_insertion_point(class_scope:data.PbGPSAlmanacInfo)
))
_sym_db.RegisterMessage(PbGPSAlmanacInfo)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/bluetooth_device_pb2.py | loophole/polar/pb/bluetooth_device_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: bluetooth_device.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2 as structures__pb2
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='bluetooth_device.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x16\x62luetooth_device.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"K\n\tPbBleUser\x12\x12\n\nuser_index\x18\x01 \x02(\r\x12\x19\n\x11\x64\x65vice_user_index\x18\x02 \x02(\r\x12\x0f\n\x07\x63onsent\x18\x03 \x01(\r\"\x99\x18\n\x0bPbBleDevice\x12!\n\x06paired\x18\x01 \x02(\x0b\x32\x11.PbSystemDateTime\x12(\n\rlast_modified\x18\x02 \x02(\x0b\x32\x11.PbSystemDateTime\x12\x34\n\x0cmanufacturer\x18\x03 \x02(\x0e\x32\x1e.data.PbDeviceManufacturerType\x12-\n\x12\x64\x65leted_time_stamp\x18\x05 \x01(\x0b\x32\x11.PbSystemDateTime\x12\x16\n\x03mac\x18\x06 \x01(\x0b\x32\t.PbBleMac\x12\x11\n\tdevice_id\x18\x07 \x01(\t\x12\x0c\n\x04name\x18\x08 \x01(\t\x12\x15\n\rbattery_level\x18\t \x01(\r\x12\x19\n\x11manufacturer_name\x18\n \x01(\t\x12\x12\n\nmodel_name\x18\x0b \x01(\t\x12\x10\n\x08peer_ltk\x18\x0c \x01(\x0c\x12\x10\n\x08peer_irk\x18\r \x01(\x0c\x12\x11\n\tpeer_csrk\x18\x0e \x01(\x0c\x12*\n\x12\x61vailable_features\x18\x0f \x03(\x0e\x32\x0e.PbFeatureType\x12\x1f\n\x08services\x18\x10 \x03(\x0b\x32\r.PbBleService\x12\x11\n\tpeer_rand\x18\x11 \x01(\x0c\x12\x11\n\tpeer_ediv\x18\x12 \x01(\r\x12\x15\n\rencr_key_size\x18\x13 \x01(\r\x12\x18\n\x10\x64istributed_keys\x18\x14 \x01(\r\x12\x15\n\rauthenticated\x18\x15 \x01(\x08\x12;\n\x0fsensor_location\x18\x16 \x01(\x0e\x32\".data.PbBleDevice.PbSensorLocation\x12\x1f\n\x17OBSOLETE_device_version\x18\x17 \x01(\t\x12\"\n\x1asecondary_software_version\x18\x18 \x01(\t\x12\x15\n\rserial_number\x18\x19 \x01(\t\x12\x11\n\tlocal_ltk\x18\x1a \x01(\x0c\x12\x12\n\nlocal_rand\x18\x1b \x01(\x0c\x12\x12\n\nlocal_ediv\x18\x1c \x01(\r\x12\"\n\tuser_data\x18\x1d \x03(\x0b\x32\x0f.data.PbBleUser\x12?\n\x11\x64\x65vice_appearance\x18\x1e \x01(\x0e\x32$.data.PbBleDevice.PbDeviceAppearance\x12(\n part_of_distributed_power_system\x18\x1f \x01(\x08\x12\x15\n\rhardware_code\x18 \x01(\t\x12/\n\x12sub_component_info\x18! \x03(\x0b\x32\x13.PbSubcomponentInfo\x12\"\n\x0e\x64\x65vice_version\x18\" \x01(\x0b\x32\n.PbVersion\"\xc1\x01\n\x0cPbBleKeyType\x12\x1b\n\x17\x42LE_PEER_ENCRYPTION_KEY\x10\x01\x12\x1f\n\x1b\x42LE_PEER_IDENTIFICATION_KEY\x10\x02\x12\x18\n\x14\x42LE_PEER_SIGNING_KEY\x10\x04\x12\x1c\n\x18\x42LE_LOCAL_ENCRYPTION_KEY\x10\x08\x12 \n\x1c\x42LE_LOCAL_IDENTIFICATION_KEY\x10\x10\x12\x19\n\x15\x42LE_LOCAL_SIGNING_KEY\x10 \"\xe0\x03\n\x10PbSensorLocation\x12\x19\n\x15SENSOR_LOCATION_OTHER\x10\x00\x12\x1f\n\x1bSENSOR_LOCATION_TOP_OF_SHOE\x10\x01\x12\x1b\n\x17SENSOR_LOCATION_IN_SHOE\x10\x02\x12\x17\n\x13SENSOR_LOCATION_HIP\x10\x03\x12\x1f\n\x1bSENSOR_LOCATION_FRONT_WHEEL\x10\x04\x12\x1e\n\x1aSENSOR_LOCATION_LEFT_CRANK\x10\x05\x12\x1f\n\x1bSENSOR_LOCATION_RIGHT_CRANK\x10\x06\x12\x1e\n\x1aSENSOR_LOCATION_LEFT_PEDAL\x10\x07\x12\x1f\n\x1bSENSOR_LOCATION_RIGHT_PEDAL\x10\x08\x12\x1d\n\x19SENSOR_LOCATION_FRONT_HUB\x10\t\x12 \n\x1cSENSOR_LOCATION_REAR_DROPOUT\x10\n\x12\x1d\n\x19SENSOR_LOCATION_CHAINSTAY\x10\x0b\x12\x1e\n\x1aSENSOR_LOCATION_REAR_WHEEL\x10\x0c\x12\x1c\n\x18SENSOR_LOCATION_REAR_HUB\x10\r\x12\x19\n\x15SENSOR_LOCATION_CHEST\x10\x0e\"\xf0\n\n\x12PbDeviceAppearance\x12!\n\x1d\x42LE_DEVICE_APPEARENCE_UNKNOWN\x10\x00\x12\'\n#BLE_DEVICE_APPEARENCE_GENERIC_PHONE\x10@\x12+\n&BLE_DEVICE_APPEARENCE_GENERIC_COMPUTER\x10\x80\x01\x12(\n#BLE_DEVICE_APPEARENCE_GENERIC_WATCH\x10\xc0\x01\x12\'\n\"BLE_DEVICE_APPEARENCE_SPORTS_WATCH\x10\xc1\x01\x12(\n#BLE_DEVICE_APPEARENCE_GENERIC_CLOCK\x10\x80\x02\x12*\n%BLE_DEVICE_APPEARENCE_GENERIC_DISPLAY\x10\xc0\x02\x12\x39\n4BLE_DEVICE_APPEARENCE_GENERIC_GENERIC_REMOTE_CONTROL\x10\x80\x03\x12.\n)BLE_DEVICE_APPEARENCE_GENERIC_EYE_GLASSES\x10\xc0\x03\x12&\n!BLE_DEVICE_APPEARENCE_GENERIC_TAG\x10\x80\x04\x12*\n%BLE_DEVICE_APPEARENCE_GENERIC_KEYRING\x10\xc0\x04\x12/\n*BLE_DEVICE_APPEARENCE_GENERIC_MEDIA_PLAYER\x10\x80\x05\x12\x32\n-BLE_DEVICE_APPEARENCE_GENERIC_BARCODE_SCANNER\x10\xc0\x05\x12.\n)BLE_DEVICE_APPEARENCE_GENERIC_THERMOMETER\x10\x80\x06\x12*\n%BLE_DEVICE_APPEARENCE_THERMOMETER_EAR\x10\x81\x06\x12\x34\n/BLE_DEVICE_APPEARENCE_GENERIC_HEART_RATE_SENSOR\x10\xc0\x06\x12\x31\n,BLE_DEVICE_APPEARENCE_BELT_HEART_RATE_SENSOR\x10\xc1\x06\x12\x31\n,BLE_DEVICE_APPEARENCE_GENERIC_BLOOD_PRESSURE\x10\x80\x07\x12-\n(BLE_DEVICE_APPEARENCE_BLOOD_PRESSURE_ARM\x10\x81\x07\x12/\n*BLE_DEVICE_APPEARENCE_BLOOD_PRESSURE_WRIST\x10\x82\x07\x12\x31\n,BLE_DEVICE_APPEARENCE_HUMAN_INTERFACE_DEVICE\x10\xc0\x07\x12\'\n\"BLE_DEVICE_APPEARENCE_HID_KEYBOARD\x10\xc1\x07\x12$\n\x1f\x42LE_DEVICE_APPEARENCE_HID_MOUSE\x10\xc2\x07\x12\'\n\"BLE_DEVICE_APPEARENCE_HID_JOYSTICK\x10\xc3\x07\x12&\n!BLE_DEVICE_APPEARENCE_HID_GAMEPAD\x10\xc4\x07\x12/\n*BLE_DEVICE_APPEARENCE_HID_DIGITIZER_TABLET\x10\xc5\x07\x12*\n%BLE_DEVICE_APPEARENCE_HID_CARD_READER\x10\xc6\x07\x12*\n%BLE_DEVICE_APPEARENCE_HID_DIGITAL_PEN\x10\xc7\x07\x12.\n)BLE_DEVICE_APPEARENCE_HID_BARCODE_SCANNER\x10\xc8\x07\x12\x30\n+BLE_DEVICE_APPEARENCE_GENERIC_GLUCOSE_METER\x10\x80\x08*J\n\x18PbDeviceManufacturerType\x12\x16\n\x12MANUFACTURER_POLAR\x10\x01\x12\x16\n\x12MANUFACTURER_OTHER\x10\x02')
,
dependencies=[structures__pb2.DESCRIPTOR,types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBDEVICEMANUFACTURERTYPE = _descriptor.EnumDescriptor(
name='PbDeviceManufacturerType',
full_name='data.PbDeviceManufacturerType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='MANUFACTURER_POLAR', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MANUFACTURER_OTHER', index=1, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=3240,
serialized_end=3314,
)
_sym_db.RegisterEnumDescriptor(_PBDEVICEMANUFACTURERTYPE)
PbDeviceManufacturerType = enum_type_wrapper.EnumTypeWrapper(_PBDEVICEMANUFACTURERTYPE)
MANUFACTURER_POLAR = 1
MANUFACTURER_OTHER = 2
_PBBLEDEVICE_PBBLEKEYTYPE = _descriptor.EnumDescriptor(
name='PbBleKeyType',
full_name='data.PbBleDevice.PbBleKeyType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='BLE_PEER_ENCRYPTION_KEY', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_PEER_IDENTIFICATION_KEY', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_PEER_SIGNING_KEY', index=2, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_LOCAL_ENCRYPTION_KEY', index=3, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_LOCAL_IDENTIFICATION_KEY', index=4, number=16,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_LOCAL_SIGNING_KEY', index=5, number=32,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1167,
serialized_end=1360,
)
_sym_db.RegisterEnumDescriptor(_PBBLEDEVICE_PBBLEKEYTYPE)
_PBBLEDEVICE_PBSENSORLOCATION = _descriptor.EnumDescriptor(
name='PbSensorLocation',
full_name='data.PbBleDevice.PbSensorLocation',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_OTHER', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_TOP_OF_SHOE', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_IN_SHOE', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_HIP', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_FRONT_WHEEL', index=4, number=4,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_LEFT_CRANK', index=5, number=5,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_RIGHT_CRANK', index=6, number=6,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_LEFT_PEDAL', index=7, number=7,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_RIGHT_PEDAL', index=8, number=8,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_FRONT_HUB', index=9, number=9,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_REAR_DROPOUT', index=10, number=10,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_CHAINSTAY', index=11, number=11,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_REAR_WHEEL', index=12, number=12,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_REAR_HUB', index=13, number=13,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='SENSOR_LOCATION_CHEST', index=14, number=14,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1363,
serialized_end=1843,
)
_sym_db.RegisterEnumDescriptor(_PBBLEDEVICE_PBSENSORLOCATION)
_PBBLEDEVICE_PBDEVICEAPPEARANCE = _descriptor.EnumDescriptor(
name='PbDeviceAppearance',
full_name='data.PbBleDevice.PbDeviceAppearance',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_UNKNOWN', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_PHONE', index=1, number=64,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_COMPUTER', index=2, number=128,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_WATCH', index=3, number=192,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_SPORTS_WATCH', index=4, number=193,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_CLOCK', index=5, number=256,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_DISPLAY', index=6, number=320,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_GENERIC_REMOTE_CONTROL', index=7, number=384,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_EYE_GLASSES', index=8, number=448,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_TAG', index=9, number=512,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_KEYRING', index=10, number=576,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_MEDIA_PLAYER', index=11, number=640,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_BARCODE_SCANNER', index=12, number=704,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_THERMOMETER', index=13, number=768,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_THERMOMETER_EAR', index=14, number=769,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_HEART_RATE_SENSOR', index=15, number=832,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_BELT_HEART_RATE_SENSOR', index=16, number=833,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_BLOOD_PRESSURE', index=17, number=896,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_BLOOD_PRESSURE_ARM', index=18, number=897,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_BLOOD_PRESSURE_WRIST', index=19, number=898,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HUMAN_INTERFACE_DEVICE', index=20, number=960,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_KEYBOARD', index=21, number=961,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_MOUSE', index=22, number=962,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_JOYSTICK', index=23, number=963,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_GAMEPAD', index=24, number=964,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_DIGITIZER_TABLET', index=25, number=965,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_CARD_READER', index=26, number=966,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_DIGITAL_PEN', index=27, number=967,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_HID_BARCODE_SCANNER', index=28, number=968,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='BLE_DEVICE_APPEARENCE_GENERIC_GLUCOSE_METER', index=29, number=1024,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1846,
serialized_end=3238,
)
_sym_db.RegisterEnumDescriptor(_PBBLEDEVICE_PBDEVICEAPPEARANCE)
_PBBLEUSER = _descriptor.Descriptor(
name='PbBleUser',
full_name='data.PbBleUser',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='user_index', full_name='data.PbBleUser.user_index', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_user_index', full_name='data.PbBleUser.device_user_index', index=1,
number=2, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='consent', full_name='data.PbBleUser.consent', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=63,
serialized_end=138,
)
_PBBLEDEVICE = _descriptor.Descriptor(
name='PbBleDevice',
full_name='data.PbBleDevice',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='paired', full_name='data.PbBleDevice.paired', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='last_modified', full_name='data.PbBleDevice.last_modified', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='manufacturer', full_name='data.PbBleDevice.manufacturer', index=2,
number=3, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='deleted_time_stamp', full_name='data.PbBleDevice.deleted_time_stamp', index=3,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='mac', full_name='data.PbBleDevice.mac', index=4,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_id', full_name='data.PbBleDevice.device_id', index=5,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='data.PbBleDevice.name', index=6,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='battery_level', full_name='data.PbBleDevice.battery_level', index=7,
number=9, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='manufacturer_name', full_name='data.PbBleDevice.manufacturer_name', index=8,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='model_name', full_name='data.PbBleDevice.model_name', index=9,
number=11, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='peer_ltk', full_name='data.PbBleDevice.peer_ltk', index=10,
number=12, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='peer_irk', full_name='data.PbBleDevice.peer_irk', index=11,
number=13, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='peer_csrk', full_name='data.PbBleDevice.peer_csrk', index=12,
number=14, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='available_features', full_name='data.PbBleDevice.available_features', index=13,
number=15, type=14, cpp_type=8, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='services', full_name='data.PbBleDevice.services', index=14,
number=16, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='peer_rand', full_name='data.PbBleDevice.peer_rand', index=15,
number=17, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='peer_ediv', full_name='data.PbBleDevice.peer_ediv', index=16,
number=18, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='encr_key_size', full_name='data.PbBleDevice.encr_key_size', index=17,
number=19, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distributed_keys', full_name='data.PbBleDevice.distributed_keys', index=18,
number=20, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='authenticated', full_name='data.PbBleDevice.authenticated', index=19,
number=21, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sensor_location', full_name='data.PbBleDevice.sensor_location', index=20,
number=22, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_device_version', full_name='data.PbBleDevice.OBSOLETE_device_version', index=21,
number=23, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='secondary_software_version', full_name='data.PbBleDevice.secondary_software_version', index=22,
number=24, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='serial_number', full_name='data.PbBleDevice.serial_number', index=23,
number=25, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='local_ltk', full_name='data.PbBleDevice.local_ltk', index=24,
number=26, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='local_rand', full_name='data.PbBleDevice.local_rand', index=25,
number=27, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='local_ediv', full_name='data.PbBleDevice.local_ediv', index=26,
number=28, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='user_data', full_name='data.PbBleDevice.user_data', index=27,
number=29, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_appearance', full_name='data.PbBleDevice.device_appearance', index=28,
number=30, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='part_of_distributed_power_system', full_name='data.PbBleDevice.part_of_distributed_power_system', index=29,
number=31, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hardware_code', full_name='data.PbBleDevice.hardware_code', index=30,
number=32, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sub_component_info', full_name='data.PbBleDevice.sub_component_info', index=31,
number=33, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_version', full_name='data.PbBleDevice.device_version', index=32,
number=34, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBBLEDEVICE_PBBLEKEYTYPE,
_PBBLEDEVICE_PBSENSORLOCATION,
_PBBLEDEVICE_PBDEVICEAPPEARANCE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=141,
serialized_end=3238,
)
_PBBLEDEVICE.fields_by_name['paired'].message_type = types__pb2._PBSYSTEMDATETIME
_PBBLEDEVICE.fields_by_name['last_modified'].message_type = types__pb2._PBSYSTEMDATETIME
_PBBLEDEVICE.fields_by_name['manufacturer'].enum_type = _PBDEVICEMANUFACTURERTYPE
_PBBLEDEVICE.fields_by_name['deleted_time_stamp'].message_type = types__pb2._PBSYSTEMDATETIME
_PBBLEDEVICE.fields_by_name['mac'].message_type = structures__pb2._PBBLEMAC
_PBBLEDEVICE.fields_by_name['available_features'].enum_type = types__pb2._PBFEATURETYPE
_PBBLEDEVICE.fields_by_name['services'].message_type = structures__pb2._PBBLESERVICE
_PBBLEDEVICE.fields_by_name['sensor_location'].enum_type = _PBBLEDEVICE_PBSENSORLOCATION
_PBBLEDEVICE.fields_by_name['user_data'].message_type = _PBBLEUSER
_PBBLEDEVICE.fields_by_name['device_appearance'].enum_type = _PBBLEDEVICE_PBDEVICEAPPEARANCE
_PBBLEDEVICE.fields_by_name['sub_component_info'].message_type = structures__pb2._PBSUBCOMPONENTINFO
_PBBLEDEVICE.fields_by_name['device_version'].message_type = structures__pb2._PBVERSION
_PBBLEDEVICE_PBBLEKEYTYPE.containing_type = _PBBLEDEVICE
_PBBLEDEVICE_PBSENSORLOCATION.containing_type = _PBBLEDEVICE
_PBBLEDEVICE_PBDEVICEAPPEARANCE.containing_type = _PBBLEDEVICE
DESCRIPTOR.message_types_by_name['PbBleUser'] = _PBBLEUSER
DESCRIPTOR.message_types_by_name['PbBleDevice'] = _PBBLEDEVICE
DESCRIPTOR.enum_types_by_name['PbDeviceManufacturerType'] = _PBDEVICEMANUFACTURERTYPE
PbBleUser = _reflection.GeneratedProtocolMessageType('PbBleUser', (_message.Message,), dict(
DESCRIPTOR = _PBBLEUSER,
__module__ = 'bluetooth_device_pb2'
# @@protoc_insertion_point(class_scope:data.PbBleUser)
))
_sym_db.RegisterMessage(PbBleUser)
PbBleDevice = _reflection.GeneratedProtocolMessageType('PbBleDevice', (_message.Message,), dict(
DESCRIPTOR = _PBBLEDEVICE,
__module__ = 'bluetooth_device_pb2'
# @@protoc_insertion_point(class_scope:data.PbBleDevice)
))
_sym_db.RegisterMessage(PbBleDevice)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_laps_pb2.py | loophole/polar/pb/exercise_laps_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_laps.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_laps.proto',
package='data',
serialized_pb=_b('\n\x13\x65xercise_laps.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\x99\x02\n\x0bPbLapHeader\x12\x1f\n\nsplit_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\x1d\n\x08\x64uration\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12\x10\n\x08\x64istance\x18\x03 \x01(\x02\x12\x0e\n\x06\x61scent\x18\x04 \x01(\x02\x12\x0f\n\x07\x64\x65scent\x18\x05 \x01(\x02\x12\x35\n\x0c\x61utolap_type\x18\x06 \x01(\x0e\x32\x1f.data.PbLapHeader.PbAutolapType\"`\n\rPbAutolapType\x12\x19\n\x15\x41UTOLAP_TYPE_DISTANCE\x10\x01\x12\x19\n\x15\x41UTOLAP_TYPE_DURATION\x10\x02\x12\x19\n\x15\x41UTOLAP_TYPE_LOCATION\x10\x03\"`\n\x17PbLapSwimmingStatistics\x12\x13\n\x0blap_strokes\x18\x01 \x01(\r\x12\x12\n\npool_count\x18\x02 \x01(\r\x12\x1c\n\x14\x61vg_duration_of_pool\x18\x03 \x01(\x02\"M\n\x18PbLapHeartRateStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\x12\x0f\n\x07minimum\x18\x03 \x01(\r\"8\n\x14PbLapSpeedStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\x12\x0f\n\x07maximum\x18\x02 \x01(\x02\":\n\x16PbLapCadenceStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\x12\x0f\n\x07maximum\x18\x02 \x01(\r\"8\n\x14PbLapPowerStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x05\x12\x0f\n\x07maximum\x18\x02 \x01(\x05\"+\n\x18PbLapLRBalanceStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\x02\"/\n\x1cPbLapPedalingIndexStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"4\n!PbLapPedalingEfficiencyStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"%\n\x16PbLapInclineStatistics\x12\x0b\n\x03max\x18\x01 \x01(\x02\".\n\x1bPbLapStrideLengthStatistics\x12\x0f\n\x07\x61verage\x18\x01 \x01(\r\"\xf0\x03\n\x0fPbLapStatistics\x12\x32\n\nheart_rate\x18\x01 \x01(\x0b\x32\x1e.data.PbLapHeartRateStatistics\x12)\n\x05speed\x18\x02 \x01(\x0b\x32\x1a.data.PbLapSpeedStatistics\x12-\n\x07\x63\x61\x64\x65nce\x18\x03 \x01(\x0b\x32\x1c.data.PbLapCadenceStatistics\x12)\n\x05power\x18\x04 \x01(\x0b\x32\x1a.data.PbLapPowerStatistics\x12\x43\n\x17OBSOLETE_pedaling_index\x18\x05 \x01(\x0b\x32\".data.PbLapPedalingIndexStatistics\x12-\n\x07incline\x18\x06 \x01(\x0b\x32\x1c.data.PbLapInclineStatistics\x12\x38\n\rstride_length\x18\x07 \x01(\x0b\x32!.data.PbLapStrideLengthStatistics\x12:\n\x13swimming_statistics\x18\x08 \x01(\x0b\x32\x1d.data.PbLapSwimmingStatistics\x12:\n\x12left_right_balance\x18\t \x01(\x0b\x32\x1e.data.PbLapLRBalanceStatistics\"U\n\x05PbLap\x12!\n\x06header\x18\x01 \x02(\x0b\x32\x11.data.PbLapHeader\x12)\n\nstatistics\x18\x02 \x01(\x0b\x32\x15.data.PbLapStatistics\"a\n\x0cPbLapSummary\x12&\n\x11\x62\x65st_lap_duration\x18\x01 \x01(\x0b\x32\x0b.PbDuration\x12)\n\x14\x61verage_lap_duration\x18\x02 \x01(\x0b\x32\x0b.PbDuration\"H\n\x06PbLaps\x12\x19\n\x04laps\x18\x01 \x03(\x0b\x32\x0b.data.PbLap\x12#\n\x07summary\x18\x02 \x01(\x0b\x32\x12.data.PbLapSummary\"P\n\nPbAutoLaps\x12\x1d\n\x08\x61utoLaps\x18\x01 \x03(\x0b\x32\x0b.data.PbLap\x12#\n\x07summary\x18\x02 \x01(\x0b\x32\x12.data.PbLapSummary')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBLAPHEADER_PBAUTOLAPTYPE = _descriptor.EnumDescriptor(
name='PbAutolapType',
full_name='data.PbLapHeader.PbAutolapType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='AUTOLAP_TYPE_DISTANCE', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOLAP_TYPE_DURATION', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AUTOLAP_TYPE_LOCATION', index=2, number=3,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=228,
serialized_end=324,
)
_sym_db.RegisterEnumDescriptor(_PBLAPHEADER_PBAUTOLAPTYPE)
_PBLAPHEADER = _descriptor.Descriptor(
name='PbLapHeader',
full_name='data.PbLapHeader',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='split_time', full_name='data.PbLapHeader.split_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='duration', full_name='data.PbLapHeader.duration', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance', full_name='data.PbLapHeader.distance', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ascent', full_name='data.PbLapHeader.ascent', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='descent', full_name='data.PbLapHeader.descent', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='autolap_type', full_name='data.PbLapHeader.autolap_type', index=5,
number=6, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBLAPHEADER_PBAUTOLAPTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=43,
serialized_end=324,
)
_PBLAPSWIMMINGSTATISTICS = _descriptor.Descriptor(
name='PbLapSwimmingStatistics',
full_name='data.PbLapSwimmingStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='lap_strokes', full_name='data.PbLapSwimmingStatistics.lap_strokes', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='pool_count', full_name='data.PbLapSwimmingStatistics.pool_count', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='avg_duration_of_pool', full_name='data.PbLapSwimmingStatistics.avg_duration_of_pool', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=326,
serialized_end=422,
)
_PBLAPHEARTRATESTATISTICS = _descriptor.Descriptor(
name='PbLapHeartRateStatistics',
full_name='data.PbLapHeartRateStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapHeartRateStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbLapHeartRateStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='minimum', full_name='data.PbLapHeartRateStatistics.minimum', index=2,
number=3, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=424,
serialized_end=501,
)
_PBLAPSPEEDSTATISTICS = _descriptor.Descriptor(
name='PbLapSpeedStatistics',
full_name='data.PbLapSpeedStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapSpeedStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbLapSpeedStatistics.maximum', index=1,
number=2, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=503,
serialized_end=559,
)
_PBLAPCADENCESTATISTICS = _descriptor.Descriptor(
name='PbLapCadenceStatistics',
full_name='data.PbLapCadenceStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapCadenceStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbLapCadenceStatistics.maximum', index=1,
number=2, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=561,
serialized_end=619,
)
_PBLAPPOWERSTATISTICS = _descriptor.Descriptor(
name='PbLapPowerStatistics',
full_name='data.PbLapPowerStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapPowerStatistics.average', index=0,
number=1, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='maximum', full_name='data.PbLapPowerStatistics.maximum', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=621,
serialized_end=677,
)
_PBLAPLRBALANCESTATISTICS = _descriptor.Descriptor(
name='PbLapLRBalanceStatistics',
full_name='data.PbLapLRBalanceStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapLRBalanceStatistics.average', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=679,
serialized_end=722,
)
_PBLAPPEDALINGINDEXSTATISTICS = _descriptor.Descriptor(
name='PbLapPedalingIndexStatistics',
full_name='data.PbLapPedalingIndexStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapPedalingIndexStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=724,
serialized_end=771,
)
_PBLAPPEDALINGEFFICIENCYSTATISTICS = _descriptor.Descriptor(
name='PbLapPedalingEfficiencyStatistics',
full_name='data.PbLapPedalingEfficiencyStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapPedalingEfficiencyStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=773,
serialized_end=825,
)
_PBLAPINCLINESTATISTICS = _descriptor.Descriptor(
name='PbLapInclineStatistics',
full_name='data.PbLapInclineStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='max', full_name='data.PbLapInclineStatistics.max', index=0,
number=1, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=827,
serialized_end=864,
)
_PBLAPSTRIDELENGTHSTATISTICS = _descriptor.Descriptor(
name='PbLapStrideLengthStatistics',
full_name='data.PbLapStrideLengthStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='average', full_name='data.PbLapStrideLengthStatistics.average', index=0,
number=1, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=866,
serialized_end=912,
)
_PBLAPSTATISTICS = _descriptor.Descriptor(
name='PbLapStatistics',
full_name='data.PbLapStatistics',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_rate', full_name='data.PbLapStatistics.heart_rate', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed', full_name='data.PbLapStatistics.speed', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cadence', full_name='data.PbLapStatistics.cadence', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power', full_name='data.PbLapStatistics.power', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='OBSOLETE_pedaling_index', full_name='data.PbLapStatistics.OBSOLETE_pedaling_index', index=4,
number=5, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='incline', full_name='data.PbLapStatistics.incline', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_length', full_name='data.PbLapStatistics.stride_length', index=6,
number=7, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='swimming_statistics', full_name='data.PbLapStatistics.swimming_statistics', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='left_right_balance', full_name='data.PbLapStatistics.left_right_balance', index=8,
number=9, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=915,
serialized_end=1411,
)
_PBLAP = _descriptor.Descriptor(
name='PbLap',
full_name='data.PbLap',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='header', full_name='data.PbLap.header', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='statistics', full_name='data.PbLap.statistics', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1413,
serialized_end=1498,
)
_PBLAPSUMMARY = _descriptor.Descriptor(
name='PbLapSummary',
full_name='data.PbLapSummary',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='best_lap_duration', full_name='data.PbLapSummary.best_lap_duration', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='average_lap_duration', full_name='data.PbLapSummary.average_lap_duration', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1500,
serialized_end=1597,
)
_PBLAPS = _descriptor.Descriptor(
name='PbLaps',
full_name='data.PbLaps',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='laps', full_name='data.PbLaps.laps', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='summary', full_name='data.PbLaps.summary', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1599,
serialized_end=1671,
)
_PBAUTOLAPS = _descriptor.Descriptor(
name='PbAutoLaps',
full_name='data.PbAutoLaps',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='autoLaps', full_name='data.PbAutoLaps.autoLaps', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='summary', full_name='data.PbAutoLaps.summary', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1673,
serialized_end=1753,
)
_PBLAPHEADER.fields_by_name['split_time'].message_type = types_pb2._PBDURATION
_PBLAPHEADER.fields_by_name['duration'].message_type = types_pb2._PBDURATION
_PBLAPHEADER.fields_by_name['autolap_type'].enum_type = _PBLAPHEADER_PBAUTOLAPTYPE
_PBLAPHEADER_PBAUTOLAPTYPE.containing_type = _PBLAPHEADER
_PBLAPSTATISTICS.fields_by_name['heart_rate'].message_type = _PBLAPHEARTRATESTATISTICS
_PBLAPSTATISTICS.fields_by_name['speed'].message_type = _PBLAPSPEEDSTATISTICS
_PBLAPSTATISTICS.fields_by_name['cadence'].message_type = _PBLAPCADENCESTATISTICS
_PBLAPSTATISTICS.fields_by_name['power'].message_type = _PBLAPPOWERSTATISTICS
_PBLAPSTATISTICS.fields_by_name['OBSOLETE_pedaling_index'].message_type = _PBLAPPEDALINGINDEXSTATISTICS
_PBLAPSTATISTICS.fields_by_name['incline'].message_type = _PBLAPINCLINESTATISTICS
_PBLAPSTATISTICS.fields_by_name['stride_length'].message_type = _PBLAPSTRIDELENGTHSTATISTICS
_PBLAPSTATISTICS.fields_by_name['swimming_statistics'].message_type = _PBLAPSWIMMINGSTATISTICS
_PBLAPSTATISTICS.fields_by_name['left_right_balance'].message_type = _PBLAPLRBALANCESTATISTICS
_PBLAP.fields_by_name['header'].message_type = _PBLAPHEADER
_PBLAP.fields_by_name['statistics'].message_type = _PBLAPSTATISTICS
_PBLAPSUMMARY.fields_by_name['best_lap_duration'].message_type = types_pb2._PBDURATION
_PBLAPSUMMARY.fields_by_name['average_lap_duration'].message_type = types_pb2._PBDURATION
_PBLAPS.fields_by_name['laps'].message_type = _PBLAP
_PBLAPS.fields_by_name['summary'].message_type = _PBLAPSUMMARY
_PBAUTOLAPS.fields_by_name['autoLaps'].message_type = _PBLAP
_PBAUTOLAPS.fields_by_name['summary'].message_type = _PBLAPSUMMARY
DESCRIPTOR.message_types_by_name['PbLapHeader'] = _PBLAPHEADER
DESCRIPTOR.message_types_by_name['PbLapSwimmingStatistics'] = _PBLAPSWIMMINGSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapHeartRateStatistics'] = _PBLAPHEARTRATESTATISTICS
DESCRIPTOR.message_types_by_name['PbLapSpeedStatistics'] = _PBLAPSPEEDSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapCadenceStatistics'] = _PBLAPCADENCESTATISTICS
DESCRIPTOR.message_types_by_name['PbLapPowerStatistics'] = _PBLAPPOWERSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapLRBalanceStatistics'] = _PBLAPLRBALANCESTATISTICS
DESCRIPTOR.message_types_by_name['PbLapPedalingIndexStatistics'] = _PBLAPPEDALINGINDEXSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapPedalingEfficiencyStatistics'] = _PBLAPPEDALINGEFFICIENCYSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapInclineStatistics'] = _PBLAPINCLINESTATISTICS
DESCRIPTOR.message_types_by_name['PbLapStrideLengthStatistics'] = _PBLAPSTRIDELENGTHSTATISTICS
DESCRIPTOR.message_types_by_name['PbLapStatistics'] = _PBLAPSTATISTICS
DESCRIPTOR.message_types_by_name['PbLap'] = _PBLAP
DESCRIPTOR.message_types_by_name['PbLapSummary'] = _PBLAPSUMMARY
DESCRIPTOR.message_types_by_name['PbLaps'] = _PBLAPS
DESCRIPTOR.message_types_by_name['PbAutoLaps'] = _PBAUTOLAPS
PbLapHeader = _reflection.GeneratedProtocolMessageType('PbLapHeader', (_message.Message,), dict(
DESCRIPTOR = _PBLAPHEADER,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapHeader)
))
_sym_db.RegisterMessage(PbLapHeader)
PbLapSwimmingStatistics = _reflection.GeneratedProtocolMessageType('PbLapSwimmingStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPSWIMMINGSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapSwimmingStatistics)
))
_sym_db.RegisterMessage(PbLapSwimmingStatistics)
PbLapHeartRateStatistics = _reflection.GeneratedProtocolMessageType('PbLapHeartRateStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPHEARTRATESTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapHeartRateStatistics)
))
_sym_db.RegisterMessage(PbLapHeartRateStatistics)
PbLapSpeedStatistics = _reflection.GeneratedProtocolMessageType('PbLapSpeedStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPSPEEDSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapSpeedStatistics)
))
_sym_db.RegisterMessage(PbLapSpeedStatistics)
PbLapCadenceStatistics = _reflection.GeneratedProtocolMessageType('PbLapCadenceStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPCADENCESTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapCadenceStatistics)
))
_sym_db.RegisterMessage(PbLapCadenceStatistics)
PbLapPowerStatistics = _reflection.GeneratedProtocolMessageType('PbLapPowerStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPPOWERSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapPowerStatistics)
))
_sym_db.RegisterMessage(PbLapPowerStatistics)
PbLapLRBalanceStatistics = _reflection.GeneratedProtocolMessageType('PbLapLRBalanceStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPLRBALANCESTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapLRBalanceStatistics)
))
_sym_db.RegisterMessage(PbLapLRBalanceStatistics)
PbLapPedalingIndexStatistics = _reflection.GeneratedProtocolMessageType('PbLapPedalingIndexStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPPEDALINGINDEXSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapPedalingIndexStatistics)
))
_sym_db.RegisterMessage(PbLapPedalingIndexStatistics)
PbLapPedalingEfficiencyStatistics = _reflection.GeneratedProtocolMessageType('PbLapPedalingEfficiencyStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPPEDALINGEFFICIENCYSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapPedalingEfficiencyStatistics)
))
_sym_db.RegisterMessage(PbLapPedalingEfficiencyStatistics)
PbLapInclineStatistics = _reflection.GeneratedProtocolMessageType('PbLapInclineStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPINCLINESTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapInclineStatistics)
))
_sym_db.RegisterMessage(PbLapInclineStatistics)
PbLapStrideLengthStatistics = _reflection.GeneratedProtocolMessageType('PbLapStrideLengthStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPSTRIDELENGTHSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapStrideLengthStatistics)
))
_sym_db.RegisterMessage(PbLapStrideLengthStatistics)
PbLapStatistics = _reflection.GeneratedProtocolMessageType('PbLapStatistics', (_message.Message,), dict(
DESCRIPTOR = _PBLAPSTATISTICS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapStatistics)
))
_sym_db.RegisterMessage(PbLapStatistics)
PbLap = _reflection.GeneratedProtocolMessageType('PbLap', (_message.Message,), dict(
DESCRIPTOR = _PBLAP,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLap)
))
_sym_db.RegisterMessage(PbLap)
PbLapSummary = _reflection.GeneratedProtocolMessageType('PbLapSummary', (_message.Message,), dict(
DESCRIPTOR = _PBLAPSUMMARY,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLapSummary)
))
_sym_db.RegisterMessage(PbLapSummary)
PbLaps = _reflection.GeneratedProtocolMessageType('PbLaps', (_message.Message,), dict(
DESCRIPTOR = _PBLAPS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbLaps)
))
_sym_db.RegisterMessage(PbLaps)
PbAutoLaps = _reflection.GeneratedProtocolMessageType('PbAutoLaps', (_message.Message,), dict(
DESCRIPTOR = _PBAUTOLAPS,
__module__ = 'exercise_laps_pb2'
# @@protoc_insertion_point(class_scope:data.PbAutoLaps)
))
_sym_db.RegisterMessage(PbAutoLaps)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/rr_recordtestresult_pb2.py | loophole/polar/pb/rr_recordtestresult_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: rr_recordtestresult.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='rr_recordtestresult.proto',
package='data',
serialized_pb=_b('\n\x19rr_recordtestresult.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\x93\x01\n\x17PbRRRecordingTestResult\x12$\n\nstart_time\x18\x01 \x02(\x0b\x32\x10.PbLocalDateTime\x12\"\n\x08\x65nd_time\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x0e\n\x06hr_avg\x18\x03 \x02(\r\x12\x0e\n\x06hr_min\x18\x04 \x02(\r\x12\x0e\n\x06hr_max\x18\x05 \x02(\r')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBRRRECORDINGTESTRESULT = _descriptor.Descriptor(
name='PbRRRecordingTestResult',
full_name='data.PbRRRecordingTestResult',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbRRRecordingTestResult.start_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_time', full_name='data.PbRRRecordingTestResult.end_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hr_avg', full_name='data.PbRRRecordingTestResult.hr_avg', index=2,
number=3, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hr_min', full_name='data.PbRRRecordingTestResult.hr_min', index=3,
number=4, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hr_max', full_name='data.PbRRRecordingTestResult.hr_max', index=4,
number=5, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=49,
serialized_end=196,
)
_PBRRRECORDINGTESTRESULT.fields_by_name['start_time'].message_type = types_pb2._PBLOCALDATETIME
_PBRRRECORDINGTESTRESULT.fields_by_name['end_time'].message_type = types_pb2._PBLOCALDATETIME
DESCRIPTOR.message_types_by_name['PbRRRecordingTestResult'] = _PBRRRECORDINGTESTRESULT
PbRRRecordingTestResult = _reflection.GeneratedProtocolMessageType('PbRRRecordingTestResult', (_message.Message,), dict(
DESCRIPTOR = _PBRRRECORDINGTESTRESULT,
__module__ = 'rr_recordtestresult_pb2'
# @@protoc_insertion_point(class_scope:data.PbRRRecordingTestResult)
))
_sym_db.RegisterMessage(PbRRRecordingTestResult)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_zones_pb2.py | loophole/polar/pb/exercise_zones_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_zones.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_zones.proto',
package='data',
serialized_pb=_b('\n\x14\x65xercise_zones.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\x1a\x0btypes.proto\"^\n\x17PbRecordedHeartRateZone\x12%\n\x0bzone_limits\x18\x01 \x02(\x0b\x32\x10.PbHeartRateZone\x12\x1c\n\x07in_zone\x18\x02 \x02(\x0b\x32\x0b.PbDuration\"V\n\x13PbRecordedPowerZone\x12!\n\x0bzone_limits\x18\x01 \x02(\x0b\x32\x0c.PbPowerZone\x12\x1c\n\x07in_zone\x18\x02 \x02(\x0b\x32\x0b.PbDuration\"k\n\x15PbRecordedFatFitZones\x12\x14\n\x0c\x66\x61tfit_limit\x18\x01 \x02(\r\x12\x1d\n\x08\x66\x61t_time\x18\x02 \x02(\x0b\x32\x0b.PbDuration\x12\x1d\n\x08\x66it_time\x18\x03 \x02(\x0b\x32\x0b.PbDuration\"u\n\x13PbRecordedSpeedZone\x12!\n\x0bzone_limits\x18\x01 \x02(\x0b\x32\x0c.PbSpeedZone\x12!\n\x0ctime_in_zone\x18\x02 \x01(\x0b\x32\x0b.PbDuration\x12\x18\n\x10\x64istance_in_zone\x18\x03 \x01(\x02\"\x8e\x03\n\x0fPbRecordedZones\x12\x36\n\x0fheart_rate_zone\x18\x01 \x03(\x0b\x32\x1d.data.PbRecordedHeartRateZone\x12-\n\npower_zone\x18\x02 \x03(\x0b\x32\x19.data.PbRecordedPowerZone\x12\x31\n\x0c\x66\x61tfit_zones\x18\x03 \x01(\x0b\x32\x1b.data.PbRecordedFatFitZones\x12-\n\nspeed_zone\x18\x04 \x03(\x0b\x32\x19.data.PbRecordedSpeedZone\x12@\n\x19heart_rate_setting_source\x18\n \x01(\x0e\x32\x1d.PbHeartRateZoneSettingSource\x12\x37\n\x14power_setting_source\x18\x0b \x01(\x0e\x32\x19.PbPowerZoneSettingSource\x12\x37\n\x14speed_setting_source\x18\x0c \x01(\x0e\x32\x19.PbSpeedZoneSettingSource')
,
dependencies=[structures_pb2.DESCRIPTOR,types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBRECORDEDHEARTRATEZONE = _descriptor.Descriptor(
name='PbRecordedHeartRateZone',
full_name='data.PbRecordedHeartRateZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='zone_limits', full_name='data.PbRecordedHeartRateZone.zone_limits', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='in_zone', full_name='data.PbRecordedHeartRateZone.in_zone', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=61,
serialized_end=155,
)
_PBRECORDEDPOWERZONE = _descriptor.Descriptor(
name='PbRecordedPowerZone',
full_name='data.PbRecordedPowerZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='zone_limits', full_name='data.PbRecordedPowerZone.zone_limits', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='in_zone', full_name='data.PbRecordedPowerZone.in_zone', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=157,
serialized_end=243,
)
_PBRECORDEDFATFITZONES = _descriptor.Descriptor(
name='PbRecordedFatFitZones',
full_name='data.PbRecordedFatFitZones',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='fatfit_limit', full_name='data.PbRecordedFatFitZones.fatfit_limit', index=0,
number=1, type=13, cpp_type=3, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fat_time', full_name='data.PbRecordedFatFitZones.fat_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fit_time', full_name='data.PbRecordedFatFitZones.fit_time', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=245,
serialized_end=352,
)
_PBRECORDEDSPEEDZONE = _descriptor.Descriptor(
name='PbRecordedSpeedZone',
full_name='data.PbRecordedSpeedZone',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='zone_limits', full_name='data.PbRecordedSpeedZone.zone_limits', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_in_zone', full_name='data.PbRecordedSpeedZone.time_in_zone', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='distance_in_zone', full_name='data.PbRecordedSpeedZone.distance_in_zone', index=2,
number=3, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=354,
serialized_end=471,
)
_PBRECORDEDZONES = _descriptor.Descriptor(
name='PbRecordedZones',
full_name='data.PbRecordedZones',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_rate_zone', full_name='data.PbRecordedZones.heart_rate_zone', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power_zone', full_name='data.PbRecordedZones.power_zone', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='fatfit_zones', full_name='data.PbRecordedZones.fatfit_zones', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_zone', full_name='data.PbRecordedZones.speed_zone', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='heart_rate_setting_source', full_name='data.PbRecordedZones.heart_rate_setting_source', index=4,
number=10, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='power_setting_source', full_name='data.PbRecordedZones.power_setting_source', index=5,
number=11, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='speed_setting_source', full_name='data.PbRecordedZones.speed_setting_source', index=6,
number=12, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=474,
serialized_end=872,
)
_PBRECORDEDHEARTRATEZONE.fields_by_name['zone_limits'].message_type = structures_pb2._PBHEARTRATEZONE
_PBRECORDEDHEARTRATEZONE.fields_by_name['in_zone'].message_type = types_pb2._PBDURATION
_PBRECORDEDPOWERZONE.fields_by_name['zone_limits'].message_type = structures_pb2._PBPOWERZONE
_PBRECORDEDPOWERZONE.fields_by_name['in_zone'].message_type = types_pb2._PBDURATION
_PBRECORDEDFATFITZONES.fields_by_name['fat_time'].message_type = types_pb2._PBDURATION
_PBRECORDEDFATFITZONES.fields_by_name['fit_time'].message_type = types_pb2._PBDURATION
_PBRECORDEDSPEEDZONE.fields_by_name['zone_limits'].message_type = structures_pb2._PBSPEEDZONE
_PBRECORDEDSPEEDZONE.fields_by_name['time_in_zone'].message_type = types_pb2._PBDURATION
_PBRECORDEDZONES.fields_by_name['heart_rate_zone'].message_type = _PBRECORDEDHEARTRATEZONE
_PBRECORDEDZONES.fields_by_name['power_zone'].message_type = _PBRECORDEDPOWERZONE
_PBRECORDEDZONES.fields_by_name['fatfit_zones'].message_type = _PBRECORDEDFATFITZONES
_PBRECORDEDZONES.fields_by_name['speed_zone'].message_type = _PBRECORDEDSPEEDZONE
_PBRECORDEDZONES.fields_by_name['heart_rate_setting_source'].enum_type = types_pb2._PBHEARTRATEZONESETTINGSOURCE
_PBRECORDEDZONES.fields_by_name['power_setting_source'].enum_type = types_pb2._PBPOWERZONESETTINGSOURCE
_PBRECORDEDZONES.fields_by_name['speed_setting_source'].enum_type = types_pb2._PBSPEEDZONESETTINGSOURCE
DESCRIPTOR.message_types_by_name['PbRecordedHeartRateZone'] = _PBRECORDEDHEARTRATEZONE
DESCRIPTOR.message_types_by_name['PbRecordedPowerZone'] = _PBRECORDEDPOWERZONE
DESCRIPTOR.message_types_by_name['PbRecordedFatFitZones'] = _PBRECORDEDFATFITZONES
DESCRIPTOR.message_types_by_name['PbRecordedSpeedZone'] = _PBRECORDEDSPEEDZONE
DESCRIPTOR.message_types_by_name['PbRecordedZones'] = _PBRECORDEDZONES
PbRecordedHeartRateZone = _reflection.GeneratedProtocolMessageType('PbRecordedHeartRateZone', (_message.Message,), dict(
DESCRIPTOR = _PBRECORDEDHEARTRATEZONE,
__module__ = 'exercise_zones_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecordedHeartRateZone)
))
_sym_db.RegisterMessage(PbRecordedHeartRateZone)
PbRecordedPowerZone = _reflection.GeneratedProtocolMessageType('PbRecordedPowerZone', (_message.Message,), dict(
DESCRIPTOR = _PBRECORDEDPOWERZONE,
__module__ = 'exercise_zones_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecordedPowerZone)
))
_sym_db.RegisterMessage(PbRecordedPowerZone)
PbRecordedFatFitZones = _reflection.GeneratedProtocolMessageType('PbRecordedFatFitZones', (_message.Message,), dict(
DESCRIPTOR = _PBRECORDEDFATFITZONES,
__module__ = 'exercise_zones_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecordedFatFitZones)
))
_sym_db.RegisterMessage(PbRecordedFatFitZones)
PbRecordedSpeedZone = _reflection.GeneratedProtocolMessageType('PbRecordedSpeedZone', (_message.Message,), dict(
DESCRIPTOR = _PBRECORDEDSPEEDZONE,
__module__ = 'exercise_zones_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecordedSpeedZone)
))
_sym_db.RegisterMessage(PbRecordedSpeedZone)
PbRecordedZones = _reflection.GeneratedProtocolMessageType('PbRecordedZones', (_message.Message,), dict(
DESCRIPTOR = _PBRECORDEDZONES,
__module__ = 'exercise_zones_pb2'
# @@protoc_insertion_point(class_scope:data.PbRecordedZones)
))
_sym_db.RegisterMessage(PbRecordedZones)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_maserati_settings_pb2.py | loophole/polar/pb/sportprofile_maserati_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_maserati_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_maserati_settings.proto',
package='data',
serialized_pb=_b('\n$sportprofile_maserati_settings.proto\x12\x04\x64\x61ta\"\xfc\x03\n\x1ePbMaseratiSportProfileSettings\x12\x46\n\x0bheart_touch\x18\x01 \x01(\x0e\x32\x31.data.PbMaseratiSportProfileSettings.PbHeartTouch\x12Q\n\x11tap_button_action\x18\x02 \x01(\x0e\x32\x36.data.PbMaseratiSportProfileSettings.PbTapButtonAction\x12\x11\n\tvibration\x18\x03 \x01(\x08\x12\x12\n\nauto_start\x18\x04 \x01(\x08\"\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04\"\x88\x01\n\x11PbTapButtonAction\x12\x12\n\x0eTAP_BUTTON_OFF\x10\x01\x12\x17\n\x13TAP_BUTTON_TAKE_LAP\x10\x02\x12#\n\x1fTAP_BUTTON_CHANGE_TRAINING_VIEW\x10\x03\x12!\n\x1dTAP_BUTTON_ACTIVATE_BACKLIGHT\x10\x04')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBMASERATISPORTPROFILESETTINGS_PBHEARTTOUCH = _descriptor.EnumDescriptor(
name='PbHeartTouch',
full_name='data.PbMaseratiSportProfileSettings.PbHeartTouch',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_PREVIOUS_LAP', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_TIME_OF_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=276,
serialized_end=416,
)
_sym_db.RegisterEnumDescriptor(_PBMASERATISPORTPROFILESETTINGS_PBHEARTTOUCH)
_PBMASERATISPORTPROFILESETTINGS_PBTAPBUTTONACTION = _descriptor.EnumDescriptor(
name='PbTapButtonAction',
full_name='data.PbMaseratiSportProfileSettings.PbTapButtonAction',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_TAKE_LAP', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_CHANGE_TRAINING_VIEW', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='TAP_BUTTON_ACTIVATE_BACKLIGHT', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=419,
serialized_end=555,
)
_sym_db.RegisterEnumDescriptor(_PBMASERATISPORTPROFILESETTINGS_PBTAPBUTTONACTION)
_PBMASERATISPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbMaseratiSportProfileSettings',
full_name='data.PbMaseratiSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_touch', full_name='data.PbMaseratiSportProfileSettings.heart_touch', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='tap_button_action', full_name='data.PbMaseratiSportProfileSettings.tap_button_action', index=1,
number=2, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vibration', full_name='data.PbMaseratiSportProfileSettings.vibration', index=2,
number=3, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbMaseratiSportProfileSettings.auto_start', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBMASERATISPORTPROFILESETTINGS_PBHEARTTOUCH,
_PBMASERATISPORTPROFILESETTINGS_PBTAPBUTTONACTION,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=47,
serialized_end=555,
)
_PBMASERATISPORTPROFILESETTINGS.fields_by_name['heart_touch'].enum_type = _PBMASERATISPORTPROFILESETTINGS_PBHEARTTOUCH
_PBMASERATISPORTPROFILESETTINGS.fields_by_name['tap_button_action'].enum_type = _PBMASERATISPORTPROFILESETTINGS_PBTAPBUTTONACTION
_PBMASERATISPORTPROFILESETTINGS_PBHEARTTOUCH.containing_type = _PBMASERATISPORTPROFILESETTINGS
_PBMASERATISPORTPROFILESETTINGS_PBTAPBUTTONACTION.containing_type = _PBMASERATISPORTPROFILESETTINGS
DESCRIPTOR.message_types_by_name['PbMaseratiSportProfileSettings'] = _PBMASERATISPORTPROFILESETTINGS
PbMaseratiSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbMaseratiSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBMASERATISPORTPROFILESETTINGS,
__module__ = 'sportprofile_maserati_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbMaseratiSportProfileSettings)
))
_sym_db.RegisterMessage(PbMaseratiSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/device_pb2.py | loophole/polar/pb/device_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: device.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import structures_pb2 as structures__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='device.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x0c\x64\x65vice.proto\x12\x04\x64\x61ta\x1a\x10structures.proto\"\xd4\x04\n\x0cPbDeviceInfo\x12&\n\x12\x62ootloader_version\x18\x01 \x01(\x0b\x32\n.PbVersion\x12$\n\x10platform_version\x18\x02 \x01(\x0b\x32\n.PbVersion\x12\"\n\x0e\x64\x65vice_version\x18\x03 \x01(\x0b\x32\n.PbVersion\x12\x0f\n\x07svn_rev\x18\x04 \x01(\r\x12 \n\x18\x65lectrical_serial_number\x18\x05 \x01(\t\x12\x10\n\x08\x64\x65viceID\x18\x06 \x01(\t\x12\x12\n\nmodel_name\x18\x07 \x01(\t\x12\x15\n\rhardware_code\x18\x08 \x01(\t\x12\x15\n\rproduct_color\x18\t \x01(\t\x12\x16\n\x0eproduct_design\x18\n \x01(\t\x12\x11\n\tsystem_id\x18\x0b \x01(\t\x12\x10\n\x08git_hash\x18\x0c \x01(\x0c\x12*\n\x16polarmathsmart_version\x18\r \x01(\x0b\x32\n.PbVersion\x12/\n\x12sub_component_info\x18\x0e \x03(\x0b\x32\x13.PbSubcomponentInfo\x12\x38\n\rdisplay_shape\x18\x0f \x01(\x0e\x32!.data.PbDeviceInfo.PbDisplayShape\x12.\n\x11\x61lgorithm_version\x18\x10 \x01(\x0b\x32\x13.PbAlgorithmVersion\"G\n\x0ePbDisplayShape\x12\r\n\tRECTANGLE\x10\x00\x12\x0f\n\x0b\x46ULLY_ROUND\x10\x01\x12\x15\n\x11ROUND_FLAT_BOTTOM\x10\x02')
,
dependencies=[structures__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBDEVICEINFO_PBDISPLAYSHAPE = _descriptor.EnumDescriptor(
name='PbDisplayShape',
full_name='data.PbDeviceInfo.PbDisplayShape',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='RECTANGLE', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FULLY_ROUND', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ROUND_FLAT_BOTTOM', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=566,
serialized_end=637,
)
_sym_db.RegisterEnumDescriptor(_PBDEVICEINFO_PBDISPLAYSHAPE)
_PBDEVICEINFO = _descriptor.Descriptor(
name='PbDeviceInfo',
full_name='data.PbDeviceInfo',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='bootloader_version', full_name='data.PbDeviceInfo.bootloader_version', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='platform_version', full_name='data.PbDeviceInfo.platform_version', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='device_version', full_name='data.PbDeviceInfo.device_version', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='svn_rev', full_name='data.PbDeviceInfo.svn_rev', index=3,
number=4, type=13, cpp_type=3, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='electrical_serial_number', full_name='data.PbDeviceInfo.electrical_serial_number', index=4,
number=5, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='deviceID', full_name='data.PbDeviceInfo.deviceID', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='model_name', full_name='data.PbDeviceInfo.model_name', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='hardware_code', full_name='data.PbDeviceInfo.hardware_code', index=7,
number=8, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='product_color', full_name='data.PbDeviceInfo.product_color', index=8,
number=9, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='product_design', full_name='data.PbDeviceInfo.product_design', index=9,
number=10, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='system_id', full_name='data.PbDeviceInfo.system_id', index=10,
number=11, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='git_hash', full_name='data.PbDeviceInfo.git_hash', index=11,
number=12, type=12, cpp_type=9, label=1,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='polarmathsmart_version', full_name='data.PbDeviceInfo.polarmathsmart_version', index=12,
number=13, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='sub_component_info', full_name='data.PbDeviceInfo.sub_component_info', index=13,
number=14, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='display_shape', full_name='data.PbDeviceInfo.display_shape', index=14,
number=15, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='algorithm_version', full_name='data.PbDeviceInfo.algorithm_version', index=15,
number=16, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBDEVICEINFO_PBDISPLAYSHAPE,
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=41,
serialized_end=637,
)
_PBDEVICEINFO.fields_by_name['bootloader_version'].message_type = structures__pb2._PBVERSION
_PBDEVICEINFO.fields_by_name['platform_version'].message_type = structures__pb2._PBVERSION
_PBDEVICEINFO.fields_by_name['device_version'].message_type = structures__pb2._PBVERSION
_PBDEVICEINFO.fields_by_name['polarmathsmart_version'].message_type = structures__pb2._PBVERSION
_PBDEVICEINFO.fields_by_name['sub_component_info'].message_type = structures__pb2._PBSUBCOMPONENTINFO
_PBDEVICEINFO.fields_by_name['display_shape'].enum_type = _PBDEVICEINFO_PBDISPLAYSHAPE
_PBDEVICEINFO.fields_by_name['algorithm_version'].message_type = structures__pb2._PBALGORITHMVERSION
_PBDEVICEINFO_PBDISPLAYSHAPE.containing_type = _PBDEVICEINFO
DESCRIPTOR.message_types_by_name['PbDeviceInfo'] = _PBDEVICEINFO
PbDeviceInfo = _reflection.GeneratedProtocolMessageType('PbDeviceInfo', (_message.Message,), dict(
DESCRIPTOR = _PBDEVICEINFO,
__module__ = 'device_pb2'
# @@protoc_insertion_point(class_scope:data.PbDeviceInfo)
))
_sym_db.RegisterMessage(PbDeviceInfo)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/sportprofile_ace_settings_pb2.py | loophole/polar/pb/sportprofile_ace_settings_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: sportprofile_ace_settings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='sportprofile_ace_settings.proto',
package='data',
serialized_pb=_b('\n\x1fsportprofile_ace_settings.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"\xc5\x02\n\x19PbAceSportProfileSettings\x12\x41\n\x0bheart_touch\x18\x01 \x01(\x0e\x32,.data.PbAceSportProfileSettings.PbHeartTouch\x12\x12\n\nauto_start\x18\x04 \x01(\x08\x12\x42\n\x1cstride_sensor_calib_settings\x18\x06 \x01(\x0b\x32\x1c.PbStrideSensorCalibSettings\"\x8c\x01\n\x0cPbHeartTouch\x12\x13\n\x0fHEART_TOUCH_OFF\x10\x01\x12\"\n\x1eHEART_TOUCH_ACTIVATE_BACKLIGHT\x10\x02\x12!\n\x1dHEART_TOUCH_SHOW_PREVIOUS_LAP\x10\x03\x12 \n\x1cHEART_TOUCH_SHOW_TIME_OF_DAY\x10\x04')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBACESPORTPROFILESETTINGS_PBHEARTTOUCH = _descriptor.EnumDescriptor(
name='PbHeartTouch',
full_name='data.PbAceSportProfileSettings.PbHeartTouch',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_OFF', index=0, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_ACTIVATE_BACKLIGHT', index=1, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_PREVIOUS_LAP', index=2, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='HEART_TOUCH_SHOW_TIME_OF_DAY', index=3, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=240,
serialized_end=380,
)
_sym_db.RegisterEnumDescriptor(_PBACESPORTPROFILESETTINGS_PBHEARTTOUCH)
_PBACESPORTPROFILESETTINGS = _descriptor.Descriptor(
name='PbAceSportProfileSettings',
full_name='data.PbAceSportProfileSettings',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='heart_touch', full_name='data.PbAceSportProfileSettings.heart_touch', index=0,
number=1, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=1,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='auto_start', full_name='data.PbAceSportProfileSettings.auto_start', index=1,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='stride_sensor_calib_settings', full_name='data.PbAceSportProfileSettings.stride_sensor_calib_settings', index=2,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBACESPORTPROFILESETTINGS_PBHEARTTOUCH,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=55,
serialized_end=380,
)
_PBACESPORTPROFILESETTINGS.fields_by_name['heart_touch'].enum_type = _PBACESPORTPROFILESETTINGS_PBHEARTTOUCH
_PBACESPORTPROFILESETTINGS.fields_by_name['stride_sensor_calib_settings'].message_type = types_pb2._PBSTRIDESENSORCALIBSETTINGS
_PBACESPORTPROFILESETTINGS_PBHEARTTOUCH.containing_type = _PBACESPORTPROFILESETTINGS
DESCRIPTOR.message_types_by_name['PbAceSportProfileSettings'] = _PBACESPORTPROFILESETTINGS
PbAceSportProfileSettings = _reflection.GeneratedProtocolMessageType('PbAceSportProfileSettings', (_message.Message,), dict(
DESCRIPTOR = _PBACESPORTPROFILESETTINGS,
__module__ = 'sportprofile_ace_settings_pb2'
# @@protoc_insertion_point(class_scope:data.PbAceSportProfileSettings)
))
_sym_db.RegisterMessage(PbAceSportProfileSettings)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/exercise_rr_samples_pb2.py | loophole/polar/pb/exercise_rr_samples_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: exercise_rr_samples.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2 as types__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='exercise_rr_samples.proto',
package='data',
syntax='proto2',
serialized_pb=_b('\n\x19\x65xercise_rr_samples.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"R\n\x0bPbRROffline\x12\x1f\n\nstart_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12\"\n\rtime_interval\x18\x02 \x02(\x0b\x32\x0b.PbDuration\"[\n\x15PbExerciseRRIntervals\x12\x14\n\x0crr_intervals\x18\x01 \x03(\r\x12,\n\x11rr_sensor_offline\x18\x02 \x03(\x0b\x32\x11.data.PbRROffline')
,
dependencies=[types__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBRROFFLINE = _descriptor.Descriptor(
name='PbRROffline',
full_name='data.PbRROffline',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbRROffline.start_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='time_interval', full_name='data.PbRROffline.time_interval', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=48,
serialized_end=130,
)
_PBEXERCISERRINTERVALS = _descriptor.Descriptor(
name='PbExerciseRRIntervals',
full_name='data.PbExerciseRRIntervals',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='rr_intervals', full_name='data.PbExerciseRRIntervals.rr_intervals', index=0,
number=1, type=13, cpp_type=3, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='rr_sensor_offline', full_name='data.PbExerciseRRIntervals.rr_sensor_offline', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=132,
serialized_end=223,
)
_PBRROFFLINE.fields_by_name['start_time'].message_type = types__pb2._PBDURATION
_PBRROFFLINE.fields_by_name['time_interval'].message_type = types__pb2._PBDURATION
_PBEXERCISERRINTERVALS.fields_by_name['rr_sensor_offline'].message_type = _PBRROFFLINE
DESCRIPTOR.message_types_by_name['PbRROffline'] = _PBRROFFLINE
DESCRIPTOR.message_types_by_name['PbExerciseRRIntervals'] = _PBEXERCISERRINTERVALS
PbRROffline = _reflection.GeneratedProtocolMessageType('PbRROffline', (_message.Message,), dict(
DESCRIPTOR = _PBRROFFLINE,
__module__ = 'exercise_rr_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbRROffline)
))
_sym_db.RegisterMessage(PbRROffline)
PbExerciseRRIntervals = _reflection.GeneratedProtocolMessageType('PbExerciseRRIntervals', (_message.Message,), dict(
DESCRIPTOR = _PBEXERCISERRINTERVALS,
__module__ = 'exercise_rr_samples_pb2'
# @@protoc_insertion_point(class_scope:data.PbExerciseRRIntervals)
))
_sym_db.RegisterMessage(PbExerciseRRIntervals)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
rsc-dev/loophole | https://github.com/rsc-dev/loophole/blob/f9389c73f06b419c97ad32847346663a30d80225/loophole/polar/pb/jumptest_pb2.py | loophole/polar/pb/jumptest_pb2.py | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: jumptest.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='jumptest.proto',
package='data',
serialized_pb=_b('\n\x0ejumptest.proto\x12\x04\x64\x61ta\x1a\x0btypes.proto\"M\n\x06PbJump\x12 \n\x0b\x66light_time\x18\x01 \x02(\x0b\x32\x0b.PbDuration\x12!\n\x0c\x63ontact_time\x18\x02 \x01(\x0b\x32\x0b.PbDuration\"\x92\x02\n\nPbJumpTest\x12\x32\n\ttest_type\x18\x01 \x02(\x0e\x32\x1f.data.PbJumpTest.PbJumpTestType\x12$\n\nstart_time\x18\x02 \x02(\x0b\x32\x10.PbLocalDateTime\x12\x1a\n\x04jump\x18\x03 \x03(\x0b\x32\x0c.data.PbJump\x12\'\n\x12\x63ont_jump_duration\x18\x04 \x01(\x0b\x32\x0b.PbDuration\"e\n\x0ePbJumpTestType\x12\x18\n\x14JUMP_TEST_TYPE_SQUAT\x10\x00\x12\x1a\n\x16JUMP_TEST_TYPE_COUNTER\x10\x01\x12\x1d\n\x19JUMP_TEST_TYPE_CONTINUOUS\x10\x02')
,
dependencies=[types_pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_PBJUMPTEST_PBJUMPTESTTYPE = _descriptor.EnumDescriptor(
name='PbJumpTestType',
full_name='data.PbJumpTest.PbJumpTestType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='JUMP_TEST_TYPE_SQUAT', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JUMP_TEST_TYPE_COUNTER', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='JUMP_TEST_TYPE_CONTINUOUS', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=290,
serialized_end=391,
)
_sym_db.RegisterEnumDescriptor(_PBJUMPTEST_PBJUMPTESTTYPE)
_PBJUMP = _descriptor.Descriptor(
name='PbJump',
full_name='data.PbJump',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='flight_time', full_name='data.PbJump.flight_time', index=0,
number=1, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='contact_time', full_name='data.PbJump.contact_time', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=37,
serialized_end=114,
)
_PBJUMPTEST = _descriptor.Descriptor(
name='PbJumpTest',
full_name='data.PbJumpTest',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='test_type', full_name='data.PbJumpTest.test_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_time', full_name='data.PbJumpTest.start_time', index=1,
number=2, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='jump', full_name='data.PbJumpTest.jump', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cont_jump_duration', full_name='data.PbJumpTest.cont_jump_duration', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_PBJUMPTEST_PBJUMPTESTTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=117,
serialized_end=391,
)
_PBJUMP.fields_by_name['flight_time'].message_type = types_pb2._PBDURATION
_PBJUMP.fields_by_name['contact_time'].message_type = types_pb2._PBDURATION
_PBJUMPTEST.fields_by_name['test_type'].enum_type = _PBJUMPTEST_PBJUMPTESTTYPE
_PBJUMPTEST.fields_by_name['start_time'].message_type = types_pb2._PBLOCALDATETIME
_PBJUMPTEST.fields_by_name['jump'].message_type = _PBJUMP
_PBJUMPTEST.fields_by_name['cont_jump_duration'].message_type = types_pb2._PBDURATION
_PBJUMPTEST_PBJUMPTESTTYPE.containing_type = _PBJUMPTEST
DESCRIPTOR.message_types_by_name['PbJump'] = _PBJUMP
DESCRIPTOR.message_types_by_name['PbJumpTest'] = _PBJUMPTEST
PbJump = _reflection.GeneratedProtocolMessageType('PbJump', (_message.Message,), dict(
DESCRIPTOR = _PBJUMP,
__module__ = 'jumptest_pb2'
# @@protoc_insertion_point(class_scope:data.PbJump)
))
_sym_db.RegisterMessage(PbJump)
PbJumpTest = _reflection.GeneratedProtocolMessageType('PbJumpTest', (_message.Message,), dict(
DESCRIPTOR = _PBJUMPTEST,
__module__ = 'jumptest_pb2'
# @@protoc_insertion_point(class_scope:data.PbJumpTest)
))
_sym_db.RegisterMessage(PbJumpTest)
# @@protoc_insertion_point(module_scope)
| python | MIT | f9389c73f06b419c97ad32847346663a30d80225 | 2026-01-05T07:13:01.675884Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/setup.py | setup.py | from setuptools import setup
# Load version
import yahoo_quote_download
version = yahoo_quote_download.__version__
#print("Version :", version)
# Load README.md as long description
with open("README.md", "r") as fh:
long_description = fh.read()
setup(name='yahoo_quote_download',
version=version,
description='Yahoo Quote Downloader',
author='c0redumb',
url='https://github.com/c0redumb/yahoo_quote_download',
long_description=long_description,
long_description_content_type="text/markdown",
license="BSD 2-Clause License",
packages=['yahoo_quote_download'],
install_requires=[
'six',
],
classifiers=["Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
],
zip_safe=False,
entry_points={
'console_scripts': [
'yqdownload=yahoo_quote_download.downloader:main',
],
},
)
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/tests/test_yqd.py | tests/test_yqd.py | # -*- coding: utf-8 -*-
"""
test_yqd.py - YQD tester
Created on May 20 2017
@author: c0redumb
"""
from yahoo_quote_download import yqd, validater
def load_quote(ticker):
print('===', ticker, '===')
print(yqd.load_yahoo_quote(ticker, '20181201', '20181231'))
print(yqd.load_yahoo_quote(ticker, '20181201', '20181231', 'dividend'))
print(yqd.load_yahoo_quote(ticker, '20181201', '20181231', 'split'))
def test_validate():
print("Testing validator ...")
data = ['Date,Open,High,Low,Close,Adj Close,Volume',
'2019-12-31,100.10,101.20,99.50,100.70,100.70,100000',
'2020-01-01,100.10,101.20,99.50,100.70,100.70,100000',
'2020-01-02,105.10,101.20,99.50,100.70,100.70,150000',
'2020-01-03,100.10,101.20,99.50,200.70,160.70,120000',
'2020-01-03,100.10,101.20,99.50,200.70,160.70,120000',
''
]
print("Original Data:", data)
print("Validated Data:", validater.validate(
'TEST', data, begindate='2020-01-01', verbose=99))
def test():
# Download quote for stocks
load_quote('QCOM')
load_quote('C')
# Download quote for index
load_quote('^DJI')
# Test validating data
test_validate()
if __name__ == '__main__':
test()
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/yahoo_quote_download/validater.py | yahoo_quote_download/validater.py | # -*- coding: utf-8 -*-
"""
validate.py - Trivial data validater
Created on December 24, 2019
@author: c0redumb
"""
# To make print working for Python2/3
from __future__ import print_function
def validate(ticker, data, begindate='1920-01-01', verbose=0):
'''
This function perform a query and extract the matching cookie and crumb.
'''
new_data = []
last_date = None
for line in data:
# Filename lines, usually the first line
# Zero length lines, usually the last line
if len(line) == 0 or line.startswith('Date'):
new_data.append(line)
continue
# Extract all the fields
try:
field = line.split(',')
d = field[0]
o = float(field[1])
h = float(field[2])
l = float(field[3])
c = float(field[4])
adj_c = float(field[5])
except:
#print("Failed to parse:", line)
continue
# This is a wierd quirk we need to check
invalid_date = False
if last_date is None:
if d < begindate:
invalid_date = True
last_date = d
else:
if d <= last_date:
invalid_date = True
else:
last_date = d
if invalid_date:
if verbose > 0:
print("!!! {}: Invalid date {} in data".format(
ticker, field[0]))
continue
# Verify that the open/close is within the high/low range
mid = (h + l) / 2
corrected = False
if o > h * 1.0001 or o < l * 0.9999:
o = mid
corrected = True
if verbose > 0:
print("!!! {}: Open is out of range on {}".format(
ticker, field[0]))
if c > h * 1.0001 or c < l * 0.9999:
if c != 0.0:
adj_c *= mid / c
else:
adj_c = mid
c = mid
corrected = True
if verbose > 0:
print("!!! {}: Close is out of range on {}".format(
ticker, field[0]))
if corrected:
if verbose > 5:
print(line)
line = "{},{},{},{},{},{},{}".format(
field[0], o, h, l, c, adj_c, field[6])
if verbose > 5:
print(line)
new_data.append(line)
return new_data
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/yahoo_quote_download/yqd.py | yahoo_quote_download/yqd.py | # -*- coding: utf-8 -*-
"""
yqd.py - Yahoo Quote Downloader
Created on May 18 2017
@author: c0redumb
"""
# To make print working for Python2/3
from __future__ import print_function
# Use six to import urllib so it is working for Python2/3
from six.moves import urllib
# If you don't want to use six, please comment out the line above
# and use the line below instead (for Python3 only).
#import urllib.request, urllib.parse, urllib.error
import time
'''
Starting on May 2017, Yahoo financial has terminated its service on
the well used EOD data download without warning. This is confirmed
by Yahoo employee in forum posts.
Yahoo financial EOD data, however, still works on Yahoo financial pages.
These download links uses a "crumb" for authentication with a cookie "B".
This code is provided to obtain such matching cookie and crumb.
'''
# Build the cookie handler
cookier = urllib.request.HTTPCookieProcessor()
opener = urllib.request.build_opener(cookier)
urllib.request.install_opener(opener)
# Cookie and corresponding crumb
_cookie = None
_crumb = None
# Headers to fake a user agent
_headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36'
}
def _get_cookie_crumb():
'''
This function perform a query and extract the matching cookie and crumb.
'''
global cookier, _cookie, _crumb
# Perform a Yahoo financial lookup on SP500
cookier.cookiejar.clear()
req = urllib.request.Request(
'https://finance.yahoo.com/quote/^GSPC', headers=_headers)
f = urllib.request.urlopen(req, timeout=5)
alines = f.read().decode('utf-8')
# Extract the crumb from the response
cs = alines.find('CrumbStore')
cr = alines.find('crumb', cs + 10)
cl = alines.find(':', cr + 5)
q1 = alines.find('"', cl + 1)
q2 = alines.find('"', q1 + 1)
crumb = alines[q1 + 1:q2]
_crumb = crumb
# Extract the cookie from cookiejar
for c in cookier.cookiejar:
if c.domain != '.yahoo.com':
continue
if c.name != 'B':
continue
_cookie = c.value
# Print the cookie and crumb
#print('Cookie:', _cookie)
#print('Crumb:', _crumb)
def load_yahoo_quote(ticker, begindate, enddate, info='quote'):
'''
This function load the corresponding history/divident/split from Yahoo.
The "begindate" and "enddate" are in the format of YYYYMMDD.
The "info" can be "quote" for price, "divident" for divident events,
or "split" for split events.
'''
# Check to make sure that the cookie and crumb has been loaded
global _cookie, _crumb
if _cookie == None or _crumb == None:
_get_cookie_crumb()
# Prepare the parameters and the URL
tb = time.mktime((int(begindate[0:4]), int(
begindate[4:6]), int(begindate[6:8]), 4, 0, 0, 0, 0, 0))
te = time.mktime((int(enddate[0:4]), int(
enddate[4:6]), int(enddate[6:8]), 18, 0, 0, 0, 0, 0))
param = dict()
param['period1'] = int(tb)
param['period2'] = int(te)
param['interval'] = '1d'
if info == 'quote':
param['events'] = 'history'
elif info == 'dividend':
param['events'] = 'div'
elif info == 'split':
param['events'] = 'split'
param['crumb'] = _crumb
params = urllib.parse.urlencode(param)
url = 'https://query1.finance.yahoo.com/v7/finance/download/{}?{}'.format(
ticker, params)
# print(url)
req = urllib.request.Request(url, headers=_headers)
# Perform the query
# There is no need to enter the cookie here, as it is automatically handled by opener
f = urllib.request.urlopen(req, timeout=5)
alines = f.read().decode('utf-8')
# print(alines)
return alines.split('\n')
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/yahoo_quote_download/downloader.py | yahoo_quote_download/downloader.py | # -*- coding: utf-8 -*-
"""
downloader.py - Commandline downloader
Created on December 25, 2019
@author: c0redumb
"""
import os
import time
import datetime
import traceback
import argparse
from yahoo_quote_download import yqd, validater, __version__
def main():
# parse arguments
parser = argparse.ArgumentParser(
description='Yahoo Quote Downloader v' + __version__)
parser.add_argument("-t", "--ticker", dest="ticker",
required=True, help="The ticker")
parser.add_argument("-b", "--begindate", dest="begindate",
help="The beginning date (YYYY-MM-DD)")
parser.add_argument("-e", "--enddate", dest="enddate",
help="The end date (YYYY-MM-DD)")
parser.add_argument("-f", "--datafile", dest="datafile",
required=True, help="The destination data file")
parser.add_argument("-m", "--max-retry", dest="maxretries", default=5, type=int,
help="The maximum number of retries")
parser.add_argument("-v", "--verbose", dest="verbose", default=1, type=int,
help="Verbose level")
parser.add_argument("--version", action="version", version=__version__)
args = parser.parse_args()
if args.verbose > 0:
print("Downloading {} ...".format(args.ticker))
# Increment mode (only download the necessary data after what is already in the datafile)
# Increment mode is only used when
# - A last date can be extracted from the datafile AND
# - A beginning date is not specified in the commandline
increment_mode = False
data_in_file = []
today = datetime.datetime.today()
today_str = today.strftime('%Y-%m-%d')
# Determine the starting date if it is not provided
# If it can be extracted from the last line of the data file, then we use the next day
# Otherwise we use a standard starting date 1970-01-01
if args.begindate is None:
# Try to extract the last day in the data file
if os.path.exists(args.datafile):
with open(args.datafile) as df:
# Read all the lines that is currently in datafile
for cnt, line in enumerate(df):
if len(line) >= 10: # At least has a date
data_in_file.append(line)
# Extract the last date
try:
# Extract the first day date (in case we need to redownload the whole thing)
firstline = data_in_file[1]
firstday_str = firstline.split(',')[0].strip()
firstday = datetime.datetime.strptime(
firstday_str, '%Y-%m-%d')
# Extract the last day date (for increment mode)
lastline = data_in_file[-1]
lastday_str = lastline.split(',')[0].strip()
lastday = datetime.datetime.strptime(
lastday_str, '%Y-%m-%d')
if lastday_str >= today_str:
if args.verbose > 0:
print('{}: datafile ({}) is update to today {}'.format(
args.ticker, lastday_str, today_str))
print('Nothing to download')
return
nextday = lastday + datetime.timedelta(days=1)
nextday_str = nextday.strftime('%Y-%m-%d')
if args.verbose > 5:
print('Last Date:', lastday_str,
', Next Day:', nextday_str,
', First Day:', firstday_str)
args.begindate = nextday_str
# All good, and set the increment mode
increment_mode = True
except:
if args.verbose > 0:
print('!!! {}: failed to extract last date from date file'.format(
args.ticker))
data_in_file = []
if args.begindate is None:
# Two cases we are here:
# 1. The datafile does not exist yet, or
# 2. The datefile exists, but we failed to extract the last date
args.begindate = '1970-01-01'
# Determine the end date if it is not provided
# It will be default to today's date
if args.enddate is None:
args.enddate = today_str
# Print the parameters
if args.verbose > 1:
print(" Ticker:", args.ticker)
print(" Beginning:", args.begindate)
print(" Ending:", args.enddate)
print(" File:", args.datafile)
success = False
for itry in range(args.maxretries):
try:
# Do a download of split and divident first in increment mode.
# If such events exist, the scale will be adjusted for the entire sequence.
# In those cases, we will need to redownload from the very beginning.
if increment_mode:
div_data = yqd.load_yahoo_quote(args.ticker,
args.begindate.replace(
'-', ""),
args.enddate.replace('-', ''),
info='dividend')
has_div_event = (len(div_data) > 2 and len(div_data[-1]) > 10)
split_data = yqd.load_yahoo_quote(args.ticker,
args.begindate.replace(
'-', ""),
args.enddate.replace(
'-', ''),
info='split')
has_split_event = (
len(split_data) > 2 and len(split_data[-1]) > 10)
if has_div_event or has_split_event:
print('!!! {}: Has a recent event (dividend or split)')
args.begindate = firstday
increment_mode = False
# Finally download the data
data = yqd.load_yahoo_quote(args.ticker,
args.begindate.replace('-', ""),
args.enddate.replace('-', ''))
success = True
break
except:
if args.verbose > 2:
print("Try {}/{} failed".format(itry + 1, args.maxretries))
# traceback.print_exc()
# Download failed. Will retry in 2 seconds, until maxretries is reached,
# Setting _crumb to None will force yqd to obtain a new set of cookies.
# This solves the intermittent "401 Unauthorized" issue.
yqd._crumb = None
time.sleep(2)
if success:
if args.verbose > 0:
print("Data download successful")
#print("Dump", data)
vdata = validater.validate(
args.ticker, data, begindate=args.begindate, verbose=args.verbose)
with open(args.datafile, "w") as f:
if increment_mode:
# Write back the original data in file
for line in data_in_file:
f.write(line)
# Remove the field headline for the newly downloaded data
del vdata[0]
for line in vdata:
# Skip lines that are empty
if len(line) == 0:
continue
f.write(line)
f.write('\n')
else:
print("!!! {}: Download unsuccessful!".format(args.ticker))
if __name__ == '__main__':
main()
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
c0redumb/yahoo_quote_download | https://github.com/c0redumb/yahoo_quote_download/blob/06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec/yahoo_quote_download/__init__.py | yahoo_quote_download/__init__.py | __version__ = '0.3.2'
| python | BSD-2-Clause | 06a3c2d0d88be4bb491d4a1c89e40f4f0fd78eec | 2026-01-05T07:13:02.327066Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tools/gherkinize.py | tools/gherkinize.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2025 The Cloud Custodian Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
The ``gherkinize.py`` tool converts a ``.textproto`` test case collection into a Gherkin ``.feature`` file.
This can be used to update the conformance tests in the ``features`` directory.
Synopsis
--------
.. program:: python tools/gherkinize.py [-o output] [-sv] source
.. option:: -o <output>, --output <output>
Where to write the feature file.
Generally, it's helpful to have the ``.textproto`` and ``.feature`` stems match.
The ``Makefile`` assures this.
.. option:: -s, --silent
No console output is produced
.. option:: -v, --verbose
Verbose debugging output on the console.
.. option:: source
A source ``.textproto`` file.
This is often the path to a file in a local download of https://github.com/google/cel-spec/tree/master/tests/simple/testdata.
A URL for the source is **not** supported.
Description
-----------
Convert one ``.textproto`` file to a Gherkin ``.feature`` file.
Files
-----
:source:
A ``.textproto`` test case file from the ``cel-spec`` repository.
:output:
A ``.feature`` file with the same stem as the source file is written to the output directory.
``basic.textproto`` will create ``basic.feature``.
Examples
--------
The ``basic.textproto`` starts like this:
.. code-block:: protobuf
name: "basic"
description: "Basic conformance tests that all implementations should pass."
section {
name: "self_eval_zeroish"
description: "Simple self-evaluating forms to zero-ish values."
test {
name: "self_eval_int_zero"
expr: "0"
value: { int64_value: 0 }
}
test {
name: "self_eval_uint_zero"
expr: "0u"
value: { uint64_value: 0 }
}
The ``basic.feature`` file created looks like this:
.. code-block:: gherkin
@conformance
Feature: basic
Basic conformance tests that all implementations should pass.
# self_eval_zeroish -- Simple self-evaluating forms to zero-ish values.
Scenario: self_eval_zeroish/self_eval_int_zero
When CEL expression '0' is evaluated
Then value is celpy.celtypes.IntType(source=0)
Scenario: self_eval_zeroish/self_eval_uint_zero
When CEL expression '0u' is evaluated
Then value is celpy.celtypes.UintType(source=0)
The source ``.textproto`` files have a "section" heading which doesn't have a precise parallel in the Gherkin language.
The sections become comments in the ``.feature`` file, and the section name is used to prefix each feature name.
"""
import argparse
from datetime import datetime, timedelta, timezone
from io import open
import logging
from os import path
from pathlib import Path
import sys
from typing import Any, Literal, Optional, Union, overload
from typing_extensions import Self
from jinja2 import Environment, FileSystemLoader
import toml
# Note that the `noqa: F401` annotations are because these imports are needed so
# that the descriptors end up in the default descriptor pool, but aren't used
# explicitly and thus would be otherwise flagged as unused imports.
from cel.expr import checked_pb2, eval_pb2, value_pb2
from cel.expr.conformance.test import simple_pb2
from cel.expr.conformance.proto2 import (
test_all_types_pb2 as proto2_test_all_types, # noqa: F401
test_all_types_extensions_pb2 as proto2_test_all_types_extensions, # noqa: F401
)
from cel.expr.conformance.proto3 import test_all_types_pb2 as proto3_test_all_types # noqa: F401
from google.protobuf import (
any_pb2,
descriptor_pool,
descriptor, # noqa: F401
duration_pb2,
message_factory,
message,
struct_pb2,
symbol_database, # noqa: F401
text_format,
timestamp_pb2,
wrappers_pb2,
)
env = Environment(
loader=FileSystemLoader(path.dirname(__file__)),
trim_blocks=True,
)
template = env.get_template("gherkin.feature.jinja")
logger = logging.getLogger("gherkinize")
pool = descriptor_pool.Default() # type: ignore [no-untyped-call]
class Config:
"""
This class reads in optional configuration for conformance tests. Each scenario
is within a feature and a section.
.. csv-table::
:header: , feature, section, scenario
**example**, string_ext, ascii_casing, lowerascii_unicode
The value for each scenario can be a string tag (which must begin with
``@``), an array of tags (each of which must begin with ``@``) or a dictionary
with a ``tags`` key containing an array of tags (each of which... y'know).
For example, each of the following are valid:
::
[bindings_ext.bind]
bind_nested = "@wip"
boolean_literal = [ "@wip" ]
[bindings_ext.bind.macro_exists]
tags = [ "@wip" ]
In the future, dictionaries with additional features may be supported.
"""
# We tolerate some variation in the structure of the configuration for each
# scenario, but we need to canonicalize it as we load it.
_ScenarioInput = Union[str, list[str], dict[Literal["tags"], list[str]]]
_SectionInput = dict[str, "Config._ScenarioInput"]
_FeatureInput = dict[str, "Config._SectionInput"]
# These are the canonical forms
_Scenario = dict[Literal["tags"], list[str]]
_Section = dict[str, "Config._Scenario"]
_Feature = dict[str, "Config._Section"]
def __init__(self, path: str) -> None:
logger.debug(f"Reading from {repr(path)}...")
input = toml.load(path)
if not isinstance(input, dict):
logger.error(f"Could not read from {repr(path)}")
return None
features = [(k, Config._load_feature(k, v)) for k, v in input.items()]
self.features: dict[str, "Config._Feature"] = {
k: v for k, v in features if v is not None
}
@staticmethod
def _load_feature(
context: str, input: "Config._FeatureInput"
) -> "Config._Feature | None":
if not isinstance(input, dict):
logger.error(f"[{context}]: Skipping invalid feature: {repr(input)}")
return None
sections = [
(k, Config._load_section(f"{context}.{k}", v)) for k, v in input.items()
]
return {k: v for k, v in sections if v is not None}
@staticmethod
def _load_section(
context: str, input: "Config._SectionInput"
) -> "Config._Section | None":
if not isinstance(input, dict):
logger.error(f"[{context}]: Skipping invalid section: {repr(input)}")
return None
scenarios = [
(k, Config._load_scenario(f"{context}.{k}", v)) for k, v in input.items()
]
return {k: v for k, v in scenarios if v is not None}
@staticmethod
def _load_scenario(
context: str, input: "Config._ScenarioInput"
) -> "Config._Scenario | None":
tags = None
if isinstance(input, str):
tag = Config._load_tag(context, input)
tags = [tag] if tag is not None else []
elif isinstance(input, list):
tags = Config._load_tag_list(context, input)
elif "tags" in input:
tags = Config._load_tag_list(f"{context}.tags", input["tags"])
if tags is None:
logger.error(f"[{context}]: Skipping invalid scenario: {repr(input)}")
return None
return {"tags": tags}
@staticmethod
def _load_tag_list(context: str, input: Any) -> Union[list[str], None]:
if not isinstance(input, list):
logger.error(
f"[{context}]: Skipping invalid tags (must be a list): {repr(input)}"
)
return None
tags_and_nones = [
Config._load_tag(f"{context}.{i}", v) for i, v in enumerate(input)
]
return [t for t in tags_and_nones if t is not None]
@staticmethod
def _load_tag(context: str, input: Any) -> Union[str, None]:
if not isinstance(input, str):
logger.error(
f"[{context}]: Skipping invalid tag (must be a string): {repr(input)}"
)
return None
if not input.startswith("@"):
logger.error(
f'[{context}]: Skipping invalid tag (must start with "@"): {repr(input)}'
)
logger.error(f"[{context}]: Did you mean {repr('@' + input)}?")
return None
return input
def tags_for(self, feature: str, section: str, scenario: str) -> list[str]:
"""
Get a list of tags for a given scenario.
"""
if (
feature in self.features
and section in self.features[feature]
and scenario in self.features[feature][section]
):
return self.features[feature][section][scenario]["tags"]
return []
class Result:
def __init__(
self,
kind: Union[Literal["value"], Literal["eval_error"], Literal["none"]] = "none",
value: "Optional[Union[CELValue, CELErrorSet]]" = None,
) -> None:
self.kind = kind
self.value = value
def __eq__(self, other: Any) -> bool:
return isinstance(other, Result) and (self.kind, self.value) == (
other.kind,
other.value,
)
def __repr__(self) -> str:
if isinstance(self.value, CELErrorSet):
# TODO: Investigate if we should switch to a
# data structure in the step implementation
return repr(str(self.value))
else:
return repr(self.value)
@staticmethod
def from_proto(source: simple_pb2.SimpleTest) -> "Result":
kind = source.WhichOneof("result_matcher")
if kind == "value":
return Result(kind, CELValue.from_proto(source.value))
elif kind == "eval_error":
return Result(kind, CELErrorSet(source.eval_error))
elif kind is None:
return Result("none", None)
else:
raise NotImplementedError(f"Unable to interpret result kind {kind!r}")
@staticmethod
def from_text_proto_str(text_proto: str) -> "Result":
test = simple_pb2.SimpleTest()
text_format.Parse(text_proto, test)
return Result.from_proto(test)
class CELValue:
type_name = "celpy.celtypes.CELType"
def __init__(self, source: Optional[message.Message]) -> None:
self.source = source
@staticmethod
def is_aliased(_: str) -> bool:
return False
@overload
@staticmethod
def get_class_by_alias(
alias: str,
base: Optional[type["CELValue"]] = None,
error_on_none: Literal[True] = True,
) -> type["CELValue"]: ...
@overload
@staticmethod
def get_class_by_alias(
alias: str,
base: Optional[type["CELValue"]] = None,
error_on_none: Literal[False] = False,
) -> Optional[type["CELValue"]]: ...
@staticmethod
def get_class_by_alias(
alias: str, base: Optional[type["CELValue"]] = None, error_on_none: bool = True
) -> Optional[type["CELValue"]]:
base_class = base if base else CELValue
if base_class.is_aliased(alias):
return base_class
children = base_class.__subclasses__()
for child in children:
match = CELValue.get_class_by_alias(alias, child, False)
if match is not None:
return match
if error_on_none:
raise Exception(f"Unable to locate CEL value class for alias {alias!r}")
else:
return None
@staticmethod
def from_proto(source: message.Message) -> "CELValue":
if source.DESCRIPTOR in [
struct_pb2.Value.DESCRIPTOR,
value_pb2.Value.DESCRIPTOR,
]:
value_kind = source.WhichOneof("kind")
if value_kind == "object_value":
return CELValue.from_any(getattr(source, value_kind))
else:
return CELValue.get_class_by_alias(value_kind)(
getattr(source, value_kind)
)
if isinstance(source, any_pb2.Any):
return CELValue.from_any(source)
aliased = CELValue.get_class_by_alias(source.DESCRIPTOR.full_name, None, False)
if aliased is not None:
return aliased(source)
logger.error(source)
return CELMessage(source)
@staticmethod
def from_any(source: any_pb2.Any) -> "CELValue":
type_name = source.type_url.split("/")[-1]
desc = pool.FindMessageTypeByName(type_name)
message_value = message_factory.GetMessageClass(desc)()
source.Unpack(message_value)
return CELValue.from_proto(message_value)
@staticmethod
def from_text_proto_str(text_proto: str) -> "CELValue":
value = value_pb2.Value()
text_format.Parse(text_proto, value)
return CELValue.from_proto(value)
class CELType(CELValue):
type_name = "celpy.celtypes.TypeType"
def __init__(
self,
value: Union[
value_pb2.Value, checked_pb2.Decl, checked_pb2.Decl.IdentDecl, str
],
) -> None:
if isinstance(value, value_pb2.Value):
self._from_cel_value(value)
super().__init__(value)
elif isinstance(value, checked_pb2.Decl):
self._from_decl(value)
super().__init__(value)
elif isinstance(value, checked_pb2.Decl.IdentDecl):
self._from_ident(value)
super().__init__(value)
elif isinstance(value, str):
self._from_str(value)
super().__init__(None)
else:
if isinstance(value, message.Message):
raise Exception(
f"Unable to interpret type from {value.DESCRIPTOR.full_name} message"
)
else:
raise Exception(f"Unable to interpret type from {repr(value)}")
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["type", "type_value"]
def _from_cel_value(self, source: value_pb2.Value) -> None:
self._from_str(source.type_value)
def _from_decl(self, source: checked_pb2.Decl) -> None:
decl_kind = source.WhichOneof("decl_kind")
if decl_kind == "ident":
self._from_ident(source.ident)
else:
raise NotImplementedError(
f'Unable to interpret declaration kind "{decl_kind}"'
)
def _from_ident(self, ident: checked_pb2.Decl.IdentDecl) -> None:
type_kind = ident.type.WhichOneof("type_kind")
if type_kind == "primitive":
primitive_kind = checked_pb2.Type.PrimitiveType.Name(ident.type.primitive)
self.name = CELValue.get_class_by_alias(
primitive_kind, None, True
).type_name
elif type_kind == "message_type":
cel_class = CELValue.get_class_by_alias(
ident.type.message_type, None, False
)
if cel_class:
self.name = cel_class.type_name
else:
self._from_str(ident.type.message_type)
else:
self.name = CELValue.get_class_by_alias(type_kind, None, True).type_name
def _from_str(self, type_value: str) -> None:
candidate = CELValue.get_class_by_alias(type_value, None, False)
if candidate:
self.name = candidate.type_name
elif type_value in [
"cel.expr.conformance.proto2.GlobalEnum",
"cel.expr.conformance.proto2.TestAllTypes.NestedEnum",
"cel.expr.conformance.proto3.GlobalEnum",
"cel.expr.conformance.proto3.TestAllTypes.NestedEnum",
]:
raise NotImplementedError(f'Type not supported: "{type_value}"')
else:
self.name = "celpy.celtypes.MessageType"
@staticmethod
def from_text_proto_str(text_proto: str) -> "CELType":
ident = checked_pb2.Decl.IdentDecl()
text_format.Parse(text_proto, ident)
return CELType(ident)
def __repr__(self) -> str:
return self.name
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELType) and self.name == other.name
class CELExprValue:
def __init__(self, source: eval_pb2.ExprValue) -> None:
self.source = source
expr_value_kind = self.source.WhichOneof("kind")
if expr_value_kind == "value":
self.value = CELValue.from_proto(self.source.value)
elif expr_value_kind == "error":
self.value = CELErrorSet(self.source.error)
else:
raise Exception(
f'Unable to interpret CEL expression value kind "{expr_value_kind}"'
)
def __repr__(self) -> str:
return repr(self.value)
class CELPrimitive(CELValue):
def __init__(self, source: Optional[message.Message], value: Any) -> None:
self.value = value
super().__init__(source)
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELPrimitive) and (self.value == other.value)
def __hash__(self) -> int:
return hash(self.value)
def __repr__(self) -> str:
return f"{self.type_name}(source={repr(self.value)})"
class CELInt(CELPrimitive):
type_name = "celpy.celtypes.IntType"
def __init__(
self, source: Union[wrappers_pb2.Int32Value, wrappers_pb2.Int64Value, int]
) -> None:
if isinstance(source, wrappers_pb2.Int32Value) or isinstance(
source, wrappers_pb2.Int64Value
):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in [
"INT64",
"int",
"int64_value",
"google.protobuf.Int32Value",
"google.protobuf.Int64Value",
]
class CELUint(CELPrimitive):
type_name = "celpy.celtypes.UintType"
def __init__(
self, source: Union[wrappers_pb2.UInt32Value, wrappers_pb2.UInt64Value, int]
) -> None:
if isinstance(source, wrappers_pb2.UInt32Value) or isinstance(
source, wrappers_pb2.UInt64Value
):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in [
"UINT64",
"uint",
"uint64_value",
"google.protobuf.UInt32Value",
"google.protobuf.UInt64Value",
]
class CELDouble(CELPrimitive):
type_name = "celpy.celtypes.DoubleType"
def __init__(
self, source: Union[wrappers_pb2.FloatValue, wrappers_pb2.DoubleValue, float]
) -> None:
if isinstance(source, wrappers_pb2.FloatValue) or isinstance(
source, wrappers_pb2.DoubleValue
):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in [
"DOUBLE",
"double",
"double_value",
"number_value",
"google.protobuf.FloatValue",
"google.protobuf.DoubleValue",
]
def __repr__(self) -> str:
source = repr(self.value)
if source in ["-inf", "inf", "nan"]:
source = f"float({repr(source)})"
return f"{self.type_name}(source={source})"
class CELBool(CELPrimitive):
type_name = "celpy.celtypes.BoolType"
def __init__(self, source: Union[wrappers_pb2.BoolValue, bool]) -> None:
if isinstance(source, wrappers_pb2.BoolValue):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["BOOL", "bool", "bool_value", "google.protobuf.BoolValue"]
class CELString(CELPrimitive):
type_name = "celpy.celtypes.StringType"
def __init__(self, source: Union[wrappers_pb2.StringValue, str]) -> None:
if isinstance(source, wrappers_pb2.StringValue):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in [
"STRING",
"string",
"string_value",
"google.protobuf.StringValue",
]
def __str__(self) -> str:
return str(self.value)
class CELBytes(CELPrimitive):
type_name = "celpy.celtypes.BytesType"
def __init__(self, source: Union[wrappers_pb2.BytesValue, bytes]) -> None:
if isinstance(source, wrappers_pb2.BytesValue):
value = source.value
super().__init__(source, value)
else:
value = source
super().__init__(None, value)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["BYTES", "bytes", "bytes_value", "google.protobuf.BytesValue"]
class CELEnum(CELPrimitive):
type_name = "celpy.celtypes.Enum"
def __init__(self, _: Any) -> None:
raise NotImplementedError("Enums not yet supported")
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["enum_value"]
class CELNull(CELValue):
type_name = "NoneType"
def __init__(self, source: None = None) -> None:
super().__init__(source)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["null", "null_type", "null_value"]
def __eq__(self, other: Any) -> bool:
return other is None or isinstance(other, CELNull)
def __repr__(self) -> str:
return "None"
class CELList(CELValue):
type_name = "celpy.celtypes.ListType"
def __init__(
self, source: Union[struct_pb2.ListValue, value_pb2.ListValue, list[CELValue]]
) -> None:
if isinstance(source, (struct_pb2.ListValue, value_pb2.ListValue)):
self.values = [CELValue.from_proto(v) for v in source.values]
super().__init__(source)
else:
self.values = source
super().__init__(None)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["list", "list_type", "list_value", "google.protobuf.ListValue"]
def __eq__(self, other: Any) -> bool:
if not isinstance(other, CELList):
return False
if len(self.values) != len(other.values):
return False
for s, o in zip(self.values, other.values):
if s != o:
return False
return True
def __repr__(self) -> str:
return f"[{', '.join(repr(v) for v in self.values)}]"
class CELMap(CELValue):
type_name = "celpy.celtypes.MapType"
def __init__(
self, source: Union[struct_pb2.Struct, value_pb2.MapValue, dict[str, CELValue]]
) -> None:
self.value = {}
if isinstance(source, struct_pb2.Struct):
for k in source.fields:
self.value[k] = CELValue.from_proto(source.fields[k])
super().__init__(source)
elif isinstance(source, value_pb2.MapValue):
for e in source.entries:
self.value[str(CELValue.from_proto(e.key))] = CELValue.from_proto(
e.value
)
super().__init__(source)
elif isinstance(source, dict):
self.value = source
super().__init__(None)
else:
raise Exception(f"Cannot use {repr(source)} as map input")
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELMap) and self.value == other.value
def __repr__(self) -> str:
return f"{self.type_name}({repr(self.value)})"
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in [
"map",
"map_type",
"map_value",
"struct_value",
"google.protobuf.Struct",
]
class AnyWrapper(CELValue):
def __init__(self, source: any_pb2.Any) -> None:
self.value = ProtoAny(source)
super().__init__(source)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["object_value"]
def __repr__(self) -> str:
return repr(self.value)
class CELDuration(CELValue):
type_name = "celpy.celtypes.DurationType"
def __init__(
self, seconds: Union[duration_pb2.Duration, int], nanos: int = 0
) -> None:
if isinstance(seconds, message.Message):
self.seconds = seconds.seconds
self.nanos = seconds.nanos
super().__init__(seconds)
else:
self.seconds = seconds
self.nanos = nanos
super().__init__(None)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["google.protobuf.Duration"]
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELDuration) and (self.seconds, self.nanos) == (
other.seconds,
other.nanos,
)
def __repr__(self) -> str:
return f"{self.type_name}(seconds={self.seconds:.0f}, nanos={self.nanos:.0f})"
class CELTimestamp(CELValue):
type_name = "celpy.celtypes.TimestampType"
def __init__(
self, seconds: Union[timestamp_pb2.Timestamp, int], nanos: int = 0
) -> None:
if isinstance(seconds, timestamp_pb2.Timestamp):
self.seconds = seconds.seconds
self.nanos = seconds.nanos
super().__init__(seconds)
else:
self.seconds = seconds
self.nanos = nanos
super().__init__(None)
self.value = datetime.fromtimestamp(self.seconds, tz=timezone.utc) + timedelta(
microseconds=(self.nanos / 1000)
)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["google.protobuf.Timestamp"]
def __repr__(self) -> str:
return f"{self.type_name}({repr(self.value)})"
class CELStatus(CELValue):
def __init__(self, message: Union[eval_pb2.Status, str], code: int = 0) -> None:
if isinstance(message, eval_pb2.Status):
self.message = message.message
self.code = message.code
super().__init__(message)
else:
self.message = message
self.code = code
super().__init__(None)
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["cel.expr.Status"]
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELStatus) and (self.message, self.code) == (
other.message,
other.code,
)
def __repr__(self) -> str:
return repr(self.message)
class CELErrorSet(CELValue):
type_name = "CELEvalError"
def __init__(self, message: Union[eval_pb2.ErrorSet, list[CELStatus], str]) -> None:
self.errors = []
if isinstance(message, eval_pb2.ErrorSet):
for status in message.errors:
self.errors.append(CELStatus(status))
super().__init__(message)
elif isinstance(message, eval_pb2.Status):
self.errors.append(CELStatus(message))
super().__init__(message)
elif isinstance(message, str):
self.errors.append(CELStatus(message))
super().__init__(None)
elif isinstance(message, list):
for m in message:
if not isinstance(m, CELStatus):
raise Exception(f"Cannot use {repr(m)} in place of status")
self.errors.append(m)
super().__init__(None)
elif isinstance(message, str):
self.errors.append(CELStatus(message))
super().__init__(None)
else:
raise Exception(f"Cannot use {repr(message)} as error set input")
@staticmethod
def is_aliased(alias: str) -> bool:
return alias in ["cel.expr.ErrorSet"]
@staticmethod
def from_text_proto_str(text_proto: str) -> "CELErrorSet":
errorSet = eval_pb2.ErrorSet()
text_format.Parse(text_proto, errorSet)
return CELErrorSet(errorSet)
def __eq__(self, other: Any) -> bool:
if not isinstance(other, CELErrorSet):
return False
if len(self.errors) != len(other.errors):
return False
for s, o in zip(self.errors, other.errors):
if s != o:
return False
return True
def __repr__(self) -> str:
return f"{self.type_name}({', '.join(repr(e) for e in self.errors)})"
def __str__(self) -> str:
return ", ".join(e.message for e in self.errors)
class ProtoAny:
def __init__(self, source: any_pb2.Any) -> None:
self.source = source
type_name = self.source.type_url.split("/")[-1]
desc = pool.FindMessageTypeByName(type_name)
message_value = message_factory.GetMessageClass(desc)()
self.source.Unpack(message_value)
self.value = CELValue.from_proto(message_value)
def __repr__(self) -> str:
return repr(self.value)
class CELMessage(CELValue):
type_name = "celpy.celtypes.MessageType"
def __init__(
self, source: message.Message, name_override: Optional[str] = None
) -> None:
self.source = source
name = (
name_override if name_override is not None else self.source.DESCRIPTOR.name
)
fieldLiterals = []
fields = self.source.ListFields()
for desc, value in fields:
if desc.is_repeated:
repeatedValues = []
for v in value:
if isinstance(v, message.Message):
repeatedValues.append(repr(CELValue.from_proto(v)))
else:
repeatedValues.append(repr(v))
fieldLiterals.append(f"{desc.name}=[{', '.join(repeatedValues)}]")
elif isinstance(value, message.Message):
fieldLiterals.append(f"{desc.name}={repr(CELValue.from_proto(value))}")
else:
fieldLiterals.append(f"{desc.name}={repr(value)}")
self.literal = f"{name}({', '.join(fieldLiterals)})"
def __eq__(self, other: Any) -> bool:
return isinstance(other, CELMessage) and self.source == other.source
def __repr__(self) -> str:
return self.literal
class Scenario:
def __init__(
self,
config: Config,
feature: "Feature",
section: "Section",
source: simple_pb2.SimpleTest,
) -> None:
logger.debug(f"Scenario {source.name}")
self.name = source.name
self.description = source.description
self.tags = config.tags_for(feature.name, section.name, source.name)
self.preconditions: list[str] = []
self.events: list[str] = []
self.outcomes: list[str] = []
if source.disable_macros:
self.given("disable_macros parameter is True")
if source.disable_check:
self.given("disable_check parameter is True")
for type_env in source.type_env:
self.given(f'type_env parameter "{type_env.name}" is {CELType(type_env)}')
for key in source.bindings.keys():
self.given(
f'bindings parameter "{key}" is {CELExprValue(source.bindings[key])}'
)
if source.container:
self.given(f"container is {source.container!r}")
self.when(f"CEL expression {source.expr!r} is evaluated")
result = Result.from_proto(source)
self.then(f"{result.kind} is {result}")
def given(self, precondition: str) -> Self:
self.preconditions.append(precondition)
return self
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tools/test_gherkinize.py | tools/test_gherkinize.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Test the gherkinize.py tool to convert textproto to Gherkin.
"""
from google.protobuf import any_pb2, struct_pb2
from cel.expr.conformance.proto2 import test_all_types_pb2 as proto2_test_all_types
from cel.expr.conformance.proto3 import test_all_types_pb2 as proto3_test_all_types
from gherkinize import (
CELValue,
CELBool,
CELBytes,
CELErrorSet,
CELInt,
CELDouble,
CELDuration,
CELList,
CELMap,
CELNull,
CELString,
CELUint,
CELType,
Result,
)
def test_given_bindings() -> None:
assert Result.from_text_proto_str("value:{int64_value:123}") == Result(
"value", CELInt(source=123)
)
assert Result.from_text_proto_str("value:{bool_value:true}") == Result(
"value", CELBool(source=True)
)
assert Result.from_text_proto_str("value:{bool_value:false}") == Result(
"value", CELBool(source=False)
)
assert Result.from_text_proto_str('value:{bytes_value:"\\x00"}') == Result(
"value", CELBytes(source=b"\x00")
)
assert Result.from_text_proto_str("value:{int64_value:124}") == Result(
"value", CELInt(source=124)
)
assert Result.from_text_proto_str("value:{double_value:9.8}") == Result(
"value", CELDouble(source=9.8)
)
assert Result.from_text_proto_str(
'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"d"}} entries:{key:{string_value:"a"} value:{string_value:"b"}}}}'
) == Result(
"value", CELMap({"c": CELString(source="d"), "a": CELString(source="b")})
)
assert Result.from_text_proto_str("value:{null_value:NULL_VALUE}") == Result(
"value", None
)
assert Result.from_text_proto_str(
"value:{list_value:{values:{int64_value:2} values:{int64_value:1}}}"
) == Result("value", CELList([CELInt(source=2), CELInt(source=1)]))
assert Result.from_text_proto_str('value:{string_value:"abc"}') == Result(
"value", CELString(source="abc")
)
assert Result.from_text_proto_str("value:{uint64_value:1000}") == Result(
"value", CELUint(source=1000)
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Int32Value]:{value:2000000}}}"
) == Result("value", CELInt(source=2000000))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Int64Value]:{value:2000000}}}"
) == Result("value", CELInt(source=2000000))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.UInt32Value]:{value:2000000}}}"
) == Result("value", CELUint(source=2000000))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.UInt64Value]:{value:2000000}}}"
) == Result("value", CELUint(source=2000000))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.FloatValue]:{value:-1.25e+06}}}"
) == Result("value", CELDouble(source=-1250000.0))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.DoubleValue]:{value:-1.25e+06}}}"
) == Result("value", CELDouble(source=-1250000.0))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.BoolValue]:{value:true}}}"
) == Result("value", CELBool(source=True))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.StringValue]:{value:"bar"}}}'
) == Result("value", CELString(source="bar"))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.BytesValue]:{value:"bar"}}}'
) == Result("value", CELBytes(source=b"bar"))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.ListValue]:{values:{string_value:"bar"} values:{list_value:{values:{string_value:"a"} values:{string_value:"b"}}}}}}'
) == Result(
"value",
CELList(
[
CELString(source="bar"),
CELList([CELString(source="a"), CELString(source="b")]),
]
),
)
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.Struct]:{fields:{key:"first" value:{string_value:"Abraham"}} fields:{key:"last" value:{string_value:"Lincoln"}}}}}'
) == Result(
"value",
CELMap(
{"first": CELString(source="Abraham"), "last": CELString(source="Lincoln")}
),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{null_value:NULL_VALUE}}}"
) == Result("value", None)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{number_value:-26.375}}}"
) == Result("value", CELDouble(source=-26.375))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{string_value:"bar"}}}'
) == Result("value", CELString(source="bar"))
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{bool_value:true}}}"
) == Result("value", CELBool(source=True))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{struct_value:{fields:{key:"x" value:{null_value:NULL_VALUE}} fields:{key:"y" value:{bool_value:false}}}}}}'
) == Result("value", CELMap({"x": CELNull(), "y": CELBool(source=False)}))
assert Result.from_text_proto_str(
'value:{object_value:{[type.googleapis.com/google.protobuf.Value]:{list_value:{values:{number_value:1} values:{bool_value:true} values:{string_value:"hi"}}}}}'
) == Result(
"value",
CELList([CELDouble(source=1), CELBool(source=True), CELString(source="hi")]),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Any]:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:150}}}}"
) == Result(
"value",
CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=150,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
),
)
assert Result.from_text_proto_str(
'value:{map_value:{entries:{key:{string_value:"name"} value:{int64_value:1024}}}}'
) == Result("value", CELMap({"name": CELInt(source=1024)}))
assert Result.from_text_proto_str(
'value:{map_value:{entries:{key:{string_value:"holiday"} value:{string_value:"field"}}}}'
) == Result("value", CELMap({"holiday": CELString(source="field")}))
assert Result.from_text_proto_str('value:{string_value:"yeah"}') == Result(
"value", CELString(source="yeah")
)
assert Result.from_text_proto_str(
'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"yeah"}}}}'
) == Result("value", CELMap({"c": CELString(source="yeah")}))
assert Result.from_text_proto_str(
'value:{map_value:{entries:{key:{string_value:"c"} value:{string_value:"oops"}}}}'
) == Result("value", CELMap({"c": CELString(source="oops")}))
assert Result.from_text_proto_str(
'value:{list_value:{values:{string_value:"pancakes"}}}'
) == Result("value", CELList([CELString(source="pancakes")]))
assert Result.from_text_proto_str("value:{int64_value:15}") == Result(
"value", CELInt(source=15)
)
assert Result.from_text_proto_str('value:{string_value:"false"}') == Result(
"value", CELString(source="false")
)
assert Result.from_text_proto_str(
"value:{list_value:{values:{int64_value:0}}}"
) == Result("value", CELList([CELInt(source=0)]))
assert Result.from_text_proto_str("value:{int64_value:17}") == Result(
"value", CELInt(source=17)
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32:17}}}"
) == Result(
"value",
CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=17,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64:-99}}}"
) == Result(
"value",
CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=None,
single_int64=-99,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32:17}}}"
) == Result(
"value",
CELValue.from_proto(
proto3_test_all_types.TestAllTypes(
single_int32=17,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64:-99}}}"
) == Result(
"value",
CELValue.from_proto(
proto3_test_all_types.TestAllTypes(
single_int32=None,
single_int64=-99,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
),
)
assert Result.from_text_proto_str(
"value:{object_value:{[type.googleapis.com/google.protobuf.Duration]:{seconds:123 nanos:123456789}}}"
) == Result("value", CELDuration(seconds=123, nanos=123456789))
def test_then_values() -> None:
assert CELValue.from_text_proto_str("int64_value:0") == CELInt(source=0)
assert CELValue.from_text_proto_str("uint64_value:0") == CELUint(source=0)
assert CELValue.from_text_proto_str("double_value:0") == CELDouble(source=0)
assert CELValue.from_text_proto_str('string_value:""') == CELString(source="")
assert CELValue.from_text_proto_str('bytes_value:""') == CELBytes(source=b"")
assert CELValue.from_text_proto_str("bool_value:false") == CELBool(source=False)
assert CELValue.from_text_proto_str("null_value:NULL_VALUE") == CELNull()
assert CELValue.from_text_proto_str("list_value:{}") == CELList([])
assert CELValue.from_text_proto_str("map_value:{}") == CELMap({})
assert CELValue.from_text_proto_str("int64_value:42") == CELInt(source=42)
assert CELValue.from_text_proto_str("uint64_value:123456789") == CELUint(
source=123456789
)
assert CELValue.from_text_proto_str("int64_value:-9223372036854775808") == CELInt(
source=-9223372036854775808
)
assert CELValue.from_text_proto_str("double_value:-23") == CELDouble(source=-23)
assert CELValue.from_text_proto_str('string_value:"!"') == CELString(source="!")
assert CELValue.from_text_proto_str('string_value:"\'"') == CELString(source="'")
assert CELValue.from_text_proto_str('bytes_value:"ÿ"') == CELBytes(
source=b"\xc3\xbf"
)
assert CELValue.from_text_proto_str('bytes_value:"\\x00\\xff"') == CELBytes(
source=b"\x00\xff"
)
assert CELValue.from_text_proto_str(
"list_value:{values:{int64_value:-1}}"
) == CELList([CELInt(source=-1)])
assert CELValue.from_text_proto_str(
'map_value:{entries:{key:{string_value:"k"} value:{string_value:"v"}}}'
) == CELMap({"k": CELString(source="v")})
assert CELValue.from_text_proto_str("bool_value:true") == CELBool(source=True)
assert CELValue.from_text_proto_str("int64_value:1431655765") == CELInt(
source=1431655765
)
assert CELValue.from_text_proto_str("int64_value:-1431655765") == CELInt(
source=-1431655765
)
assert CELValue.from_text_proto_str("uint64_value:1431655765") == CELUint(
source=1431655765
)
assert CELValue.from_text_proto_str('string_value:"✌"') == CELString(source="✌")
assert CELValue.from_text_proto_str('string_value:"🐱"') == CELString(source="🐱")
assert CELValue.from_text_proto_str(
'string_value:"\\x07\\x08\\x0c\\n\\r\\t\\x0b\\"\'\\\\"'
) == CELString(source="\x07\x08\x0c\n\r\t\x0b\"'\\")
assert CELValue.from_text_proto_str("int64_value:123") == CELInt(source=123)
assert CELErrorSet.from_text_proto_str(
"errors:{message:\"undeclared reference to 'x' (in container '')\"}"
) == CELErrorSet("undeclared reference to 'x' (in container '')")
assert CELValue.from_text_proto_str("int64_value:2") == CELInt(source=2)
assert CELErrorSet.from_text_proto_str(
'errors:{message:"unbound function"}'
) == CELErrorSet("unbound function")
assert CELErrorSet.from_text_proto_str(
'errors:{message:"no such overload"}'
) == CELErrorSet("no such overload")
assert CELValue.from_text_proto_str('bytes_value:"abc"') == CELBytes(source=b"abc")
assert CELValue.from_text_proto_str("double_value:1e+12") == CELDouble(
source=1000000000000.0
)
assert CELValue.from_text_proto_str("double_value:-1e+15") == CELDouble(
source=-1000000000000000.0
)
assert CELValue.from_text_proto_str(
"double_value:9.223372036854776e+18"
) == CELDouble(source=9.223372036854776e18)
assert CELValue.from_text_proto_str("double_value:123") == CELDouble(source=123)
assert CELValue.from_text_proto_str(
"double_value:1.8446744073709552e+19"
) == CELDouble(source=1.8446744073709552e19)
assert CELValue.from_text_proto_str("double_value:-0") == CELDouble(source=0)
assert CELValue.from_text_proto_str("double_value:123.456") == CELDouble(
source=123.456
)
assert CELValue.from_text_proto_str("double_value:-987.654") == CELDouble(
source=-987.654
)
assert CELValue.from_text_proto_str("double_value:6.02214e+23") == CELDouble(
source=6.02214e23
)
assert CELValue.from_text_proto_str("double_value:1.38e-23") == CELDouble(
source=1.38e-23
)
assert CELValue.from_text_proto_str("double_value:-8.432e+08") == CELDouble(
source=-843200000.0
)
assert CELValue.from_text_proto_str("double_value:-5.43e-21") == CELDouble(
source=-5.43e-21
)
assert CELValue.from_text_proto_str('type_value:"list"') == CELType(value="list")
assert CELErrorSet.from_text_proto_str(
'errors:{message:"range error"}'
) == CELErrorSet("range error")
assert CELValue.from_text_proto_str("int64_value:-123") == CELInt(source=-123)
assert CELValue.from_text_proto_str("int64_value:-8") == CELInt(source=-8)
assert CELValue.from_text_proto_str("int64_value:12") == CELInt(source=12)
assert CELValue.from_text_proto_str("int64_value:-4") == CELInt(source=-4)
assert CELErrorSet.from_text_proto_str('errors:{message:"range"}') == CELErrorSet(
"range"
)
assert CELValue.from_text_proto_str("int64_value:987") == CELInt(source=987)
assert CELValue.from_text_proto_str("int64_value:1095379199") == CELInt(
source=1095379199
)
assert CELValue.from_text_proto_str('string_value:"123"') == CELString(source="123")
assert CELValue.from_text_proto_str('string_value:"-456"') == CELString(
source="-456"
)
assert CELValue.from_text_proto_str('string_value:"9876"') == CELString(
source="9876"
)
assert CELValue.from_text_proto_str('string_value:"123.456"') == CELString(
source="123.456"
)
assert CELValue.from_text_proto_str('string_value:"-0.0045"') == CELString(
source="-0.0045"
)
assert CELValue.from_text_proto_str('string_value:"abc"') == CELString(source="abc")
assert CELValue.from_text_proto_str('string_value:"ÿ"') == CELString(source="ÿ")
assert CELErrorSet.from_text_proto_str(
'errors:{message:"invalid UTF-8"}'
) == CELErrorSet("invalid UTF-8")
assert CELValue.from_text_proto_str('type_value:"bool"') == CELType(value="bool")
assert CELErrorSet.from_text_proto_str(
'errors:{message:"unknown varaible"}'
) == CELErrorSet("unknown varaible")
assert CELValue.from_text_proto_str('type_value:"int"') == CELType(value="int")
assert CELValue.from_text_proto_str('type_value:"uint"') == CELType(value="uint")
assert CELValue.from_text_proto_str('type_value:"double"') == CELType(
value="double"
)
assert CELValue.from_text_proto_str('type_value:"null_type"') == CELType(
value="null_type"
)
assert CELValue.from_text_proto_str('type_value:"string"') == CELType(
value="string"
)
assert CELValue.from_text_proto_str('type_value:"bytes"') == CELType(value="bytes")
assert CELValue.from_text_proto_str('type_value:"map"') == CELType(value="map")
assert CELValue.from_text_proto_str('type_value:"type"') == CELType(value="type")
assert CELValue.from_text_proto_str("uint64_value:1729") == CELUint(source=1729)
assert CELValue.from_text_proto_str("uint64_value:3") == CELUint(source=3)
assert CELValue.from_text_proto_str("uint64_value:2") == CELUint(source=2)
assert CELValue.from_text_proto_str("uint64_value:26") == CELUint(source=26)
assert CELValue.from_text_proto_str("uint64_value:300") == CELUint(source=300)
assert CELErrorSet.from_text_proto_str(
'errors:{message:"no_matching_overload"}'
) == CELErrorSet("no_matching_overload")
assert CELValue.from_text_proto_str("int64_value:2000000") == CELInt(source=2000000)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32_wrapper:{value:432}}}"
) == CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper={"value": 432},
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int32_wrapper:{}}}"
) == CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper={},
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str("int64_value:642") == CELInt(source=642)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32_wrapper:{value:-975}}}"
) == CELValue.from_proto(
proto3_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper={"value": -975},
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int32_wrapper:{}}}"
) == CELValue.from_proto(
proto3_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper=None,
single_int32_wrapper={},
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64_wrapper:{value:432}}}"
) == CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper={"value": 432},
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto2.TestAllTypes]:{single_int64_wrapper:{}}}"
) == CELValue.from_proto(
proto2_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper={},
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64_wrapper:{value:-975}}}"
) == CELValue.from_proto(
proto3_test_all_types.TestAllTypes(
single_int32=None,
single_int64=None,
single_uint32=None,
single_uint64=None,
single_sint32=None,
single_sint64=None,
single_fixed32=None,
single_fixed64=None,
single_sfixed32=None,
single_sfixed64=None,
single_float=None,
single_double=None,
single_bool=None,
single_string=None,
single_bytes=None,
single_any=None,
single_duration=None,
single_timestamp=None,
single_struct=None,
single_value=None,
single_int64_wrapper={"value": -975},
single_int32_wrapper=None,
single_double_wrapper=None,
single_float_wrapper=None,
single_uint64_wrapper=None,
single_uint32_wrapper=None,
single_string_wrapper=None,
single_bool_wrapper=None,
single_bytes_wrapper=None,
list_value=None,
)
)
assert CELValue.from_text_proto_str(
"object_value:{[type.googleapis.com/cel.expr.conformance.proto3.TestAllTypes]:{single_int64_wrapper:{}}}"
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/xlate/__init__.py | src/xlate/__init__.py | python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false | |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/xlate/c7n_to_cel.py | src/xlate/c7n_to_cel.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
C7N to CEL Rewriter -- Examine a policy's filters clause and emit CEL equivalent code.
The intent is to cover **most** policies, not all. Some rarely-used C7N features
may require manual intervention and cleanup.
Specifically, all of the rewrite functions that provide ``logger.error()`` messages
are policies that are known to produce possibly incorrect CEL expressions.
This is the short list of places where manual rewriting is necessary.
- :py:meth:`xlate.c7n_to_cel.C7N_Rewriter.c7type_marked_for_op_rewrite`
- :py:meth:`xlate.c7n_to_cel.C7N_Rewriter.type_image_rewrite`
In other cases the translator may raise an exception and stop because
the C7N filter uses an utterly obscure feature. In that case, manual conversion
is obviously the only recourse.
This makes it slightly more convenient to migrate C7N policies by
converting legacy policies from the YAML-based DSL into CEL.
There are three explicit limitations here.
- Some C7N features are opaque, and it's difficult to be sure
the CEL translation is correct.
- Some actual policy documents have incorrect logic and are tautologically false.
They never worked, and silence is often conflated with success.
- Some policy filters are so rarely used that there's little point in automated
translation of the policy filter.
"""
import collections
import logging
import re
from typing import Any, Callable, DefaultDict, Dict, List, Optional, Tuple, Union, cast
import yaml
logger = logging.getLogger(__name__)
JSON = Union[Dict[str, Any], List[Any], float, int, str, bool, None]
class C7N_Rewriter:
"""
Collection of functions to rewite most C7N policy filter clauses into CEL.
Generally, a C7N ``filters:`` expression consists of a large variety of individual
clauses, connected by boolean logic.
The :meth:`C7N_Rewriter.c7n_rewrite` method does this transformation.
"""
# Global names that *must* be part of the CEL activation namespace.
resource = "resource"
now = "now"
c7n = "C7N"
@staticmethod
def q(text: Optional[str], quote: str = '"') -> str:
"""Force specific quotes on CEL literals."""
if text is None:
return f"{quote}{quote}"
if quote in text:
text = text.replace(quote, f"\\{quote}")
return f"{quote}{text}{quote}"
@staticmethod
def key_to_cel(operation_key: str, context: Optional[str] = None) -> str:
"""
Convert simple key: clause to CEL or key: tag:Name clause to CEL.
The ``resource.key({name})`` function
handles key resolution by looking in the list of ``{Key: name, Value: value}`` mappings
for the first match. A default is available.
Another solution is a gemeric ``first(x, x["Key] = "{name}")`` macro,
which can return ``null`` if no first item is found.
What's in place now for ``key: tag:name`` is rather complicated. It asserts a complex
condition about one of the values in a list of mappings.
::
resource["Tags"].filter(x, x["Key"] == "{name}")[0]["Value"]
This is risky, since a list with no dictionaty that has a Key value of ``name``
will break this expression.
"""
function_map = {
"length": "size",
}
function_arg_pat = re.compile(r"(\w+)\((\w+)\)")
key_context = context or C7N_Rewriter.resource
key: str
function_arg_match = function_arg_pat.match(operation_key)
if function_arg_match:
function, arg = function_arg_match.groups()
cel_name = function_map[function]
key = f"{cel_name}({key_context}[{C7N_Rewriter.q(arg)}])"
elif "." in operation_key:
names = operation_key.split(".")
key = f"{key_context}[{C7N_Rewriter.q(names[0])}]" + "".join(
f"[{C7N_Rewriter.q(n)}]" for n in names[1:]
)
elif operation_key.startswith("tag:"):
prefix, _, name = operation_key.partition(":")
key = f'{key_context}["Tags"].filter(x, x["Key"] == {C7N_Rewriter.q(name)})[0]["Value"]'
else:
key = f"{key_context}[{C7N_Rewriter.q(operation_key)}]"
return key
# Transformations from C7N ``op:`` to CEL.
atomic_op_map = {
"eq": "{0} == {1}",
"equal": "{0} == {1}",
"ne": "{0} != {1}",
"not-equal": "{0} != {1}",
"gt": "{0} > {1}",
"greater-than": "{0} > {1}",
"ge": "{0} >= {1}",
"gte": "{0} >= {1}",
"le": "{0} < {1}",
"lte": "{0} <= {1}",
"lt": "{0} < {1}",
"less-than": "{0} < {1}",
"glob": "{0}.glob({1})",
"regex": "{0}.matches({1})",
"in": "{1}.contains({0})",
"ni": "! {1}.contains({0})",
"not-in": "! {1}.contains({0})",
"contains": "{0}.contains({1})",
"difference": "{0}.difference({1})",
"intersect": "{0}.intersect({1})",
# Special cases for present, anbsent, not-null, and empty
"__present__": "present({0})",
"__absent__": "absent({0})",
}
@staticmethod
def age_to_duration(age: Union[float, str]) -> str:
"""Ages are days. We convert to seconds and then create a duration string."""
return C7N_Rewriter.seconds_to_duration(float(age) * 24 * 60 * 60)
@staticmethod
def seconds_to_duration(period: Union[float, str]) -> str:
"""Integer periods are seconds."""
seconds = int(float(period))
units = [(24 * 60 * 60, "d"), (60 * 60, "h"), (60, "m"), (1, "s")]
duration = []
while seconds != 0 and units:
u_sec, u_name = units.pop(0)
value, seconds = divmod(seconds, u_sec)
if value != 0:
duration.append(f"{value}{u_name}")
return f"{C7N_Rewriter.q(''.join(duration))}"
@staticmethod
def value_to_cel(
key: str, op: str, value: Optional[str], value_type: Optional[str] = None
) -> str:
"""
Convert simple ``value: v, op: op``, and ``value_type: vt`` clauses to CEL.
"""
type_value_map: Dict[str, Callable[[str, str], Tuple[str, str]]] = {
"age": lambda sentinel, value: (
"timestamp({})".format(value),
"{} - duration({})".format(
C7N_Rewriter.now, C7N_Rewriter.age_to_duration(sentinel)
),
),
"integer": lambda sentinel, value: (sentinel, "int({})".format(value)),
"expiration": lambda sentinel, value: (
"{} + duration({})".format(
C7N_Rewriter.now, C7N_Rewriter.age_to_duration(sentinel)
),
"timestamp({})".format(value),
),
"normalize": lambda sentinel, value: (
sentinel,
"normalize({})".format(value),
),
"size": lambda sentinel, value: (sentinel, "size({})".format(value)),
"cidr": lambda sentinel, value: (
"parse_cidr({})".format(sentinel),
"parse_cidr({})".format(value),
),
"cidr_size": lambda sentinel, value: (
sentinel,
"size_parse_cidr({})".format(value),
),
"swap": lambda sentinel, value: (value, sentinel),
"unique_size": lambda sentinel, value: (
sentinel,
"unique_size({})".format(value),
),
"date": lambda sentinel, value: (
"timestamp({})".format(sentinel),
"timestamp({})".format(value),
),
"version": lambda sentinel, value: (
"version({})".format(sentinel),
"version({})".format(value),
),
# expr -- seems to be used only in value_from clauses
# resource_count -- no examples; it's not clear how this is different from size()
}
if (
isinstance(value, str)
and value in ("true", "false")
or isinstance(value, bool) # noqa: W503
):
# Boolean cases
# Rewrite == true, != true, == false, and != false
if op in ("eq", "equal"):
if value in ("true", True):
return f"{key}"
else:
return f"! {key}"
elif op in ("ne", "not-equal"):
if value in ("true", True):
return f"! {key}"
else:
return f"{key}"
else:
raise ValueError(f"Unknown op: {op}, value: {value} combination")
else:
# Ordinary comparisons, including the value_type transformation
cel_value: str
if isinstance(value, str):
cel_value = C7N_Rewriter.q(value)
else:
cel_value = f"{value}"
if value_type:
type_transform = type_value_map[value_type]
cel_value, key = type_transform(cel_value, key)
return C7N_Rewriter.atomic_op_map[op].format(key, cel_value)
@staticmethod
def value_from_to_cel(
key: str,
op: Optional[str],
value_from: Dict[str, Any],
value_type: Optional[str] = None,
) -> str:
"""
Convert ``value_from: ...``, ``op: op`` clauses to CEL.
When the op is either "in" or "ni", this becomes
::
value_from(url[, format])[.jmes_path_map(expr)].contains(key)
or
::
! value_from(url[, format])[.jmes_path_map(expr)].contains(key)
The complete domain of op values is::
Counter({'op: not-in': 943,
'op: ni': 1482,
'op: in': 656,
'op: intersect': 8,
'value_from: op: ni': 32,
'value_from: op: in': 8,
'value_from: op: not-in': 1,
'no op present': 14})
The ``intersect`` option replaces "contains" with "intersect".
The 41 examples with the ``op:`` buried in the
``value_from:`` clause follow a similar pattern.
The remaining 14 have no explicit operation. The default is ``op: in``.
Also.
Note that the JMES path can have a substitution value buried in it.
It works like this
::
config_args = {
'account_id': manager.config.account_id,
'region': manager.config.region
}
self.data = format_string_values(data, **config_args)
This is a separate function to reach into the C7N objects and
gather pieces of data (if needed) to adjust the JMESPath.
"""
filter_op_map = {
"in": "{1}.contains({0})",
"ni": "! {1}.contains({0})",
"not-in": "! {1}.contains({0})",
"intersect": "{1}.intersect({0})",
}
source: str
url = value_from["url"]
if "format" in value_from:
format = value_from["format"].strip()
source = f"value_from({C7N_Rewriter.q(url)}, {C7N_Rewriter.q(format)})"
else:
# Parse URL to get format from path.
source = f"value_from({C7N_Rewriter.q(url)})"
if "expr" in value_from:
# if expr is a string, it's jmespath. Escape embedded apostrophes.
# TODO: The C7N_Rewriter.q() function *should* handle this.
expr_text = value_from["expr"].replace("'", "\\'")
if "{" in expr_text:
expr_text = f"subst('{expr_text}')"
else:
expr_text = f"'{expr_text}'"
cel_value = f"{source}.jmes_path({expr_text})"
# TODO: if expr is an integer, we use ``.map(x, x[integer])``
else:
cel_value = f"{source}"
if op is None:
# Sometimes the op: is inside the value_from clause.
# Sometimes it's omitted, and it seems like "in" could be a default.
op = value_from.get("op", "in")
if value_type is None:
pass
elif value_type == "normalize":
cel_value = f"{cel_value}.map(v, normalize(v))"
# The schema defines numerous value_type options available.
else:
raise ValueError(f"Unknown value_type: {value_type}") # pragma: no cover
return filter_op_map[cast(str, op)].format(key, cel_value)
@staticmethod
def type_value_rewrite(resource: str, operation: Dict[str, Any]) -> str:
"""
Transform one atomic ``type: value`` clause.
Three common subtypes:
- A ``value: v``, ``op: op`` pair. This is the :meth:`value_to_cel` method.
- A ``value: v`` with no ``op:``. This devolves to the present/not-null/absent/empty test.
- Special ``value_from:``. This is the :meth:`value_from_to_cel` method.
Some other things that arrive here:
- A ``tag:name: absent``, shorthand for "key: "tag:name", "value": "absent"
"""
if "key" not in operation:
# The {"tag:...": "absent"} case?
if len(operation.items()) == 1:
key = list(operation)[0]
value = operation[key]
operation = {"key": key, "value": value}
else:
raise ValueError(f"Missing key {operation}") # pragma: no cover
key = C7N_Rewriter.key_to_cel(operation["key"])
if "value" in operation and "op" in operation:
# Literal value supplied in the filter
return C7N_Rewriter.value_to_cel(
key, operation["op"], operation["value"], operation.get("value_type")
)
elif "value" in operation and "op" not in operation:
# C7N has the following implementation...
# if r is None and v == 'absent':
# return True
# elif r is not None and v == 'present':
# return True
# elif v == 'not-null' and r:
# return True
# elif v == 'empty' and not r:
# return True
if operation["value"] in ("present", "not-null"):
return C7N_Rewriter.value_to_cel(key, "__present__", None)
elif operation["value"] in ("absent", "empty"):
return C7N_Rewriter.value_to_cel(key, "__absent__", None)
else:
raise ValueError(f"Missing value without op in {operation}")
elif "value_from" in operation:
# Value fetched from S3 or HTTPS
return C7N_Rewriter.value_from_to_cel(
key, operation.get("op"), operation["value_from"]
)
else:
raise ValueError(f"Missing value/value_type in {operation}")
@staticmethod
def type_marked_for_op_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
filters:
- op: delete
skew: 4
type: marked-for-op
to::
resource["Tags"].marked_key("marked-for-op").action == "delete"
&& now >= (
timestamp(resource["Tags"].marked_key("marked-for-op").action_date)
- duration('4d")
)
There's an optional ``tag:`` attribute to name the Tag's Key (default "custodian_status").
The op has to match the target op (default "stop").
The Tag's Value *should* have the form ``message:op@action_date``.
Otherwise the result is False.
Making this a variant on ``resource["Tags"].filter(x, x["Key"] == {tag})[0]["Value"]``
is awkward because we're checking at least two separate properties of the value.
Relies on :py:func:`celpy.c7nlib.marked_key` to parse the tag value into
a small mapping with ``"message"``, ``"action"``, and ``"action_date"`` keys.
"""
key = f'{C7N_Rewriter.resource}["Tags"]'
tag = c7n_filter.get("tag", "custodian_status")
op = c7n_filter.get("op", "stop")
skew = int(c7n_filter.get("skew", 0))
skew_hours = int(c7n_filter.get("skew_hours", 0))
if "tz" in c7n_filter: # pragma: no cover
# Not widely used.
tz = c7n_filter.get("tz", "utc")
logger.error(
"Cannot convert mark-for-op: with tz: %s in %s", tz, c7n_filter
)
clauses = [
f"{key}.marked_key({C7N_Rewriter.q(tag)}).action == {C7N_Rewriter.q(op)}",
f'{C7N_Rewriter.now} >= {key}.marked_key("{tag}").action_date '
f'- duration("{skew}d{skew_hours}h")',
]
return " && ".join(filter(None, clauses))
@staticmethod
def type_image_age_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
- days: 60
op: gte
type: image-age
to::
now - resource.image().CreationDate >= duration("60d")
Relies on :py:func:`celpy.c7nlib.image` function to implement
``get_instance_image(resource)`` from C7N Filters.
"""
key = f"{C7N_Rewriter.now} - {C7N_Rewriter.resource}.image().CreationDate"
days = C7N_Rewriter.age_to_duration(c7n_filter["days"])
cel_value = f"duration({days})"
op = cast(str, c7n_filter["op"])
return C7N_Rewriter.atomic_op_map[op].format(key, cel_value)
@staticmethod
def type_image_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
- key: Name
op: regex
type: image
value: (?!WIN.*)
to::
resource.image().Name.matches('(?!WIN.*)')
Relies on :py:func:`celpy.c7nlib.image`` function to implement
``get_instance_image(resource)`` from C7N Filters.
There are relatively few examples of this filter.
Both rely on slightly different semantics for the underlying
CEL ``matches()`` function.
Normally, CEL uses ``re.search()``, which doesn't
trivially work with with the ``(?!X.*)`` patterns.
Rather than compromise the CEL run-time with complexities
for this rare case, it seems better to provide a warning that the resulting
CEL code *may* require manual adjustment.
"""
key = f"resource.image().{c7n_filter['key']}"
op = cast(str, c7n_filter["op"])
cel_value = f"{C7N_Rewriter.q(c7n_filter['value'])}"
if "(?!" in cel_value:
logger.error("Image patterns like %r require a manual rewrite.", cel_value)
return C7N_Rewriter.atomic_op_map[op].format(key, cel_value)
@staticmethod
def type_event_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
- key: detail.responseElements.functionName
op: regex
type: event
value: ^(custodian-.*)
to::
event.detail.responseElements.functionName.matches("^(custodian-.*)")
This relies on ``event`` being a global, like the ``resource``.
"""
key = f"event.{c7n_filter['key']}"
op = cast(str, c7n_filter["op"])
cel_value = c7n_filter["value"]
return C7N_Rewriter.atomic_op_map[op].format(
key, f"{C7N_Rewriter.q(cel_value)}"
)
@staticmethod
def type_metrics_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
- type: metrics
name: CPUUtilization
days: 4
period: 86400
value: 30
op: less-than
or::
- type: metrics
name: RequestCount
statistics: Sum
days: 7
value: 7
missing-value: 0
op: less-than
to::
get_raw_metrics(
{"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": {"Name": "InstanceId", "Value": resource.InstanceId},
"Statistics": ["Average"],
"StartTime": now - duration("4d"),
"EndTime": now,
"Period": duration("86400s")}
).exists(m, m["AWS/EC2"].CPUUtilization.Average < 30)
get_raw_metrics(
{"Namespace": "AWS/ELB",
"MetricName": "RequestCount",
"Dimensions": {"Name": "InstanceId", "Value": resource.InstanceId},
"Statistics": ["Sum"],
"StartTime": now - duration("7d"),
"EndTime": now,
"Period": duration("7d")}
).map(m: m = null ? 0 : m["AWS/ELB"].RequestCount.Sum < 7)
Note that days computes a default for period as well as start time.
Default days is 14, which becomes a default period of 14 days -> seconds, 1209600.
Default statistics is Average.
Relies on :py:func:`celpy.c7nlib.get_metrics` to fetch the metrics.
C7N uses the parameters to invoke AWS
https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/
API_GetMetricStatistics.html
There are some irksome redundancies for the common case in C7N:
- ``"Namespace": "AWS/EC2"`` is derivable from the resource type, and shouldn't need
to be stated explicitly. C7N hides this by transforming resource type to namespace.
- ``""Dimensions": {"Name": "InstanceId", "Value": resource.InstanceId}`` is
derivable from the resource information and shouldn't necessarily be exposed like this.
- ``"Statistics": ["Average"]`` should *always* be a singleton
to simplify the ``exists()`` macro.
- ``m["AWS/EC2"].CPUUtilization.Average`` can then be eliminated because we get
a simple list of values for the namespace, metric name, and statistic combination.
optimized::
resource.get_metrics(
{"MetricName": "CPUUtilization",
"Statistic": "Average",
"StartTime": now - duration("4d"),
"EndTime": now,
"Period": duration("86400s")})
.exists(m, m < 30)
resource.get_metrics(
{"MetricName": "RequestCount",
"Statistic": "Sum",
"StartTime": now - duration("7d"),
"EndTime": now,
"Period": duration("7d")})
.map(m, m == null ? 0 : m)
.exists(m, m < 7)
.. todo:: The extra fiddling involved with attr-multiplier and percent-attr
in a map() clause.
.map(m, m / (resource["{percent-attr}"] * {attr-multiplier}) * 100)
.exists(m, m op value)
"""
name = c7n_filter["name"]
statistics = c7n_filter.get("statistics", "Average")
C7N_Rewriter.age_to_duration(c7n_filter["days"])
start = c7n_filter.get("days", 14) # Days
period = c7n_filter.get("period", start * 86400)
start_d = C7N_Rewriter.age_to_duration(start)
period_d = C7N_Rewriter.seconds_to_duration(period)
op = c7n_filter["op"]
value = c7n_filter["value"]
macro = C7N_Rewriter.atomic_op_map[op].format("m", f"{value}")
if "missing-value" in c7n_filter:
missing = c7n_filter["missing-value"]
return (
f"resource.get_metrics("
f'{{"MetricName": {C7N_Rewriter.q(name)}, '
f'"Statistic": {C7N_Rewriter.q(statistics)}, '
f'"StartTime": now - duration({start_d}), "EndTime": now, '
f'"Period": duration({period_d})}})'
f".map(m, m == null ? {missing} : m)"
f".exists(m, {macro})"
)
else:
return (
f"resource.get_metrics("
f'{{"MetricName": {C7N_Rewriter.q(name)}, '
f'"Statistic": {C7N_Rewriter.q(statistics)}, '
f'"StartTime": now - duration({start_d}), "EndTime": now, '
f'"Period": duration({period_d})}})'
f".exists(m, {macro})"
)
@staticmethod
def type_age_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
policies:
- name: redshift-old-snapshots
resource: redshift-snapshot
filters:
- type: age
days: 21
op: gt
To::
now - timestamp(resource.SnapshotCreateTime) > duration("21d")
What's important is that each resource type has a distinct attribute name
used for "age".
"""
attribute_map = {
"launch-config": "resource.CreatedTime",
"ebs-snapshot": "resource.StartTime",
"cache-snapshot": "resource.NodeSnaphots.min(x, x.SnapshotCreateTime)",
"rds-snapshot": "SnapshotCreateTime",
"rds-cluster-snapshot": "SnapshotCreateTime",
"redshift-snapshot": "SnapshotCreateTime",
}
attr = attribute_map[resource]
op = c7n_filter["op"]
days = c7n_filter["days"]
return C7N_Rewriter.atomic_op_map[op].format(
f"now - timestamp({attr})", f'duration("{days}d")'
)
@staticmethod
def type_security_group_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
policies:
- name: alb-report
resource: app-elb
filters:
- key: tag:ASSET
op: eq
type: security-group
value: SPECIALASSETNAME
To::
resource.SecurityGroups.map(sg. sg.GroupId.security_group())
.exists(sg, sg["Tags"].filter(x, x["Key"] == "ASSET")[0]["Value"] == 'SPECIALASSETNAME')
The relationship between resource and security group variables by resource type.
Relies on :py:func:`celpy.c7nlib.get_related` function to reach into the filter
to a method of the C7N ``RelatedResourceFilter`` mixin.
Relies on :py:func:`celpy.c7nlib.security_group` function to leverage
the the filter's internal ``get_related()`` method.
For additional information, see the :py:class:`c7n.filters.vpc.NetworkLocation`.
This class reaches into SecurityGroup and Subnet to fetch related objects.
Most cases are relatively simple. There are three very complex cases:
- ASG -- the security group is indirectly associated with config items and launch items.
The filter has ``get_related_ids([resource])`` to be used before ``get_related()``.
- EFS -- the security group is indirectly associated with an MountTargetId.
The filter has ``get_related_ids([resource])`` to be used before ``get_related()``.
- VPC -- The security group seems to have a VpcId that's used.
The filter has ``get_related_ids([resource])`` to be used before ``get_related()``.
"""
attribute_map = {
"app-elb": "resource.SecurityGroups.map(sg, sg.security_group())",
"asg": "resource.get_related_ids().map(sg. sg.security_group())",
"lambda": "VpcConfig.SecurityGroupIds.map(sg, sg.security_group())",
"batch-compute": (
"resource.computeResources.securityGroupIds.map(sg, sg.security_group())"
),
"codecommit": "resource.vpcConfig.securityGroupIds.map(sg, sg.security_group())",
"directory": "resource.VpcSettings.SecurityGroupId.security_group()",
"dms-instance": (
"resource.VpcSecurityGroups.map(sg, sg.VpcSecurityGroupId.security_group())"
),
"dynamodb-table": (
"resource.SecurityGroups.map(sg, sg..SecurityGroupIdentifier.security_group())"
),
"ec2": "resource.SecurityGroups.map(sg, sg.GroupId.security_group())",
"efs": "resource.get_related_ids().map(sg, sg.security_group())",
"eks": "resource.resourcesVpcConfig.securityGroupIds.map(sg, sg.security_group())",
"cache-cluster": "resource.SecurityGroups.map(sg, sg.SecurityGroupId.security_group())",
"elasticsearch": "resource.VPCOptions.SecurityGroupIds.map(sg, sg.security_group())",
"elb": "resource.SecurityGroups.map(sg, sg.security_group())",
"glue-connection": "resource.PhysicalConnectionRequirements.SecurityGroupIdList"
".map(sg, sg.security_group())",
"kafka": "resource.BrokerNodeGroupInfo.SecurityGroups[.map(sg, sg.security_group())",
"message-broker": "resource.SecurityGroups.map(sg, sg.security_group())",
"rds": "resource.VpcSecurityGroups.map(sg, sg.VpcSecurityGroupId.security_group())",
"rds-cluster": (
"resource.VpcSecurityGroups.map(sg, sg.VpcSecurityGroupId.security_group())"
),
"redshift": (
"resource.VpcSecurityGroups.map(sg, sg.VpcSecurityGroupId.security_group())"
),
"sagemaker-notebook": "resource.SecurityGroups.map(sg, sg.security_group())",
"vpc": "resource.get_related_ids().map(sg. sg.security_group())",
"eni": "resource.Groups.map(sg, sg.GroupId.security_group())",
"vpc-endpoint": "resource.Groups.map(sg, sg.GroupId.security_group())",
}
attr = attribute_map[resource]
op = c7n_filter["op"]
value = repr(c7n_filter["value"])
key = C7N_Rewriter.key_to_cel(c7n_filter["key"], context="sg")
exists_expr = C7N_Rewriter.atomic_op_map[op].format(key, value)
return f"{attr}.exists(sg, {exists_expr})"
@staticmethod
def type_subnet_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
policies:
- name: asg-restriction-az1e-notify-weekly
resource: asg
filters:
- key: SubnetId
op: in
type: subnet
value_from:
format: txt
url: s3://path-to-resource/subnets.txt
value_type: normalize
To::
value_from("s3://path-to-resource/subnets.txt").map(x, normalize(x)).contains(
resource.SubnetId.subnet().SubnetID)
For additional information, see the :py:class:`c7n.filters.vpc.NetworkLocation`.
This class reaches into SecurityGroup and Subnet to fetch related objects.
Because there's a key, it's not clear we need an attribute map to locate
the attribute of the resource.
Relies on :py:func:`celpy.c7nlib.subnet` to get subnet details via the C7N Filter.
"""
key = c7n_filter["key"]
full_key = f"{C7N_Rewriter.resource}.{key}.subnet().SubnetID"
return C7N_Rewriter.value_from_to_cel(
full_key,
c7n_filter["op"],
c7n_filter["value_from"],
value_type=c7n_filter.get("value_type"),
)
@staticmethod
def type_flow_log_rewrite(resource: str, c7n_filter: Dict[str, Any]) -> str:
"""
Transform::
policies:
- name: flow-mis-configured
resource: vpc
filters:
- not:
- type: flow-logs
enabled: true
set-op: or
op: equal
# equality operator applies to following keys
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/celtypes.py | src/celpy/celtypes.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Provides wrappers over Python types to provide CEL semantics.
This can be used by a Python module to work with CEL-friendly values and CEL results.
Examples of distinctions between CEL and Python:
- Unlike Python ``bool``, CEL :py:class:`BoolType` won't do some math.
- CEL has ``int64`` and ``uint64`` subclasses of integer. These have specific ranges and
raise :exc:`ValueError` errors on overflow.
CEL types will raise :exc:`ValueError` for out-of-range values and :exc:`TypeError`
for operations they refuse.
The :py:mod:`evaluation` module can capture these exceptions and turn them into result values.
This can permit the logic operators to quietly silence them via "short-circuiting".
In the normal course of events, CEL's evaluator may attempt operations between a
CEL exception result and an instance of one of CEL types.
We rely on this leading to an ordinary Python :exc:`TypeError` to be raised to propogate
the error. Or. A logic operator may discard the error object.
The :py:mod:`evaluation` module extends these types with it's own :exc:`CELEvalError` exception.
We try to keep that as a separate concern from the core operator implementations here.
We leverage Python features, which means raising exceptions when there is a problem.
Types
=============
See https://github.com/google/cel-go/tree/master/common/types
These are the Go type definitions that are used by CEL:
- BoolType
- BytesType
- DoubleType
- DurationType
- IntType
- ListType
- MapType
- NullType
- StringType
- TimestampType
- TypeType
- UintType
The above types are handled directly byt CEL syntax.
e.g., ``42`` vs. ``42u`` vs. ``"42"`` vs. ``b"42"`` vs. ``42.``.
We provide matching Python class names for each of these types. The Python type names
are subclasses of Python native types, allowing a client to transparently work with
CEL results. A Python host should be able to provide values to CEL that will be tolerated.
A type hint of ``Value`` unifies these into a common hint.
The CEL Go implementation also supports protobuf types:
- dpb.Duration
- tpb.Timestamp
- structpb.ListValue
- structpb.NullValue
- structpb.Struct
- structpb.Value
- wrapperspb.BoolValue
- wrapperspb.BytesValue
- wrapperspb.DoubleValue
- wrapperspb.FloatValue
- wrapperspb.Int32Value
- wrapperspb.Int64Value
- wrapperspb.StringValue
- wrapperspb.UInt32Value
- wrapperspb.UInt64Value
These types involve expressions like the following::
google.protobuf.UInt32Value{value: 123u}
In this case, the well-known protobuf name is directly visible as CEL syntax.
There's a ``google`` package with the needed definitions.
Type Provider
==============================
A type provider can be bound to the environment, this will support additional types.
This appears to be a factory to map names of types to type classes.
Run-time type binding is shown by a CEL expression like the following::
TestAllTypes{single_uint32_wrapper: 432u}
The ``TestAllTypes`` is a protobuf type added to the CEL run-time. The syntax
is defined by this syntax rule::
member_object : member "{" [fieldinits] "}"
The ``member`` is part of a type provider library,
either a standard protobuf definition or an extension. The field inits build
values for the protobuf object.
See https://github.com/google/cel-go/blob/master/test/proto3pb/test_all_types.proto
for the ``TestAllTypes`` protobuf definition that is registered as a type provider.
This expression will describes a Protobuf ``uint32`` object.
Type Adapter
=============
So far, it appears that a type adapter wraps existing Go or C++ types
with CEL-required methods. This seems like it does not need to be implemented
in Python.
Numeric Details
===============
Integer division truncates toward zero.
The Go definition of modulus::
// Mod returns the floating-point remainder of x/y.
// The magnitude of the result is less than y and its
// sign agrees with that of x.
https://golang.org/ref/spec#Arithmetic_operators
"Go has the nice property that -a/b == -(a/b)."
::
x y x / y x % y
5 3 1 2
-5 3 -1 -2
5 -3 -1 2
-5 -3 1 -2
Python definition::
The modulo operator always yields a result
with the same sign as its second operand (or zero);
the absolute value of the result is strictly smaller than
the absolute value of the second operand.
Here's the essential rule::
x//y * y + x%y == x
However. Python ``//`` truncates toward negative infinity. Go ``/`` truncates toward zero.
To get Go-like behavior, we need to use absolute values and restore the signs later.
::
x_sign = -1 if x < 0 else +1
go_mod = x_sign * (abs(x) % abs(y))
return go_mod
Timzone Details
===============
An implementation may have additional timezone names that must be injected into
the ``pendulum`` processing. (Formerly ``dateutil.gettz()``.)
For example, there may be the following sequence:
1. A lowercase match for an alias or an existing timezone.
2. A titlecase match for an existing timezone.
3. The fallback, which is a +/-HH:MM string.
.. TODO: Permit an extension into the timezone lookup.
"""
import datetime
import logging
import re
from functools import reduce, wraps
from math import fsum, trunc
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Mapping,
NoReturn,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
cast,
overload,
)
import pendulum
from pendulum import timezone
import pendulum.tz.exceptions
logger = logging.getLogger(f"celpy.{__name__}")
Value = Union[
"BoolType",
"BytesType",
"DoubleType",
"DurationType",
"IntType",
"ListType",
"MapType",
None, # Used instead of NullType
"StringType",
"TimestampType",
"UintType",
]
# The domain of types used to build Annotations.
CELType = Union[
Type["BoolType"],
Type["BytesType"],
Type["DoubleType"],
Type["DurationType"],
Type["IntType"],
Type["ListType"],
Type["MapType"],
Callable[..., None], # Used instead of NullType
Type["StringType"],
Type["TimestampType"],
Type["TypeType"], # Used to mark Protobuf Type values
Type["UintType"],
Type["PackageType"],
Type["MessageType"],
]
def type_matched(method: Callable[[Any, Any], Any]) -> Callable[[Any, Any], Any]:
"""Decorates a method to assure the "other" value has the same type."""
@wraps(method)
def type_matching_method(self: Any, other: Any) -> Any:
if not (
issubclass(type(other), type(self)) or issubclass(type(self), type(other))
):
raise TypeError(
f"no such overload: {self!r} {type(self)} != {other!r} {type(other)}"
)
return method(self, other)
return type_matching_method
def logical_condition(e: Value, x: Value, y: Value) -> Value:
"""
CEL e ? x : y operator.
Choose one of x or y. Exceptions in the unchosen expression are ignored.
Example::
2 / 0 > 4 ? 'baz' : 'quux'
is a "division by zero" error.
::
>>> logical_condition(
... BoolType(True), StringType("this"), StringType("Not That"))
StringType('this')
>>> logical_condition(
... BoolType(False), StringType("Not This"), StringType("that"))
StringType('that')
.. TODO:: Consider passing closures instead of Values.
The function can evaluate e().
If it's True, return x().
If it's False, return y().
Otherwise, it's a CELEvalError, which is the result
"""
if not isinstance(e, BoolType):
raise TypeError(f"Unexpected {type(e)} ? {type(x)} : {type(y)}")
result_value = x if e else y
logger.debug("logical_condition(%r, %r, %r) = %r", e, x, y, result_value)
return result_value
def logical_and(x: Value, y: Value) -> Value:
"""
Native Python has a left-to-right rule.
CEL && is commutative with non-Boolean values, including error objects.
.. TODO:: Consider passing closures instead of Values.
The function can evaluate x().
If it's False, then return False.
Otherwise, it's True or a CELEvalError, return y().
"""
if not isinstance(x, BoolType) and not isinstance(y, BoolType):
raise TypeError(f"{type(x)} {x!r} and {type(y)} {y!r}")
elif not isinstance(x, BoolType) and isinstance(y, BoolType):
if y:
return x # whatever && true == whatever
else:
return y # whatever && false == false
elif isinstance(x, BoolType) and not isinstance(y, BoolType):
if x:
return y # true && whatever == whatever
else:
return x # false && whatever == false
else:
return BoolType(cast(BoolType, x) and cast(BoolType, y))
def logical_not(x: Value) -> Value:
"""
A function for native python `not`.
This could almost be `logical_or = evaluation.boolean(operator.not_)`,
but the definition would expose Python's notion of "truthiness", which isn't appropriate for CEL.
"""
if isinstance(x, Exception):
return x
if isinstance(x, BoolType):
result_value = BoolType(not x)
else:
raise TypeError(f"not {type(x)}")
logger.debug("logical_not(%r) = %r", x, result_value)
return result_value
def logical_or(x: Value, y: Value) -> Value:
"""
Native Python has a left-to-right rule: ``(True or y)`` is True, ``(False or y)`` is y.
CEL ``||`` is commutative with non-Boolean values, including errors.
``(x || false)`` is ``x``, and ``(false || y)`` is ``y``.
Example 1::
false || 1/0 != 0
is a "no matching overload" error.
Example 2::
(2 / 0 > 3 ? false : true) || true
is a "True"
If the operand(s) are not ``BoolType``, we'll create an ``TypeError`` that will become a ``CELEvalError``.
.. TODO:: Consider passing closures instead of Values.
The function can evaluate x().
If it's True, then return True.
Otherwise, it's False or a CELEvalError, return y().
"""
if not isinstance(x, BoolType) and not isinstance(y, BoolType):
raise TypeError(f"{type(x)} {x!r} or {type(y)} {y!r}")
elif not isinstance(x, BoolType) and isinstance(y, BoolType):
if y:
return y # whatever || true == true
else:
return x # whatever || false == whatever
elif isinstance(x, BoolType) and not isinstance(y, BoolType):
if x:
return x # true || whatever == true
else:
return y # false || whatever == whatever
else:
return BoolType(cast(BoolType, x) or cast(BoolType, y))
class BoolType(int):
"""
Native Python permits all unary operators to work on ``bool`` objects.
For CEL, we need to prevent the CEL expression ``-false`` from working.
"""
def __new__(cls: Type["BoolType"], source: Any) -> "BoolType":
if source is None:
return super().__new__(cls, 0)
elif isinstance(source, BoolType):
return source
elif isinstance(source, MessageType):
return super().__new__(cls, cast(int, source.get(StringType("value"))))
elif isinstance(source, (str, StringType)):
if source in ("False", "f", "FALSE", "false"):
return super().__new__(cls, 0)
elif source in ("True", "t", "TRUE", "true"):
return super().__new__(cls, 1)
return super().__new__(cls, source)
else:
return super().__new__(cls, source)
def __repr__(self) -> str:
return f"{self.__class__.__name__}({bool(self)})"
def __str__(self) -> str:
return str(bool(self))
def __neg__(self) -> NoReturn:
raise TypeError("no such overload")
def __hash__(self) -> int:
return super().__hash__()
class BytesType(bytes):
"""Python's bytes semantics are close to CEL."""
def __new__(
cls: Type["BytesType"],
source: Union[str, bytes, Iterable[int], "BytesType", "StringType"],
*args: Any,
**kwargs: Any,
) -> "BytesType":
if source is None:
return super().__new__(cls, b"")
elif isinstance(source, (bytes, BytesType)):
return super().__new__(cls, source)
elif isinstance(source, (str, StringType)):
return super().__new__(cls, source.encode("utf-8"))
elif isinstance(source, MessageType):
return super().__new__(
cls,
cast(bytes, source.get(StringType("value"))),
)
elif isinstance(source, Iterable):
return super().__new__(cls, source)
else:
raise TypeError(f"Invalid initial value type: {type(source)}")
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def contains(self, item: Value) -> BoolType:
return BoolType(cast(BytesType, item) in self) # type: ignore [comparison-overlap]
class DoubleType(float):
"""
Native Python permits mixed type comparisons, doing conversions as needed.
For CEL, we need to prevent mixed-type comparisons from working.
TODO: Conversions from string? IntType? UintType? DoubleType?
"""
def __new__(cls: Type["DoubleType"], source: Any) -> "DoubleType":
if source is None:
return super().__new__(cls, 0)
elif isinstance(source, MessageType):
return super().__new__(cls, cast(float, source.get(StringType("value"))))
else:
return super().__new__(cls, source)
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __str__(self) -> str:
text = str(float(self))
return text
def __neg__(self) -> "DoubleType":
return DoubleType(super().__neg__())
def __mod__(self, other: Any) -> NoReturn:
raise TypeError(
f"found no matching overload for '_%_' applied to '(double, {type(other)})'"
)
def __truediv__(self, other: Any) -> "DoubleType":
if cast(float, other) == 0.0:
return DoubleType("inf")
else:
return DoubleType(super().__truediv__(other))
def __rmod__(self, other: Any) -> NoReturn:
raise TypeError(
f"found no matching overload for '_%_' applied to '({type(other)}, double)'"
)
def __rtruediv__(self, other: Any) -> "DoubleType":
if self == 0.0:
return DoubleType("inf")
else:
return DoubleType(super().__rtruediv__(other))
@type_matched
def __eq__(self, other: Any) -> bool:
return super().__eq__(other)
@type_matched
def __ne__(self, other: Any) -> bool:
return super().__ne__(other)
def __hash__(self) -> int:
return super().__hash__()
IntOperator = TypeVar("IntOperator", bound=Callable[..., int])
def int64(operator: IntOperator) -> IntOperator:
"""Apply an operation, but assure the value is within the int64 range."""
@wraps(operator)
def clamped_operator(*args: Any, **kwargs: Any) -> int:
result_value: int = operator(*args, **kwargs)
if -(2**63) <= result_value < 2**63:
return result_value
raise ValueError("overflow")
return cast(IntOperator, clamped_operator)
class IntType(int):
"""
A version of int with overflow errors outside int64 range.
features/integer_math.feature:277 "int64_overflow_positive"
>>> IntType(9223372036854775807) + IntType(1)
Traceback (most recent call last):
...
ValueError: overflow
>>> 2**63
9223372036854775808
features/integer_math.feature:285 "int64_overflow_negative"
>>> -IntType(9223372036854775808) - IntType(1)
Traceback (most recent call last):
...
ValueError: overflow
>>> IntType(DoubleType(1.9))
IntType(1)
>>> IntType(DoubleType(-123.456))
IntType(-123)
"""
def __new__(
cls: Type["IntType"], source: Any, *args: Any, **kwargs: Any
) -> "IntType":
convert: Callable[..., int]
if source is None:
return super().__new__(cls, 0)
elif isinstance(source, IntType):
return source
elif isinstance(source, MessageType):
# Used by protobuf.
return super().__new__(cls, cast(int, source.get(StringType("value"))))
elif isinstance(source, (float, DoubleType)):
convert = int64(trunc)
elif isinstance(source, TimestampType):
convert = int64(lambda src: src.timestamp())
elif isinstance(source, (str, StringType)) and source[:2] in {"0x", "0X"}:
convert = int64(lambda src: int(src[2:], 16))
elif isinstance(source, (str, StringType)) and source[:3] in {"-0x", "-0X"}:
convert = int64(lambda src: -int(src[3:], 16))
else:
# Must tolerate "-" as part of the literal.
# See https://github.com/google/cel-spec/issues/126
convert = int64(int)
return super().__new__(cls, convert(source))
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __str__(self) -> str:
text = str(int(self))
return text
@int64
def __neg__(self) -> "IntType":
return IntType(super().__neg__())
@int64
def __add__(self, other: Any) -> "IntType":
return IntType(super().__add__(cast(IntType, other)))
@int64
def __sub__(self, other: Any) -> "IntType":
return IntType(super().__sub__(cast(IntType, other)))
@int64
def __mul__(self, other: Any) -> "IntType":
return IntType(super().__mul__(cast(IntType, other)))
@int64
def __truediv__(self, other: Any) -> "IntType":
other = cast(IntType, other)
self_sign = -1 if self < IntType(0) else +1
other_sign = -1 if other < IntType(0) else +1
go_div = self_sign * other_sign * (abs(self) // abs(other))
return IntType(go_div)
__floordiv__ = __truediv__
@int64
def __mod__(self, other: Any) -> "IntType":
self_sign = -1 if self < IntType(0) else +1
go_mod = self_sign * (abs(self) % abs(cast(IntType, other)))
return IntType(go_mod)
@int64
def __radd__(self, other: Any) -> "IntType":
return IntType(super().__radd__(cast(IntType, other)))
@int64
def __rsub__(self, other: Any) -> "IntType":
return IntType(super().__rsub__(cast(IntType, other)))
@int64
def __rmul__(self, other: Any) -> "IntType":
return IntType(super().__rmul__(cast(IntType, other)))
@int64
def __rtruediv__(self, other: Any) -> "IntType":
other = cast(IntType, other)
self_sign = -1 if self < IntType(0) else +1
other_sign = -1 if other < IntType(0) else +1
go_div = self_sign * other_sign * (abs(other) // abs(self))
return IntType(go_div)
__rfloordiv__ = __rtruediv__
@int64
def __rmod__(self, other: Any) -> "IntType":
left_sign = -1 if other < IntType(0) else +1
go_mod = left_sign * (abs(other) % abs(self))
return IntType(go_mod)
@type_matched
def __eq__(self, other: Any) -> bool:
return super().__eq__(other)
@type_matched
def __ne__(self, other: Any) -> bool:
return super().__ne__(other)
@type_matched
def __lt__(self, other: Any) -> bool:
return super().__lt__(other)
@type_matched
def __le__(self, other: Any) -> bool:
return super().__le__(other)
@type_matched
def __gt__(self, other: Any) -> bool:
return super().__gt__(other)
@type_matched
def __ge__(self, other: Any) -> bool:
return super().__ge__(other)
def __hash__(self) -> int:
return super().__hash__()
def uint64(operator: IntOperator) -> IntOperator:
"""Apply an operation, but assure the value is within the uint64 range."""
@wraps(operator)
def clamped_operator(*args: Any, **kwargs: Any) -> int:
result_value = operator(*args, **kwargs)
if 0 <= result_value < 2**64:
return result_value
raise ValueError("overflow")
return cast(IntOperator, clamped_operator)
class UintType(int):
"""
A version of int with overflow errors outside uint64 range.
Alternatives:
Option 1 - Use https://pypi.org/project/fixedint/
Option 2 - use array or struct modules to access an unsigned object.
Test Cases:
features/integer_math.feature:149 "unary_minus_no_overload"
>>> -UintType(42)
Traceback (most recent call last):
...
TypeError: no such overload
uint64_overflow_positive
>>> UintType(18446744073709551615) + UintType(1)
Traceback (most recent call last):
...
ValueError: overflow
uint64_overflow_negative
>>> UintType(0) - UintType(1)
Traceback (most recent call last):
...
ValueError: overflow
>>> - UintType(5)
Traceback (most recent call last):
...
TypeError: no such overload
"""
def __new__(
cls: Type["UintType"], source: Any, *args: Any, **kwargs: Any
) -> "UintType":
convert: Callable[..., int]
if isinstance(source, UintType):
return source
elif isinstance(source, (float, DoubleType)):
convert = uint64(trunc)
elif isinstance(source, TimestampType):
convert = uint64(lambda src: src.timestamp())
elif isinstance(source, (str, StringType)) and source[:2] in {"0x", "0X"}:
convert = uint64(lambda src: int(src[2:], 16))
elif isinstance(source, MessageType):
# Used by protobuf.
convert = uint64(
lambda src: src["value"] if src["value"] is not None else 0
)
elif source is None:
convert = uint64(lambda src: 0)
else:
convert = uint64(int)
return super().__new__(cls, convert(source))
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __str__(self) -> str:
text = str(int(self))
return text
def __neg__(self) -> NoReturn:
raise TypeError("no such overload")
@uint64
def __add__(self, other: Any) -> "UintType":
return UintType(super().__add__(cast(IntType, other)))
@uint64
def __sub__(self, other: Any) -> "UintType":
return UintType(super().__sub__(cast(IntType, other)))
@uint64
def __mul__(self, other: Any) -> "UintType":
return UintType(super().__mul__(cast(IntType, other)))
@uint64
def __truediv__(self, other: Any) -> "UintType":
return UintType(super().__floordiv__(cast(IntType, other)))
__floordiv__ = __truediv__
@uint64
def __mod__(self, other: Any) -> "UintType":
return UintType(super().__mod__(cast(IntType, other)))
@uint64
def __radd__(self, other: Any) -> "UintType":
return UintType(super().__radd__(cast(IntType, other)))
@uint64
def __rsub__(self, other: Any) -> "UintType":
return UintType(super().__rsub__(cast(IntType, other)))
@uint64
def __rmul__(self, other: Any) -> "UintType":
return UintType(super().__rmul__(cast(IntType, other)))
@uint64
def __rtruediv__(self, other: Any) -> "UintType":
return UintType(super().__rfloordiv__(cast(IntType, other)))
__rfloordiv__ = __rtruediv__
@uint64
def __rmod__(self, other: Any) -> "UintType":
return UintType(super().__rmod__(cast(IntType, other)))
@type_matched
def __eq__(self, other: Any) -> bool:
return super().__eq__(other)
@type_matched
def __ne__(self, other: Any) -> bool:
return super().__ne__(other)
def __hash__(self) -> int:
return super().__hash__()
class ListType(List[Value]):
"""
Native Python implements comparison operations between list objects.
For CEL, we prevent list comparison operators from working.
We provide an :py:meth:`__eq__` and :py:meth:`__ne__` that
gracefully ignore type mismatch problems, calling them not equal.
See https://github.com/google/cel-spec/issues/127
An implied logical And means a singleton behaves in a distinct way from a non-singleton list.
"""
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __lt__(self, other: Any) -> NoReturn:
raise TypeError("no such overload")
def __le__(self, other: Any) -> NoReturn:
raise TypeError("no such overload")
def __gt__(self, other: Any) -> NoReturn:
raise TypeError("no such overload")
def __ge__(self, other: Any) -> NoReturn:
raise TypeError("no such overload")
def __eq__(self, other: Any) -> bool:
if other is None:
return False
if not isinstance(other, (list, ListType)):
raise TypeError(f"no such overload: ListType == {type(other)}")
def equal(s: Any, o: Any) -> Value:
try:
return BoolType(s == o)
except TypeError as ex:
return cast(BoolType, ex) # Instead of Union[BoolType, TypeError]
result_value = len(self) == len(other) and reduce(
logical_and, # type: ignore [arg-type]
(equal(item_s, item_o) for item_s, item_o in zip(self, other)),
BoolType(True),
)
if isinstance(result_value, TypeError):
raise result_value
return bool(result_value)
def __ne__(self, other: Any) -> bool:
if not isinstance(other, (list, ListType)):
raise TypeError(f"no such overload: ListType != {type(other)}")
def not_equal(s: Any, o: Any) -> Value:
try:
return BoolType(s != o)
except TypeError as ex:
return cast(BoolType, ex) # Instead of Union[BoolType, TypeError]
result_value = len(self) != len(other) or reduce(
logical_or, # type: ignore [arg-type]
(not_equal(item_s, item_o) for item_s, item_o in zip(self, other)),
BoolType(False),
)
if isinstance(result_value, TypeError):
raise result_value
return bool(result_value)
def contains(self, item: Value) -> BoolType:
return BoolType(item in self)
BaseMapTypes = Union[Mapping[Any, Any], Sequence[Tuple[Any, Any]], None]
MapKeyTypes = Union["IntType", "UintType", "BoolType", "StringType", str]
class MapType(Dict[Value, Value]):
"""
Native Python allows mapping updates and any hashable type as a kay.
CEL prevents mapping updates and has a limited domain of key types.
int, uint, bool, or string keys
We provide an :py:meth:`__eq__` and :py:meth:`__ne__` that
gracefully ignore type mismatch problems for the values, calling them not equal.
See https://github.com/google/cel-spec/issues/127
An implied logical And means a singleton behaves in a distinct way from a non-singleton mapping.
"""
def __init__(self, items: BaseMapTypes = None) -> None:
super().__init__()
if items is None:
pass
elif isinstance(items, Sequence):
# Must Be Unique
for name, value in items:
if name in self:
raise ValueError(f"Duplicate key {name!r}")
self[name] = value
elif isinstance(items, Mapping):
for name, value in items.items():
self[name] = value
else:
raise TypeError(f"Invalid initial value type: {type(items)}")
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __getitem__(self, key: Any) -> Any:
if not MapType.valid_key_type(key):
raise TypeError(f"unsupported key type: {type(key)}")
return super().__getitem__(key)
def __eq__(self, other: Any) -> bool:
if other is None:
return False
if not isinstance(other, (Mapping, MapType)):
raise TypeError(f"no such overload: MapType == {type(other)}")
def equal(s: Any, o: Any) -> BoolType:
try:
return BoolType(s == o)
except TypeError as ex:
return cast(BoolType, ex) # Instead of Union[BoolType, TypeError]
keys_s = self.keys()
keys_o = other.keys()
result_value = keys_s == keys_o and reduce(
logical_and, # type: ignore [arg-type]
(equal(self[k], other[k]) for k in keys_s),
BoolType(True),
)
if isinstance(result_value, TypeError):
raise result_value
return bool(result_value)
def __ne__(self, other: Any) -> bool:
if not isinstance(other, (Mapping, MapType)):
raise TypeError(f"no such overload: MapType != {type(other)}")
# Singleton special case, may return no-such overload.
if len(self) == 1 and len(other) == 1 and self.keys() == other.keys():
k = next(iter(self.keys()))
return cast(
bool, self[k] != other[k]
) # Instead of Union[BoolType, TypeError]
def not_equal(s: Any, o: Any) -> BoolType:
try:
return BoolType(s != o)
except TypeError as ex:
return cast(BoolType, ex) # Instead of Union[BoolType, TypeError]
keys_s = self.keys()
keys_o = other.keys()
result_value = keys_s != keys_o or reduce(
logical_or, # type: ignore [arg-type]
(not_equal(self[k], other[k]) for k in keys_s),
BoolType(False),
)
if isinstance(result_value, TypeError):
raise result_value
return bool(result_value)
def get(self, key: Any, default: Optional[Any] = None) -> Value:
"""There is no default provision in CEL, that's a Python feature."""
if not MapType.valid_key_type(key):
raise TypeError(f"unsupported key type: {type(key)}")
if key in self:
return super().get(key)
elif default is not None:
return cast(Value, default)
else:
raise KeyError(key)
@staticmethod
def valid_key_type(key: Any) -> bool:
"""Valid CEL key types. Plus native str for tokens in the source when evaluating ``e.f``"""
return isinstance(key, (IntType, UintType, BoolType, StringType, str))
def contains(self, item: Value) -> BoolType:
return BoolType(item in self)
class NullType:
"""Python's None semantics aren't quite right for CEL."""
def __eq__(self, other: Any) -> bool:
return isinstance(other, NullType)
def __ne__(self, other: Any) -> bool:
return not isinstance(other, NullType)
class StringType(str):
"""Python's str semantics are very, very close to CEL.
We rely on the overlap between ``"/u270c"`` and ``"/U0001f431"`` in CEL and Python.
"""
def __new__(
cls: Type["StringType"],
source: Union[str, bytes, "BytesType", "StringType"],
*args: Any,
**kwargs: Any,
) -> "StringType":
if isinstance(source, (bytes, BytesType)):
return super().__new__(cls, source.decode("utf"))
elif isinstance(source, (str, StringType)):
# TODO: Consider returning the original StringType object.
return super().__new__(cls, source)
else:
return cast(StringType, super().__new__(cls, source))
def __repr__(self) -> str:
return f"{self.__class__.__name__}({super().__repr__()})"
def __eq__(self, other: Any) -> bool:
return super().__eq__(other)
def __ne__(self, other: Any) -> bool:
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/__main__.py | src/celpy/__main__.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
The CLI interface to ``celpy``.
This parses the command-line options.
It also offers an interactive REPL.
"""
import argparse
import ast
import cmd
import datetime
import json
import logging
import logging.config
import os
from pathlib import Path
import re
import stat as os_stat
import sys
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
try:
import tomllib # type: ignore [import-not-found, unused-ignore]
except ImportError: # pragma: no cover
import tomli as tomllib # type: ignore [no-redef, import-not-found, unused-import, unused-ignore]
from celpy import Environment, Runner, celtypes
from celpy.adapter import CELJSONDecoder, CELJSONEncoder
from celpy.celparser import CELParseError
from celpy.evaluation import Annotation, CELEvalError, Result
logger = logging.getLogger("celpy")
# For argument parsing purposes.
# Note the reliance on `ast.literal_eval` for ListType and MapType conversions.
# Other types convert strings directly. These types need some help.
CLI_ARG_TYPES: Dict[str, Annotation] = {
"int": celtypes.IntType,
"uint": celtypes.UintType,
"double": celtypes.DoubleType,
"bool": celtypes.BoolType,
"string": celtypes.StringType,
"bytes": celtypes.BytesType,
"list": cast(
Callable[..., celtypes.Value],
lambda arg: celtypes.ListType(ast.literal_eval(arg)),
),
"map": cast(
Callable[..., celtypes.Value],
lambda arg: celtypes.MapType(ast.literal_eval(arg)),
),
"null_type": cast(Callable[..., celtypes.Value], lambda arg: None),
"single_duration": celtypes.DurationType,
"single_timestamp": celtypes.TimestampType,
"int64_value": celtypes.IntType,
"uint64_value": celtypes.UintType,
"double_value": celtypes.DoubleType,
"bool_value": celtypes.BoolType,
"string_value": celtypes.StringType,
"bytes_value": celtypes.BytesType,
"number_value": celtypes.DoubleType, # Ambiguous; can somtimes be integer.
"null_value": cast(Callable[..., celtypes.Value], lambda arg: None),
}
def arg_type_value(text: str) -> Tuple[str, Annotation, celtypes.Value]:
"""
Decompose ``-a name:type=value`` argument into a useful triple.
Also accept ``-a name:type``. This will find ``name`` in the environment and convert to the
requested type.
Also accepts ``-a name``. This will find ``name`` in the environment and treat it as a string.
Currently, names do not reflect package naming. An environment can be a package,
and the activation can include variables that are also part of the package.
This is not supported via the CLI.
Types can be celtypes class names or TYPE_NAME or PROTOBUF_TYPE
::
TYPE_NAME : "int64_value" | "null_value" | "uint64_value" | "double_value"
| "bool_value" | "string_value" | "bytes_value" | "number_value"
PROTOBUF_TYPE : "single_int64" | "single_int32" | "single_uint64" | "single_uint32"
| "single_sint64" | "single_sint32" | "single_fixed64" | "single_fixed32"
| "single_sfixed32" | "single_sfixed64" | "single_float" | "single_double"
| "single_bool" | "single_string" | "single_bytes"
| "single_duration" | "single_timestamp"
.. todo:: type names can include `.` to support namespacing for protobuf support.
:param text: Argument value
:return: Tuple with name, annotation, and resulting object.
"""
arg_pattern = re.compile(
r"^([_a-zA-Z][_a-zA-Z0-9]*)(?::([_a-zA-Z][_a-zA-Z0-9]*))?(?:=(.*))?$"
)
match = arg_pattern.match(text)
if match is None:
raise argparse.ArgumentTypeError(
f"arg {text} not 'var=string', 'var:type=value', or `var:type"
)
name, type_name, value_text = match.groups()
if value_text is None:
value_text = os.environ.get(name)
type_definition: Annotation # CELType or a conversion function
value: celtypes.Value # Specific value.
if type_name:
try:
type_definition = CLI_ARG_TYPES[type_name]
value = cast(
celtypes.Value,
type_definition(value_text), # type: ignore [call-arg]
)
except KeyError:
raise argparse.ArgumentTypeError(
f"arg {text} type name not in {list(CLI_ARG_TYPES)}"
)
except ValueError:
raise argparse.ArgumentTypeError(
f"arg {text} value invalid for the supplied type"
)
else:
value = celtypes.StringType(value_text or "")
type_definition = celtypes.StringType
return name, type_definition, value
def get_options(argv: Optional[List[str]] = None) -> argparse.Namespace:
"""Parses command-line arguments."""
parser = argparse.ArgumentParser(prog="celpy", description="Pure Python CEL")
parser.add_argument("-v", "--verbose", default=0, action="count")
# Inputs
parser.add_argument(
"-a",
"--arg",
action="append",
type=arg_type_value,
help="Variables to set; -a name:type=value, or -a name=value for strings, "
"or -a name to read an environment variable",
)
parser.add_argument(
"-n",
"--null-input",
dest="null_input",
default=False,
action="store_true",
help="Avoid reading Newline-Delimited JSON documents from stdin",
)
parser.add_argument(
"-s",
"--slurp",
default=False,
action="store_true",
help="Slurp a single, multiple JSON document from stdin",
)
parser.add_argument(
"-i",
"--interactive",
default=False,
action="store_true",
help="Interactive REPL",
)
# JSON handling
parser.add_argument(
"--json-package",
"-p",
metavar="NAME",
dest="package",
default=None,
action="store",
help="Each JSON input is a CEL package, allowing .name to work",
)
parser.add_argument(
"--json-document",
"-d",
metavar="NAME",
dest="document",
default=None,
action="store",
help="Each JSON input is a variable, allowing name.map(x, x*2) to work",
)
# Outputs and Status
parser.add_argument(
"-b",
"--boolean",
default=False,
action="store_true",
help="If the result is True, the exit status is 0, for False, it's 1, otherwise 2",
)
parser.add_argument(
"-f",
"--format",
default=None,
action="store",
help=(
"Use Python formating instead of JSON conversion of results; "
"Example '.6f' to format a DoubleType result"
),
)
# The expression
parser.add_argument("expr", nargs="?")
options = parser.parse_args(argv)
if options.package and options.document:
parser.error("Either use --json-package or --json-document, not both")
if not options.package and not options.document:
options.package = "jq"
if options.interactive and options.expr:
parser.error("Interactive mode and an expression provided")
if not options.interactive and not options.expr:
parser.error("No expression provided")
return options
def stat(path: Union[Path, str]) -> Optional[celtypes.MapType]:
"""This function is added to the CLI to permit file-system interrogation."""
try:
status = Path(path).stat()
data = {
"st_atime": celtypes.TimestampType(
datetime.datetime.fromtimestamp(status.st_atime)
),
"st_ctime": celtypes.TimestampType(
datetime.datetime.fromtimestamp(status.st_ctime)
),
"st_mtime": celtypes.TimestampType(
datetime.datetime.fromtimestamp(status.st_mtime)
),
"st_dev": celtypes.IntType(status.st_dev),
"st_ino": celtypes.IntType(status.st_ino),
"st_nlink": celtypes.IntType(status.st_nlink),
"st_size": celtypes.IntType(status.st_size),
"group_access": celtypes.BoolType(status.st_gid == os.getegid()),
"user_access": celtypes.BoolType(status.st_uid == os.geteuid()),
}
# From mode File type:
# - block, character, directory, regular, symbolic link, named pipe, socket
# One predicate should be True; we want the code for that key.
data["kind"] = celtypes.StringType(
{
predicate(status.st_mode): code
for code, predicate in [
("b", os_stat.S_ISBLK),
("c", os_stat.S_ISCHR),
("d", os_stat.S_ISDIR),
("f", os_stat.S_ISREG),
("p", os_stat.S_ISFIFO),
("l", os_stat.S_ISLNK),
("s", os_stat.S_ISSOCK),
]
}.get(True, "?")
)
# Special bits: uid, gid, sticky
data["setuid"] = celtypes.BoolType((os_stat.S_ISUID & status.st_mode) != 0)
data["setgid"] = celtypes.BoolType((os_stat.S_ISGID & status.st_mode) != 0)
data["sticky"] = celtypes.BoolType((os_stat.S_ISVTX & status.st_mode) != 0)
# permissions, limited to user-level RWX, nothing more.
data["r"] = celtypes.BoolType(os.access(path, os.R_OK))
data["w"] = celtypes.BoolType(os.access(path, os.W_OK))
data["x"] = celtypes.BoolType(os.access(path, os.X_OK))
try:
extra = {
"st_birthtime": celtypes.TimestampType(
datetime.datetime.fromtimestamp(
status.st_birthtime # type:ignore [attr-defined, unused-ignore]
)
),
"st_blksize": celtypes.IntType(status.st_blksize),
"st_blocks": celtypes.IntType(status.st_blocks),
"st_flags": celtypes.IntType(status.st_flags), # type: ignore [attr-defined, unused-ignore]
"st_rdev": celtypes.IntType(status.st_rdev),
"st_gen": celtypes.IntType(status.st_gen), # type: ignore [attr-defined, unused-ignore]
}
except AttributeError: # pragma: no cover
extra = {}
return celtypes.MapType(data | extra)
except FileNotFoundError:
return None
class CEL_REPL(cmd.Cmd):
prompt = "CEL> "
intro = "Enter an expression to have it evaluated."
logger = logging.getLogger("celpy.repl")
def cel_eval(self, text: str) -> celtypes.Value:
try:
expr = self.env.compile(text)
prgm = self.env.program(expr)
return prgm.evaluate(self.state)
except CELParseError as ex:
print(
self.env.cel_parser.error_text(ex.args[0], ex.line, ex.column),
file=sys.stderr,
)
raise
def preloop(self) -> None:
self.env = Environment()
self.state: Dict[str, celtypes.Value] = {}
def do_set(self, args: str) -> bool:
"""Set variable expression
Evaluates the expression, saves the result as the given variable in the current activation.
"""
name, space, args = args.partition(" ")
try:
value: celtypes.Value = self.cel_eval(args)
print(value)
self.state[name] = value
except Exception as ex:
self.logger.error(ex)
return False
def do_show(self, args: str) -> bool:
"""Shows all variables in the current activation."""
print(self.state)
return False
def do_quit(self, args: str) -> bool:
"""Quits from the REPL."""
return True
do_exit = do_quit
do_bye = do_quit
do_EOF = do_quit
def default(self, args: str) -> None:
"""Evaluate an expression."""
try:
value = self.cel_eval(args)
print(value)
except Exception as ex:
self.logger.error(ex)
def process_json_doc(
display: Callable[[Result], None],
prgm: Runner,
activation: Dict[str, Any],
variable: str,
document: str,
boolean_to_status: bool = False,
) -> int:
"""
Process a single JSON document. Either one line of an NDJSON stream
or the only document in slurp mode. We assign it to the variable "jq".
This variable can be the package name, allowing ``.name``) to work.
Or. It can be left as a variable, allowing ``jq`` and ``jq.map(x, x*2)`` to work.
Returns status code 0 for success, 3 for failure.
"""
try:
activation[variable] = json.loads(document, cls=CELJSONDecoder)
result_value = prgm.evaluate(activation)
display(result_value)
if boolean_to_status and isinstance(result_value, (celtypes.BoolType, bool)):
return 0 if result_value else 1
return 0
except CELEvalError as ex:
# ``jq`` KeyError problems result in ``None``.
# Other errors should, perhaps, be more visible.
logger.debug("Encountered %s on document %r", ex, document)
display(None)
return 0
except json.decoder.JSONDecodeError as ex:
logger.error("%s on document %r", ex.args[0], document)
# print(f"{ex.args[0]} in {document!r}", file=sys.stderr)
return 3
def main(argv: Optional[List[str]] = None) -> int:
"""
Given options from the command-line, execute the CEL expression.
With --null-input option, only --arg and expr matter.
Without --null-input, JSON documents are read from STDIN, following ndjson format.
With the --slurp option, it reads one JSON from stdin, spread over multiple lines.
If "--json-package" is used, each JSON document becomes a package, and
top-level dictionary keys become valid ``.name`` expressions.
Otherwise, "--json-object" is the default, and each JSON document
is assigned to a variable. The default name is "jq" to allow expressions
that are similar to ``jq`` but with a "jq" prefix.
"""
options = get_options(argv)
if options.verbose == 1:
logging.getLogger().setLevel(logging.INFO)
elif options.verbose > 1:
logging.getLogger().setLevel(logging.DEBUG)
logger.debug(options)
if options.interactive:
repl = CEL_REPL()
repl.cmdloop()
return 0
if options.format:
def output_display(result_value: Result) -> None:
print("{0:{format}}".format(result_value, format=options.format))
else:
def output_display(result_value: Result) -> None:
print(json.dumps(result_value, cls=CELJSONEncoder))
logger.info("Expr: %r", options.expr)
if options.arg:
logger.info("Args: %r", options.arg)
annotations: Optional[Dict[str, Annotation]]
if options.arg:
annotations = {name: type for name, type, value in options.arg}
else:
annotations = {}
annotations["stat"] = celtypes.FunctionType
# If we're creating a named JSON document, we don't provide a default package.
# If we're using a JSON document to populate a package, we provide the given name.
env = Environment(
package=None if options.null_input else options.package,
annotations=annotations,
)
try:
expr = env.compile(options.expr)
prgm = env.program(expr, functions={"stat": stat})
except CELParseError as ex:
print(
env.cel_parser.error_text(ex.args[0], ex.line, ex.column), file=sys.stderr
)
return 1
if options.arg:
activation = {name: value for name, type, value in options.arg}
else:
activation = {}
if options.null_input:
# Don't read stdin, evaluate with only the activation context.
try:
result_value = prgm.evaluate(activation)
if options.boolean:
if isinstance(result_value, (celtypes.BoolType, bool)):
summary = 0 if result_value else 1
else:
logger.warning(
"Expected celtypes.BoolType, got %s = %r",
type(result_value),
result_value,
)
summary = 2
else:
output_display(result_value)
summary = 0
except CELEvalError as ex:
print(
env.cel_parser.error_text(ex.args[0], ex.line, ex.column),
file=sys.stderr,
)
summary = 2
elif options.slurp:
# If slurp, one big document, part of the "jq" package in the activation context.
document = sys.stdin.read()
summary = process_json_doc(
output_display,
prgm,
activation,
options.document or options.package,
document,
options.boolean,
)
else:
# NDJSON format: each line is a JSON doc. We repackage the doc into celtypes objects.
# Each document is in the "jq" package in the activation context.
summary = 0
for document in sys.stdin:
summary = max(
summary,
process_json_doc(
output_display,
prgm,
activation,
options.document or options.package,
document,
options.boolean,
),
)
return summary
CONFIG_PATHS = (dir_path / "celpy.toml" for dir_path in (Path.cwd(), Path.home()))
DEFAULT_CONFIG_TOML = """
[logging]
version = 1
formatters.minimal.format = "%(message)s"
formatters.console.format = "%(levelname)s:%(name)s:%(message)s"
formatters.details.format = "%(levelname)s:%(name)s:%(module)s:%(lineno)d:%(message)s"
root.level = "WARNING"
root.handlers = ["console"]
[logging.handlers.console]
class = "logging.StreamHandler"
formatter = "console"
"""
if __name__ == "__main__": # pragma: no cover
config_paths = list(p for p in CONFIG_PATHS if p.exists())
config_toml = config_paths[0].read_text() if config_paths else DEFAULT_CONFIG_TOML
log_config = tomllib.loads(config_toml)
if "logging" in log_config:
logging.config.dictConfig(log_config["logging"])
exit_status = main(sys.argv[1:])
logging.shutdown()
sys.exit(exit_status)
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/evaluation.py | src/celpy/evaluation.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Evaluates CEL expressions given an AST.
There are two implementations:
- Evaluator -- interprets the AST directly.
- Transpiler -- transpiles the AST to Python, compiles the Python to create a code object, and then uses :py:func:`exec` to evaluate the code object.
The general idea is to map CEL operators to Python operators and push the
real work off to Python objects defined by the :py:mod:`celpy.celtypes` module.
CEL operator ``+`` is implemented by a ``"_+_"`` function.
We map this name to :py:func:`operator.add`.
This will then look for :py:meth:`__add__` methods in the various :py:mod:`celpy.celtypes`
types.
In order to deal gracefully with missing and incomplete data,
checked exceptions are used.
A raised exception is turned into first-class :py:class:`celpy.celtypes.Result` object.
They're not raised directly, but instead saved as part of the evaluation so that
short-circuit operators can ignore the exceptions.
This means that Python exceptions like :exc:`TypeError`, :exc:`IndexError`, and :exc:`KeyError`
are caught and transformed into :exc:`CELEvalError` objects.
The :py:class:`celpy.celtypes.Result` type hint is a union of the various values that are encountered
during evaluation. It's a union of the :py:class:`celpy.celtypes.CELTypes` type and the
:exc:`CELEvalError` exception.
.. important:: Debugging
If the OS environment variable :envvar:`CEL_TRACE` is set, then detailed tracing of methods is made available.
To see the trace, set the logging level for ``celpy.Evaluator`` to ``logging.DEBUG``.
"""
import collections
import logging
import operator
import os
import re
import sys
from functools import reduce, wraps
from string import Template
from textwrap import dedent
from typing import (
Any,
Callable,
Dict,
Iterable,
Iterator,
List,
Mapping,
Match,
Optional,
Sequence,
Sized,
Tuple,
Type,
TypeVar,
Union,
cast,
)
import lark
import lark.visitors
import re2
import celpy.celtypes
from celpy.celparser import tree_dump
# An Annotation describes a union of types, functions, and function types.
Annotation = Union[
celpy.celtypes.TypeType,
Callable[
..., celpy.celtypes.Value
], # Conversion functions and protobuf message type
Type[celpy.celtypes.FunctionType], # Concrete class for annotations
]
logger = logging.getLogger(f"celpy.{__name__}")
class CELSyntaxError(Exception):
"""CEL Syntax error -- the AST did not have the expected structure."""
def __init__(
self, arg: Any, line: Optional[int] = None, column: Optional[int] = None
) -> None:
super().__init__(arg)
self.line = line
self.column = column
class CELUnsupportedError(Exception):
"""Feature unsupported by this implementation of CEL."""
def __init__(self, arg: Any, line: int, column: int) -> None:
super().__init__(arg)
self.line = line
self.column = column
class CELEvalError(Exception):
"""CEL evaluation problem. This can be saved as a temporary value for later use.
This is politely ignored by logic operators to provide commutative short-circuit.
We provide operator-like special methods so an instance of an error
returns itself when operated on.
"""
def __init__(
self,
*args: Any,
tree: Optional[lark.Tree] = None,
token: Optional[lark.Token] = None,
) -> None:
super().__init__(*args)
self.tree = tree
self.token = token
self.line: Optional[int] = None
self.column: Optional[int] = None
if self.tree:
self.line = self.tree.meta.line
self.column = self.tree.meta.column
if self.token:
self.line = self.token.line
self.column = self.token.column
def __repr__(self) -> str:
cls = self.__class__.__name__
if self.tree and self.token:
# This is rare
return f"{cls}(*{self.args}, tree={tree_dump(self.tree)!r}, token={self.token!r})" # pragma: no cover
elif self.tree:
return f"{cls}(*{self.args}, tree={tree_dump(self.tree)!r})" # pragma: no cover
else:
# Some unit tests do not provide a mock tree.
return f"{cls}(*{self.args})" # pragma: no cover
def with_traceback(self, tb: Any) -> "CELEvalError":
return super().with_traceback(tb)
def __neg__(self) -> "CELEvalError":
return self
def __add__(self, other: Any) -> "CELEvalError":
return self
def __sub__(self, other: Any) -> "CELEvalError":
return self
def __mul__(self, other: Any) -> "CELEvalError":
return self
def __truediv__(self, other: Any) -> "CELEvalError":
return self
def __floordiv__(self, other: Any) -> "CELEvalError":
return self
def __mod__(self, other: Any) -> "CELEvalError":
return self
def __pow__(self, other: Any) -> "CELEvalError":
return self
def __radd__(self, other: Any) -> "CELEvalError":
return self
def __rsub__(self, other: Any) -> "CELEvalError":
return self
def __rmul__(self, other: Any) -> "CELEvalError":
return self
def __rtruediv__(self, other: Any) -> "CELEvalError":
return self
def __rfloordiv__(self, other: Any) -> "CELEvalError":
return self
def __rmod__(self, other: Any) -> "CELEvalError":
return self
def __rpow__(self, other: Any) -> "CELEvalError":
return self
def __eq__(self, other: Any) -> bool:
if isinstance(other, CELEvalError):
return self.args == other.args
return NotImplemented
def __call__(self, *args: Any) -> "CELEvalError":
return self
# The interim results extend ``celtypes`` to include intermediate ``CELEvalError`` exception objects.
# These can be deferred as part of commutative logical_and and logical_or operations.
# It includes the responses to ``type()`` queries, also.
Result = Union[
celpy.celtypes.Value,
CELEvalError,
celpy.celtypes.CELType,
]
# The various functions that apply to CEL data.
# The evaluator's functions expand on the CELTypes to include CELEvalError and the
# celpy.celtypes.CELType union type, also.
CELFunction = Callable[..., Result]
# A combination of a CELType result or a function resulting from identifier evaluation.
Result_Function = Union[
Result,
CELFunction,
]
Exception_Filter = Union[Type[BaseException], Sequence[Type[BaseException]]]
TargetFunc = TypeVar("TargetFunc", bound=CELFunction)
def eval_error(
new_text: str, exc_class: Exception_Filter
) -> Callable[[TargetFunc], TargetFunc]:
"""
Wrap a function to transform native Python exceptions to CEL CELEvalError values.
Any exception of the given class is replaced with the new CELEvalError object.
:param new_text: Text of the exception, e.g., "divide by zero", "no such overload",
this is the return value if the :exc:`CELEvalError` becomes the result.
:param exc_class: A Python exception class to match, e.g. ZeroDivisionError,
or a sequence of exception classes (e.g. (ZeroDivisionError, ValueError))
:return: A decorator that can be applied to a function
to map Python exceptions to :exc:`CELEvalError` instances.
This is used in the ``all()`` and ``exists()`` macros to silently ignore TypeError exceptions.
"""
def concrete_decorator(function: TargetFunc) -> TargetFunc:
@wraps(function)
def new_function(
*args: celpy.celtypes.Value, **kwargs: celpy.celtypes.Value
) -> Result:
try:
return function(*args, **kwargs)
except exc_class as ex: # type: ignore[misc]
logger.debug(
"%s(*%s, **%s) --> %s", function.__name__, args, kwargs, ex
)
_, _, tb = sys.exc_info()
value = CELEvalError(new_text, ex.__class__, ex.args).with_traceback(tb)
value.__cause__ = ex
return value
except Exception:
logger.error("%s(*%s, **%s)", function.__name__, args, kwargs)
raise
return cast(TargetFunc, new_function)
return concrete_decorator
def boolean(
function: Callable[..., celpy.celtypes.Value],
) -> Callable[..., celpy.celtypes.BoolType]:
"""
Wraps operators to create CEL BoolType results.
:param function: One of the operator.lt, operator.gt, etc. comparison functions
:return: Decorated function with type coercion.
"""
@wraps(function)
def bool_function(
a: celpy.celtypes.Value, b: celpy.celtypes.Value
) -> celpy.celtypes.BoolType:
if isinstance(a, CELEvalError):
return a
if isinstance(b, CELEvalError):
return b
result_value = function(a, b)
if result_value == NotImplemented:
return cast(celpy.celtypes.BoolType, result_value)
return celpy.celtypes.BoolType(bool(result_value))
return bool_function
def operator_in(item: Result, container: Result) -> Result:
"""
CEL contains test; ignores type errors.
During evaluation of ``'elem' in [1, 'elem', 2]``,
CEL will raise internal exceptions for ``'elem' == 1`` and ``'elem' == 2``.
The :exc:`TypeError` exceptions are gracefully ignored.
During evaluation of ``'elem' in [1u, 'str', 2, b'bytes']``, however,
CEL will raise internal exceptions every step of the way, and an exception
value is the final result. (Not ``False`` from the one non-exceptional comparison.)
It would be nice to make use of the following::
eq_test = eval_error("no such overload", TypeError)(lambda x, y: x == y)
It seems like ``next(iter(filter(lambda x: eq_test(c, x) for c in container))))``
would do it. But. It's not quite right for the job.
There need to be three results, something :py:func:`filter` doesn't handle.
These are the choices:
- True. There was a item found. Exceptions may or may not have been found.
- False. No item found AND no exceptions.
- CELEvalError. Either:
- No item found AND at least one exception or
- The input item or container itself was already an error
To an extent this is a little like the ``exists()`` macro.
We can think of ``container.contains(item)`` as ``container.exists(r, r == item)``.
However, exists() tends to silence exceptions, where this can expose them.
.. todo:: This may be better done as
``reduce(logical_or, (item == c for c in container), BoolType(False))``
"""
if isinstance(item, CELEvalError):
return item
if isinstance(container, CELEvalError):
return container
result_value: Result = celpy.celtypes.BoolType(False)
for c in cast(Iterable[Result], container):
try:
if c == item:
return celpy.celtypes.BoolType(True)
except TypeError as ex:
logger.debug("operator_in(%s, %s) --> %s", item, container, ex)
result_value = CELEvalError("no such overload", ex.__class__, ex.args)
logger.debug("operator_in(%r, %r) = %r", item, container, result_value)
return result_value
def function_size(container: Result) -> Result:
"""
The size() function applied to a Value.
This is delegated to Python's :py:func:`len`.
size(string) -> int string length
size(bytes) -> int bytes length
size(list(A)) -> int list size
size(map(A, B)) -> int map size
For other types, this will raise a Python :exc:`TypeError`.
(This is captured and becomes an :exc:`CELEvalError` Result.)
.. todo:: check container type for celpy.celtypes.StringType, celpy.celtypes.BytesType,
celpy.celtypes.ListType and celpy.celtypes.MapType
"""
if container is None:
return celpy.celtypes.IntType(0)
sized_container = cast(Sized, container)
result_value = celpy.celtypes.IntType(len(sized_container))
logger.debug("function_size(%r) = %r", container, result_value)
return result_value
def function_contains(
container: Union[
celpy.celtypes.ListType, celpy.celtypes.MapType, celpy.celtypes.StringType
],
item: Result,
) -> Result:
"""
The contains() function applied to a Container and a Value.
THis is delegated to the `contains` method of a class.
"""
return celpy.celtypes.BoolType(container.contains(cast(celpy.celtypes.Value, item)))
def function_startsWith(
string: celpy.celtypes.StringType, fragment: celpy.celtypes.StringType
) -> Result:
return celpy.celtypes.BoolType(string.startswith(fragment))
def function_endsWith(
string: celpy.celtypes.StringType, fragment: celpy.celtypes.StringType
) -> Result:
return celpy.celtypes.BoolType(string.endswith(fragment))
def function_matches(text: str, pattern: str) -> Result:
"""Implementation of the ``match()`` function using ``re2``"""
try:
m = re2.search(pattern, text)
except re2.error as ex:
return CELEvalError("match error", ex.__class__, ex.args)
return celpy.celtypes.BoolType(m is not None)
def function_getDate(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getDate(tz_name))
def function_getDayOfMonth(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getDayOfMonth(tz_name))
def function_getDayOfWeek(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getDayOfWeek(tz_name))
def function_getDayOfYear(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getDayOfYear(tz_name))
def function_getFullYear(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getFullYear(tz_name))
def function_getMonth(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getMonth(tz_name))
def function_getHours(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getHours(tz_name))
def function_getMilliseconds(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getMilliseconds(tz_name))
def function_getMinutes(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getMinutes(tz_name))
def function_getSeconds(
ts: celpy.celtypes.TimestampType,
tz_name: Optional[celpy.celtypes.StringType] = None,
) -> Result:
return celpy.celtypes.IntType(ts.getSeconds(tz_name))
def bool_lt(a: Result, b: Result) -> Result:
return boolean(operator.lt)(a, b)
def bool_le(a: Result, b: Result) -> Result:
return boolean(operator.le)(a, b)
def bool_gt(a: Result, b: Result) -> Result:
return boolean(operator.gt)(a, b)
def bool_ge(a: Result, b: Result) -> Result:
return boolean(operator.ge)(a, b)
def bool_eq(a: Result, b: Result) -> Result:
return boolean(operator.eq)(a, b)
def bool_ne(a: Result, b: Result) -> Result:
return boolean(operator.ne)(a, b)
# User-defined functions can override items in this mapping.
base_functions: dict[str, CELFunction] = {
"!_": celpy.celtypes.logical_not,
"-_": operator.neg,
"_+_": operator.add,
"_-_": operator.sub,
"_*_": operator.mul,
"_/_": operator.truediv,
"_%_": operator.mod,
"_<_": bool_lt,
"_<=_": bool_le,
"_>_": bool_gt,
"_>=_": bool_ge,
"_==_": bool_eq,
"_!=_": bool_ne,
"_in_": operator_in,
"_||_": celpy.celtypes.logical_or,
"_&&_": celpy.celtypes.logical_and,
"_?_:_": celpy.celtypes.logical_condition,
"_[_]": operator.getitem,
# The "methods" are actually named functions that can be overridden.
# The function version delegates to class methods.
# Yes, it's a bunch of indirection, but it permits simple overrides.
# A number of types support "size" and "contains": StringType, MapType, ListType
# This is generally made available via the _in_ operator.
"size": function_size,
"contains": function_contains,
# Universally available
"type": celpy.celtypes.TypeType,
# StringType methods, used by :py:meth:`Evaluator.method_eval`
"endsWith": function_endsWith,
"startsWith": function_startsWith,
"matches": function_matches,
# TimestampType methods. Type details are redundant, but required because of the lambdas
"getDate": function_getDate,
"getDayOfMonth": function_getDayOfMonth,
"getDayOfWeek": function_getDayOfWeek,
"getDayOfYear": function_getDayOfYear,
"getFullYear": function_getFullYear,
"getMonth": function_getMonth,
# TimestampType and DurationType methods
"getHours": function_getHours,
"getMilliseconds": function_getMilliseconds,
"getMinutes": function_getMinutes,
"getSeconds": function_getSeconds,
# type conversion functions
"bool": celpy.celtypes.BoolType,
"bytes": celpy.celtypes.BytesType,
"double": celpy.celtypes.DoubleType,
"duration": celpy.celtypes.DurationType,
"int": celpy.celtypes.IntType,
"list": celpy.celtypes.ListType, # https://github.com/google/cel-spec/issues/123
"map": celpy.celtypes.MapType,
"null_type": type(None),
"string": celpy.celtypes.StringType,
"timestamp": celpy.celtypes.TimestampType,
"uint": celpy.celtypes.UintType,
}
class Referent:
"""
A Name can refer to any of the following things:
- ``Annotation`` -- initially most names are these.
Must be provided as part of the initialization.
- ``CELFunction`` -- a Python function to implement a CEL function or method.
Must be provided as part of the initialization.
The type conversion functions are names in a ``NameContainer``.
- ``NameContainer`` -- some names are these.
This is true when the name is *not* provided as part of the initialization because
we discovered the name during type or environment binding.
- ``celpy.celtypes.Value`` -- many annotations also have values.
These are provided **after** Annotations, and require them.
- ``CELEvalError`` -- This seems unlikely, but we include it because it's possible.
A name can be ambiguous and refer to a nested ``NameContainer`` as well
as a ``celpy.celtypes.Value`` (usually a ``MapType`` instance.)
Object ``b`` has two possible meanings:
- ``b`` is a ``NameContainer`` with ``c``, a string or some other object.
- ``b`` is a ``MapType`` or ``MessageType``, and ``b.c`` is syntax sugar for ``b['c']``.
The "longest name" rule means that the useful value is the "c" object
in the nested ``NameContainer``.
The syntax sugar interpretation is done in the rare case we can't find the ``NameContainer``.
>>> nc = NameContainer("c", celpy.celtypes.StringType)
>>> b = Referent(celpy.celtypes.MapType)
>>> b.value = celpy.celtypes.MapType({"c": "oops"})
>>> b.value == celpy.celtypes.MapType({"c": "oops"})
True
>>> b.container = nc
>>> b.value == nc
True
.. note:: Future Design
A ``Referent`` is (almost) a ``tuple[Annotation, NameContainer | None, Value | NotSetSentinel]``.
The current implementation is stateful, because values are optional and may be added later.
The use of a special sentinel to indicate the value was not set is a little akward.
It's not really a 3-tuple, because NameContainers don't have values; they are a kind of value.
(``None`` is a valid value, and can't be used for this.)
It may be slightly simpler to use a union of two types:
``tuple[Annotation] | tuple[Annotation, NameContainer | Value]``.
One-tuples capture the Annotation for a name; two-tuples capture Annotation and Value (or subsidiary NameContainer).
"""
def __init__(
self,
ref_to: Optional[Annotation] = None,
# TODO: Add value here, also, as a handy short-cut to avoid the value setter.
) -> None:
self.annotation: Optional[Annotation] = None
self.container: Optional["NameContainer"] = None
self._value: Union[
None,
Annotation,
celpy.celtypes.Value,
CELEvalError,
CELFunction,
"NameContainer",
] = None
self._value_set = False # Should NOT be private.
if ref_to:
self.annotation = ref_to
def __repr__(self) -> str:
return (
f"{self.__class__.__name__}(annotation={self.annotation!r}, "
f"container={self.container!r}, "
f"_value={self._value!r})"
)
def __eq__(self, other: Any) -> bool:
# TODO: When minimum version >= 3.10, use match statement
if isinstance(other, type(self)):
same = (
self.annotation == other.annotation
and self.container == other.container
and self._value_set == other._value_set
and (self._value == other._value if self._value_set else True)
)
return same
return NotImplemented # pragma: no cover
@property
def value(
self,
) -> Union[
Annotation, celpy.celtypes.Value, CELEvalError, CELFunction, "NameContainer"
]:
"""
The longest-path rule means we prefer ``NameContainer`` over any locally defined value.
Otherwise, we'll provide a value if there is one.
Finally, we'll provide the annotation if there's no value.
:return:
"""
if self.container is not None:
return self.container
elif self._value_set:
return self._value
else:
# Not part of a namespace path. Nor was a value set.
return self.annotation
@value.setter
def value(
self,
ref_to: Union[
Annotation, celpy.celtypes.Value, CELEvalError, CELFunction, "NameContainer"
],
) -> None:
self._value = ref_to
self._value_set = True
def clone(self) -> "Referent":
new = Referent(self.annotation)
new.container = self.container
new._value = self._value
new._value_set = self._value_set
return new
# A name resolution context is a mapping from an identifier to a Value or a ``NameContainer``.
# This reflects some murkiness in the name resolution algorithm that needs to be cleaned up.
Context = Mapping[str, Union[Result, "NameContainer", "CELFunction"]]
# Copied from cel.lark
IDENT = r"[_a-zA-Z][_a-zA-Z0-9]*"
class NameContainer(Dict[str, Referent]):
"""
A namespace that fulfills the CEL name resolution requirement.
::
Scenario: "qualified_identifier_resolution_unchecked"
"namespace resolution should try to find the longest prefix for the evaluator."
NameContainer instances can be chained (via parent) to create a sequence of searchable
locations for a name.
- Local-most is an Activation with local variables within a macro.
These are part of a nested chain of Activations for each macro. Each local activation
is a child with a reference to the parent Activation.
- Parent of any local Activation is the overall Activation for this CEL evaluation.
The overall Activation contains a number of NameContainers:
- The global variable bindings.
- Bindings of function definitions. This is the default set of functions for CEL
plus any add-on functions introduced by C7N.
- The run-time annotations from the environment. There are two kinds:
- Protobuf message definitions. These are types, really.
- Annotations for global variables. The annotations tend to be hidden by the values.
They're in the lookup chain to simplify access to protobuf messages.
- The environment also provides the built-in type names and aliases for the
:mod:`celtypes` package of built-in types.
This means name resolution marches from local-most to remote-most, searching for a binding.
The global variable bindings have a local-most value and a more remote annotation.
The annotations (i.e. protobuf message types) have only a fairly remote annotation without
a value.
.. rubric:: Structure
A ``NameContainer`` is a mapping from names to ``Referent`` instances.
A `Referent` can be one of several things, including...
- A NameContainer further down the path
- An Annotation
- An Annotation and a value
- A CELFunction (In effect, an Annotation of CELFunction, and a value of the function implementation.)
.. rubric:: Life and Content
There are two phases to building the chain of ``NameContainer`` instances.
1. The ``Activation`` creates the initial ``name : annotation`` bindings.
Generally, the names are type names, like "int", bound to :py:class:`celtypes.IntType`.
In some cases, the name is a future variable name, "resource",
bound to :py:class:`celtypes.MapType`.
2. The ``Activation`` updates some variables to provide values.
A name is decomposed into a path to make a tree of nested ``NameContainers``.
Upper-level containers don't (necessarily) have types or values -- they're merely
``NameContainer`` along the path to the target names.
.. rubric:: Resolving Names
See https://github.com/google/cel-spec/blob/master/doc/langdef.md#name-resolution
There are three cases required in the :py:class:`Evaluator` engine.
- Variables and Functions. These are ``Result_Function`` instances: i.e., ordinary values.
- ``Name.Name`` can be navigation into a protobuf package, when ``Name`` is protobuf package.
The idea is to locate the longest possible match.
If a.b is a name to be resolved in the context of a protobuf declaration with scope A.B,
then resolution is attempted, in order, as A.B.a.b, A.a.b, and finally a.b.
To override this behavior, one can use .a.b;
this name will only be attempted to be resolved in the root scope, i.e. as a.b.
- ``Name.Name`` can be syntactic sugar for indexing into a mapping when ``Name`` is a value of
``MapType`` or a ``MessageType``. It's evaluated as if it was ``Name["Name"]``.
This is a fall-back plan if the previous resolution failed.
The longest chain of nested packages *should* be resolved first.
This will happen when each name is a ``NameContainer`` object containing
other ``NameContainer`` objects.
The chain of evaluations for ``IDENT . IDENT . IDENT`` is (in effect)
::
member_dot(member_dot(primary(IDENT), IDENT), IDENT)
This makes the ``member_dot`` processing left associative.
The ``primary(IDENT)`` resolves to a CEL object of some kind.
Once the ``primary(IDENT)`` has been resolved, it establishes a context
for subsequent ``member_dot`` methods.
- If this is a ``MapType`` or a ``MessageType`` with an object,
then ``member_dot`` will pluck out a field value and return this.
- If this is a ``NameContainer`` or a ``PackageType`` then the ``member_dot``
will pluck out a sub-package or ``EnumType`` or ``MessageType``
and return the type object instead of a value.
At some point a ``member_object`` production will build an object from the type.
The evaluator's :meth:`ident_value` method resolves the identifier into the ``Referent``.
.. rubric:: Acceptance Test Cases
We have two names
- `a.b` -> NameContainer in which c = "yeah". (i.e., a.b.c : "yeah")
- `a.b` -> Mapping with {"c": "oops"}.
This means any given name can have as many as three meanings:
- Primarily as a NameContainer. This resolves name.name.name to find the longest
namespace possible.
- Secondarily as a Mapping. This will be a fallback when name.name.name is really
syntactic sugar for name.name['name'].
- Finally as a type annotation.
"""
ident_pat = re.compile(IDENT)
extended_name_path = re.compile(f"^\\.?{IDENT}(?:\\.{IDENT})*$")
logger = logging.getLogger("celpy.NameContainer")
def __init__(
self,
name: Optional[str] = None,
ref_to: Optional[Referent] = None,
parent: Optional["NameContainer"] = None,
) -> None:
if name and ref_to:
super().__init__({name: ref_to})
else:
super().__init__()
self.parent: Optional[NameContainer] = parent
def load_annotations(
self,
names: Mapping[str, Annotation],
) -> None:
"""
Used by an ``Activation`` to build a container used to resolve
long path names into nested NameContainers.
Sets annotations for all supplied identifiers.
``{"name1.name2": annotation}`` becomes two things:
1. nc2 = NameContainer({"name2" : Referent(annotation)})
2. nc1 = NameContainer({"name1" : Referent(nc2)})
:param names: A dictionary of {"name1.name1....": Referent, ...} items.
"""
for name, refers_to in names.items():
# self.logger.debug("load_annotations %r : %r", name, refers_to)
if not self.extended_name_path.match(name):
raise ValueError(f"Invalid name {name}")
context = self
# Expand "name1.name2....": refers_to into ["name1", "name2", ...]: refers_to
*path, final = self.ident_pat.findall(name)
for name in path:
ref = context.setdefault(name, Referent())
if ref.container is None:
ref.container = NameContainer(parent=self.parent)
context = ref.container
context.setdefault(final, Referent(refers_to))
def load_values(self, values: Context) -> None:
"""Update any annotations with actual values."""
for name, refers_to in values.items():
# self.logger.debug("load_values %r : %r", name, refers_to)
if not self.extended_name_path.match(name):
raise ValueError(f"Invalid name {name}")
context = self
# Expand "name1.name2....": refers_to into ["name1", "name2", ...]: refers_to
# Update NameContainer("name1", NameContainer("name2", NameContainer(..., refers_to)))
*path, final = self.ident_pat.findall(name)
for name in path:
ref = context.setdefault(name, Referent())
if ref.container is None:
ref.container = NameContainer(parent=self.parent)
context = ref.container
context.setdefault(final, Referent()) # No annotation previously present.
context[final].value = refers_to
class NotFound(Exception):
"""
Raised locally when a name is not found in the middle of package search.
We can't return ``None`` from find_name because that's a valid value.
"""
pass
@staticmethod
def dict_find_name(
some_dict: Union[Dict[str, Referent], Referent], path: Sequence[str]
) -> Referent:
"""
Recursive navigation into mappings, messages, and packages.
These are not NameContainers (or Activations).
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/__init__.py | src/celpy/__init__.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
The pure Python implementation of the Common Expression Language, CEL.
This module defines an interface to CEL for integration into other Python applications.
This exposes the :py:class:`Environment` used to compile the source module,
the :py:class:`Runner` used to evaluate the compiled code,
and the :py:mod:`celpy.celtypes` module with Python types wrapped to be CEL compatible.
The way these classes are used is as follows:
.. uml::
@startuml
start
:Gather (or define) annotations;
:Create ""Environment"";
:Compile CEL;
:Create ""Runner"" with any extension functions;
:Evaluate the ""Runner"" with a ""Context"";
stop
@enduml
The explicit decomposition into steps permits
two extensions:
1. Transforming the AST to introduce any optimizations.
2. Saving the :py:class:`Runner` instance to reuse an expression with new inputs.
"""
import abc
import json # noqa: F401
import logging
import sys
from textwrap import indent
from typing import Any, Dict, Optional, Type, cast
import lark
import celpy.celtypes
from celpy.adapter import ( # noqa: F401
CELJSONDecoder,
CELJSONEncoder,
json_to_cel,
)
from celpy.celparser import CELParseError, CELParser # noqa: F401
from celpy.evaluation import ( # noqa: F401
Activation,
Annotation,
CELEvalError,
CELFunction,
Context,
Evaluator,
Result,
Transpiler,
TranspilerTree,
base_functions,
)
# A parsed AST.
Expression = lark.Tree
class Runner(abc.ABC):
"""Abstract runner for a compiled CEL program.
The :py:class:`Environment` creates :py:class:`Runner` objects to permit
saving a ready-tp-evaluate, compiled CEL expression.
A :py:class:`Runner` will evaluate the AST in the context of a specific activation
with the provided variable values.
The py:meth:`Runner.evaluate` method is used to evaluate a CEL expression with a new data context.
As an implementation detail, note that
each :py:class:`Runner` subclass definition includes
the ``tree_node_class`` attribute.
This attribute defines the type for Tree nodes that must be created by the :py:mod:`lark` parser.
This class information provided to the :py:class:`Environment` to tailor the :py:mod:`lark` parser.
The class named often includes specialized AST features
needed by the :py:class:`Runner` subclss.
.. todo:: For a better fit with Go language expectations
Consider adding type adapter and type provider registries.
This would permit distinct sources of protobuf message types.
"""
tree_node_class: type = lark.Tree
def __init__(
self,
environment: "Environment",
ast: lark.Tree,
functions: Optional[Dict[str, CELFunction]] = None,
) -> None:
"""
Initialize this ``Runner`` with a given AST.
The Runner will have annotations take from the :py:class:`Environment`,
plus any unique functions defined here.
"""
self.logger = logging.getLogger(f"celpy.{self.__class__.__name__}")
self.environment = environment
self.ast = ast
self.functions = functions
def __repr__(self) -> str:
return f"{self.__class__.__name__}({self.environment}, {self.ast}, {self.functions})"
def new_activation(self) -> Activation:
"""
Builds a new, working :py:class:`Activation` using the :py:class:`Environment` as defaults.
A Context will later be layered onto this for evaluation.
This is used internally during evaluation.
"""
base_activation = Activation(
package=self.environment.package,
annotations=self.environment.annotations,
functions=self.functions,
)
return base_activation
@abc.abstractmethod
def evaluate(self, activation: Context) -> celpy.celtypes.Value: # pragma: no cover
"""
Given variable definitions in the :py:class:`celpy.evaluation.Context`, evaluate the given AST and return the resulting value.
Generally, this should raise an :exc:`celpy.evaluation.CELEvalError` for most kinds of ordinary problems.
It may raise an :exc:`celpy.evaluation.CELUnsupportedError` for future features that aren't fully implemented.
Any Python exception reflects a serious problem.
:param activation: a :py:class:`celpy.evaluation.Context` object with variable values to use for this evaluation.
:returns: the computed value
:raises: :exc:`celpy.evaluation.CELEvalError` or :exc:`celpy.evaluation.CELUnsupportedError` for problems encounterd.
"""
...
class InterpretedRunner(Runner):
"""
An **Adapter** for the :py:class:`celpy.evaluation.Evaluator` class.
"""
def evaluate(self, context: Context) -> celpy.celtypes.Value:
e = Evaluator(
ast=self.ast,
activation=self.new_activation(),
)
value = e.evaluate(context)
return value
class CompiledRunner(Runner):
"""
An **Adapter** for the :py:class:`celpy.evaluation.Transpiler` class.
A :py:class:`celpy.evaluation.Transpiler` instance transforms the AST into Python.
It uses :py:func:`compile` to create a code object.
The final :py:meth:`evaluate` method uses :py:func:`exec` to evaluate the code object.
Note, this requires the ``celpy.evaluation.TranspilerTree`` classes
instead of the default ``lark.Tree`` class.
"""
tree_node_class: type = TranspilerTree
def __init__(
self,
environment: "Environment",
ast: TranspilerTree,
functions: Optional[Dict[str, CELFunction]] = None,
) -> None:
"""
Transpile to Python, and use :py:func:`compile` to create a code object.
"""
super().__init__(environment, ast, functions)
self.tp = Transpiler(
ast=cast(TranspilerTree, self.ast),
activation=self.new_activation(),
)
self.tp.transpile()
self.logger.info("Transpiled:\n%s", indent(self.tp.source_text, " "))
def evaluate(self, context: Context) -> celpy.celtypes.Value:
"""
Use :py:func:`exec` to execute the code object.
"""
value = self.tp.evaluate(context)
return value
# TODO: Refactor this class into a separate "cel_protobuf" module.
# TODO: Rename this type to ``cel_protobuf.Int32Value``
class Int32Value(celpy.celtypes.IntType):
"""A wrapper for int32 values."""
def __new__(
cls: Type["Int32Value"],
value: Any = 0,
) -> "Int32Value":
"""TODO: Check range. This seems to matter for protobuf."""
if isinstance(value, celpy.celtypes.IntType):
return cast(Int32Value, super().__new__(cls, value))
# TODO: elif other type conversions...
else:
convert = celpy.celtypes.int64(int)
return cast(Int32Value, super().__new__(cls, convert(value)))
# The "well-known" types in a ``google.protobuf`` package.
# We map these to CEL types instead of defining additional Protobuf Types.
# This approach bypasses some of the range constraints that are part of these types.
# It may also cause values to compare as equal when they were originally distinct types.
googleapis = {
"google.protobuf.Int32Value": celpy.celtypes.IntType,
"google.protobuf.UInt32Value": celpy.celtypes.UintType,
"google.protobuf.Int64Value": celpy.celtypes.IntType,
"google.protobuf.UInt64Value": celpy.celtypes.UintType,
"google.protobuf.FloatValue": celpy.celtypes.DoubleType,
"google.protobuf.DoubleValue": celpy.celtypes.DoubleType,
"google.protobuf.BoolValue": celpy.celtypes.BoolType,
"google.protobuf.BytesValue": celpy.celtypes.BytesType,
"google.protobuf.StringValue": celpy.celtypes.StringType,
"google.protobuf.ListValue": celpy.celtypes.ListType,
"google.protobuf.Struct": celpy.celtypes.MessageType,
}
class Environment:
"""
Contains the current evaluation context.
CEL integration starts by creating an :py:class:`Environment` object.
This can be initialized with three optional values:
- A package name used to resolve variable names.
This is not generally required, but is sometimes helpful to provide an explicit namespace for variables.
- Type annotations for variables.
This helps perform type conversions on external data.
- The class of runner to use. By default an :py:class:`InterpretedRunner` is used.
The alternative is the :py:class:`CompiledRunner`.
Detailed performance benchmarks are still pending.
Detailed logging is available from the interpreted runner, to help debug external function bindings.
Once the environment has been created, the :py:meth:`Environment.compile` method
compiles CEL text to create an AST.
This can be helpful for an application that needs to prepare error messages based on the AST.
An application can also optimize or transform the AST.
The :py:meth:`Environment.program` method
packages the AST into a :py:class:`Runnable` ready for evaluation.
At this time, external functions are bound to the CEL expression.
The :py:class:`Runnable` can be evaluated repeatedly with multiple inputs, avoiding the overheads of compiling for each input value.
.. todo:: For a better fit with Go language expectations
- A type adapters registry makes other native types available for CEL.
- A type providers registry make ProtoBuf types available for CEL.
"""
def __init__(
self,
package: Optional[str] = None,
annotations: Optional[Dict[str, Annotation]] = None,
runner_class: Optional[Type[Runner]] = None,
) -> None:
"""
Create a new environment.
This also increases the default recursion limit to handle the defined minimums for CEL.
:param package: An optional package name used to resolve names in an Activation
:param annotations: Names with type annotations.
There are two flavors of names provided here.
- Variable names based on :py:mod:``celtypes``
- Function names, using ``typing.Callable``.
:param runner_class: the class of Runner to use, either InterpretedRunner or CompiledRunner
"""
sys.setrecursionlimit(2500)
self.logger = logging.getLogger(f"celpy.{self.__class__.__name__}")
self.package: Optional[str] = package
self.annotations: Dict[str, Annotation] = annotations or {}
self.logger.debug("Type Annotations %r", self.annotations)
self.runner_class: Type[Runner] = runner_class or InterpretedRunner
self.cel_parser = CELParser(tree_class=self.runner_class.tree_node_class)
self.runnable: Runner
# Fold in standard annotations. These (generally) define well-known protobuf types.
self.annotations.update(googleapis)
# We'd like to add 'type.googleapis.com/google' directly, but it seems to be an alias
# for 'google', the path after the '/' in the uri.
def __repr__(self) -> str:
return f"{self.__class__.__name__}({self.package}, {self.annotations}, {self.runner_class})"
def compile(self, text: str) -> Expression:
"""
Compiles the CEL source.
Processing starts here by building an AST structure from the CEL text.
The AST is exposed for the rare case where an application needs to transform it or analyze it.
Generally, it's best to treat the AST object as opaque, and provide it to the :py:meth:`program` method.
This can raise syntax error exceptions.
The exceptions contain line and character position information to help create easy-to-use error outputs.
:param text: The CEL text to evaluate.
:returns: A :py:class:`lark.Tree` object describing the CEL expression.
:raises: :py:class:`celpy.celparser.CELParseError` exceptions for syntax errors.
"""
ast = self.cel_parser.parse(text)
return ast
def program(
self, expr: lark.Tree, functions: Optional[Dict[str, CELFunction]] = None
) -> Runner:
"""
Transforms the AST into an executable :py:class:`Runner` object.
This will bind the given functions into the runnable object.
The resulting object has a :py:meth:`Runner.evaluate` method that applies the CEL structure to input data to compute the final result.
:param expr: The parse tree from :py:meth:`compile`.
:param functions: Any additional functions to be used by this CEL expression.
:returns: A :py:class:`Runner` instance that can be evaluated with a ``Context`` that provides values.
"""
self.logger.debug("Package %r", self.package)
runner_class = self.runner_class
self.runnable = runner_class(self, expr, functions)
self.logger.debug("Runnable %r", self.runnable)
return self.runnable
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/c7nlib.py | src/celpy/c7nlib.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Functions for C7N features when evaluating CEL expressions.
These functions provide a mapping between C7N features and CEL.
These functions are exposed by the global ``FUNCTIONS`` dictionary that is provided
to the CEL evaluation run-time to provide necessary C7N features.
The functions rely on implementation details in the ``CELFilter`` class.
The API
=======
A C7N implementation can use CEL expressions and the :py:mod:`c7nlib` module as follows::
class CELFilter(c7n.filters.core.Filter):
decls = {
"resource": celpy.celtypes.MapType,
"now": celpy.celtypes.TimestampType,
"event": celpy.celtypes.MapType,
}
decls.update(celpy.c7nlib.DECLARATIONS)
def __init__(self, expr: str) -> None:
self.expr = expr
def validate(self) -> None:
cel_env = celpy.Environment(
annotations=self.decls,
runner_class=c7nlib.C7N_Interpreted_Runner)
cel_ast = cel_env.compile(self.expr)
self.pgm = cel_env.program(cel_ast, functions=celpy.c7nlib.FUNCTIONS)
def process(self,
resources: Iterable[celpy.celtypes.MapType]) -> Iterator[celpy.celtypes.MapType]:
now = datetime.datetime.utcnow()
for resource in resources:
with C7NContext(filter=the_filter):
cel_activation = {
"resource": celpy.json_to_cel(resource),
"now": celpy.celtypes.TimestampType(now),
}
if self.pgm.evaluate(cel_activation):
yield resource
The :py:mod:`celpy.c7nlib` library of functions is bound into the CEL :py:class:`celpy.__init__.Runner` object that's built from the AST.
Several variables will be required in the :py:class:`celpy.evaluation.Activation` for use by most CEL expressions
that implement C7N filters:
:resource:
A JSON document describing a cloud resource.
:now:
The current timestamp.
:event:
May be needed; it should be a JSON document describing an AWS CloudWatch event.
The type: value Features
========================
The core value features of C7N require a number of CEL extensions.
- :func:`glob(string, pattern)` uses Python fnmatch rules. This implements ``op: glob``.
- :func:`difference(list, list)` creates intermediate sets and computes the difference
as a boolean value. Any difference is True. This implements ``op: difference``.
- :func:`intersect(list, list)` creats intermediate sets and computes the intersection
as a boolean value. Any interection is True. This implements ``op: intersect``.
- :func:`normalize(string)` supports normalized comparison between strings.
In this case, it means lower cased and trimmed. This implements ``value_type: normalize``.
- :func:`net.cidr_contains` checks to see if a given CIDR block contains a specific
address. See https://www.openpolicyagent.org/docs/latest/policy-reference/#net.
- :func:`net.cidr_size` extracts the prefix length of a parsed CIDR block.
- :func:`version` uses ``disutils.version.LooseVersion`` to compare version strings.
- :func:`resource_count` function. This is TBD.
The type: value_from features
==============================
This relies on ``value_from()`` and ``jmes_path_map()`` functions
In context, it looks like this::
value_from("s3://c7n-resources/exemptions.json", "json")
.jmes_path_map('exemptions.ec2.rehydration.["IamInstanceProfile.Arn"][].*[].*[]')
.contains(resource["IamInstanceProfile"]["Arn"])
The ``value_from()`` function reads values from a given URI.
- A full URI for an S3 bucket.
- A full URI for a server that supports HTTPS GET requests.
If a format is given, this is used, otherwise it's based on the
suffix of the path.
The ``jmes_path_map()`` function compiles and applies a JMESPath
expression against each item in the collection to create a
new collection. To an extent, this repeats functionality
from the ``map()`` macro.
Additional Functions
====================
A number of C7N subclasses of ``Filter`` provide additional features. There are
at least 70-odd functions that are expressed or implied by these filters.
Because the CEL expressions are always part of a ``CELFilter``, all of these
additional C7N features need to be transformed into "mixins" that are implemented
in two places. The function is part of the legacy subclass of ``Filter``,
and the function is also part of ``CELFilter``.
::
class InstanceImageMixin:
# from :py:class:`InstanceImageBase` refactoring
def get_instance_image(self):
pass
class RelatedResourceMixin:
# from :py:class:`RelatedResourceFilter` mixin
def get_related_ids(self):
pass
def get_related(self):
pass
class CredentialReportMixin:
# from :py:class:`c7n.resources.iam.CredentialReport` filter.
def get_credential_report(self):
pass
class ResourceKmsKeyAliasMixin:
# from :py:class:`c7n.resources.kms.ResourceKmsKeyAlias`
def get_matching_aliases(self, resource):
pass
class CrossAccountAccessMixin:
# from :py:class:`c7n.filters.iamaccessfilter.CrossAccountAccessFilter`
def get_accounts(self, resource):
pass
def get_vpcs(self, resource):
pass
def get_vpces(self, resource):
pass
def get_orgids(self, resource):
pass
# from :py:class:`c7n.resources.secretsmanager.CrossAccountAccessFilter`
def get_resource_policy(self, resource):
pass
class SNSCrossAccountMixin:
# from :py:class:`c7n.resources.sns.SNSCrossAccount`
def get_endpoints(self, resource):
pass
def get_protocols(self, resource):
pass
class ImagesUnusedMixin:
# from :py:class:`c7n.resources.ami.ImageUnusedFilter`
def _pull_ec2_images(self, resource):
pass
def _pull_asg_images(self, resource):
pass
class SnapshotUnusedMixin:
# from :py:class:`c7n.resources.ebs.SnapshotUnusedFilter`
def _pull_asg_snapshots(self, resource):
pass
def _pull_ami_snapshots(self, resource):
pass
class IamRoleUsageMixin:
# from :py:class:`c7n.resources.iam.IamRoleUsage`
def service_role_usage(self, resource):
pass
def instance_profile_usage(self, resource):
pass
class SGUsageMixin:
# from :py:class:`c7n.resources.vpc.SGUsage`
def scan_groups(self, resource):
pass
class IsShieldProtectedMixin:
# from :py:mod:`c7n.resources.shield`
def get_type_protections(self, resource):
pass
class ShieldEnabledMixin:
# from :py:class:`c7n.resources.account.ShieldEnabled`
def account_shield_subscriptions(self, resource):
pass
class CELFilter(
InstanceImageMixin, RelatedResourceMixin, CredentialReportMixin,
ResourceKmsKeyAliasMixin, CrossAccountAccessMixin, SNSCrossAccountMixin,
ImagesUnusedMixin, SnapshotUnusedMixin, IamRoleUsageMixin, SGUsageMixin,
Filter,
):
'''Container for functions used by c7nlib to expose data to CEL'''
def __init__(self, data, manager) -> None:
super().__init__(data, manager)
assert data["type"].lower() == "cel"
self.expr = data["expr"]
self.parser = c7n.filters.offhours.ScheduleParser()
def validate(self):
pass # See above example
def process(self, resources):
pass # See above example
This is not the complete list. See the ``tests/test_c7nlib.py`` for the ``celfilter_instance``
fixture which contains **all** of the functions required.
C7N Context Object
==================
A number of the functions require access to C7N features that are not simply part
of the resource being filtered. There are two alternative ways to handle this dependency:
- A global C7N context object that has the current ``CELFilter`` providing
access to C7N internals.
- A ``C7N`` argument to the functions that need C7N access.
This would be provided in the activation context for CEL.
To keep the library functions looking simple, the module global ``C7N`` is used.
This avoids introducing a non-CEL parameter to the :py:mod:`celpy.c7nlib` functions.
The ``C7N`` context object contains the following attributes:
:filter:
The original C7N ``Filter`` object. This provides access to the
resource manager. It can be used to manage supplemental
queries using C7N caches and other resource management.
This is set by the :py:class:`C7NContext` prior to CEL evaluation.
Name Resolution
===============
Note that names are **not** resolved via a lookup in the program object,
an instance of the :py:class:`celpy.Runner` class. To keep these functions
simple, the runner is not part of the run-time, and name resolution
will appear to be "hard-wrired" among these functions.
This is rarely an issue, since most of these functions are independent.
The :func:`value_from` function relies on :func:`text_from` and :func:`parse_text`.
Changing either of these functions with an override won't modify the behavior
of :func:`value_from`.
"""
import csv
import fnmatch
import io
import ipaddress
import json
import logging
import os.path
import sys
import urllib.request
import zlib
from contextlib import closing
from packaging.version import Version
from types import TracebackType
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, Union, cast
from pendulum import parse as parse_date
import jmespath # type: ignore [import-untyped]
from celpy import InterpretedRunner, celtypes
from celpy.adapter import json_to_cel
from celpy.evaluation import Annotation, Context, Evaluator
logger = logging.getLogger(f"celpy.{__name__}")
class C7NContext:
"""
Saves current C7N filter for use by functions in this module.
This is essential for making C7N filter available to *some* of these functions.
::
with C7NContext(filter):
cel_prgm.evaluate(cel_activation)
"""
def __init__(self, filter: Any) -> None:
self.filter = filter
def __repr__(self) -> str: # pragma: no cover
return f"{self.__class__.__name__}(filter={self.filter!r})"
def __enter__(self) -> None:
global C7N
C7N = self
def __exit__(
self,
exc_type: Optional[Type[BaseException]],
exc_value: Optional[BaseException],
traceback: Optional[TracebackType],
) -> None:
global C7N
C7N = cast("C7NContext", None)
return
# An object used for access to the C7N filter.
# A module global makes the interface functions much simpler.
# They can rely on `C7N.filter` providing the current `CELFilter` instance.
C7N = cast("C7NContext", None)
def key(source: celtypes.ListType, target: celtypes.StringType) -> celtypes.Value:
"""
The C7N shorthand ``tag:Name`` doesn't translate well to CEL. It extracts a single value
from a sequence of objects with a ``{"Key": x, "Value": y}`` structure; specifically,
the value for ``y`` when ``x == "Name"``.
This function locate a particular "Key": target within a list of {"Key": x, "Value", y} items,
returning the y value if one is found, null otherwise.
In effect, the ``key()`` function::
resource["Tags"].key("Name")["Value"]
is somewhat like::
resource["Tags"].filter(x, x["Key"] == "Name")[0]
But the ``key()`` function doesn't raise an exception if the key is not found,
instead it returns None.
We might want to generalize this into a ``first()`` reduction macro.
``resource["Tags"].first(x, x["Key"] == "Name" ? x["Value"] : null, null)``
This macro returns the first non-null value or the default (which can be ``null``.)
"""
key = celtypes.StringType("Key")
value = celtypes.StringType("Value")
matches: Iterator[celtypes.Value] = (
item
for item in source
if cast(celtypes.StringType, cast(celtypes.MapType, item).get(key)) == target
)
try:
return cast(celtypes.MapType, next(matches)).get(value)
except StopIteration:
return None
def glob(text: celtypes.StringType, pattern: celtypes.StringType) -> celtypes.BoolType:
"""Compare a string with a pattern.
While ``"*.py".glob(some_string)`` seems logical because the pattern the more persistent object,
this seems to cause confusion.
We use ``some_string.glob("*.py")`` to express a regex-like rule. This parallels the CEL
`.matches()` method.
We also support ``glob(some_string, "*.py")``.
"""
return celtypes.BoolType(fnmatch.fnmatch(text, pattern))
def difference(left: celtypes.ListType, right: celtypes.ListType) -> celtypes.BoolType:
"""
Compute the difference between two lists. This is ordered set difference: left - right.
It's true if the result is non-empty: there is an item in the left, not present in the right.
It's false if the result is empty: the lists are the same.
"""
return celtypes.BoolType(bool(set(left) - set(right)))
def intersect(left: celtypes.ListType, right: celtypes.ListType) -> celtypes.BoolType:
"""
Compute the intersection between two lists.
It's true if the result is non-empty: there is an item in both lists.
It's false if the result is empty: there is no common item between the lists.
"""
return celtypes.BoolType(bool(set(left) & set(right)))
def normalize(string: celtypes.StringType) -> celtypes.StringType:
"""
Normalize a string.
"""
return celtypes.StringType(string.lower().strip())
def unique_size(collection: celtypes.ListType) -> celtypes.IntType:
"""
Unique size of a list
"""
return celtypes.IntType(len(set(collection)))
class IPv4Network(ipaddress.IPv4Network):
# Override for net 2 net containment comparison
def __contains__(self, other): # type: ignore[no-untyped-def]
if other is None:
return False
if isinstance(other, ipaddress._BaseNetwork):
return self.supernet_of(other) # type: ignore[no-untyped-call]
return super(IPv4Network, self).__contains__(other)
contains = __contains__
if sys.version_info.major == 3 and sys.version_info.minor <= 6: # pragma: no cover
@staticmethod
def _is_subnet_of(a, b): # type: ignore[no-untyped-def]
try:
# Always false if one is v4 and the other is v6.
if a._version != b._version:
raise TypeError(f"{a} and {b} are not of the same version")
return (
b.network_address <= a.network_address
and b.broadcast_address >= a.broadcast_address
)
except AttributeError:
raise TypeError(
f"Unable to test subnet containment between {a} and {b}"
)
def supernet_of(self, other): # type: ignore[no-untyped-def]
"""Return True if this network is a supernet of other."""
return self._is_subnet_of(other, self) # type: ignore[no-untyped-call]
CIDR = Union[None, IPv4Network, ipaddress.IPv4Address]
CIDR_Class = Union[Type[IPv4Network], Callable[..., ipaddress.IPv4Address]]
def parse_cidr(value: str) -> CIDR:
"""
Process cidr ranges.
This is a union of types outside CEL.
It appears to be Union[None, IPv4Network, ipaddress.IPv4Address]
"""
klass: CIDR_Class = IPv4Network
if "/" not in value:
klass = ipaddress.ip_address # type: ignore[assignment]
v: CIDR
try:
v = klass(value)
except (ipaddress.AddressValueError, ValueError):
v = None
return v
def size_parse_cidr(
value: celtypes.StringType,
) -> Optional[celtypes.IntType]:
"""CIDR prefixlen value"""
cidr = parse_cidr(value)
if cidr and isinstance(cidr, IPv4Network):
return celtypes.IntType(cidr.prefixlen)
else:
return None
class ComparableVersion(Version):
"""
The old LooseVersion could fail on comparing present strings, used
in the value as shorthand for certain options.
The new Version doesn't fail as easily.
"""
def __eq__(self, other: object) -> bool:
try:
return super(ComparableVersion, self).__eq__(other)
except TypeError: # pragma: no cover
return False
def version(
value: celtypes.StringType,
) -> celtypes.Value: # actually, a ComparableVersion
return cast(celtypes.Value, ComparableVersion(value))
def present(
value: celtypes.StringType,
) -> celtypes.Value:
return cast(celtypes.Value, bool(value))
def absent(
value: celtypes.StringType,
) -> celtypes.Value:
return cast(celtypes.Value, not bool(value))
def text_from(
url: celtypes.StringType,
) -> celtypes.Value:
"""
Read raw text from a URL. This can be expanded to accept S3 or other URL's.
"""
req = urllib.request.Request(url, headers={"Accept-Encoding": "gzip"})
raw_data: str
with closing(urllib.request.urlopen(req)) as response:
if response.info().get("Content-Encoding") == "gzip":
raw_data = zlib.decompress(response.read(), zlib.MAX_WBITS | 32).decode(
"utf8"
)
else:
raw_data = response.read().decode("utf-8")
return celtypes.StringType(raw_data)
def parse_text(
source_text: celtypes.StringType, format: celtypes.StringType
) -> celtypes.Value:
"""
Parse raw text using a given format.
"""
if format == "json":
return json_to_cel(json.loads(source_text))
elif format == "txt":
return celtypes.ListType(
[celtypes.StringType(s.rstrip()) for s in source_text.splitlines()]
)
elif format in ("ldjson", "ndjson", "jsonl"):
return celtypes.ListType(
[json_to_cel(json.loads(s)) for s in source_text.splitlines()]
)
elif format == "csv":
return celtypes.ListType(
[json_to_cel(row) for row in csv.reader(io.StringIO(source_text))]
)
elif format == "csv2dict":
return celtypes.ListType(
[json_to_cel(row) for row in csv.DictReader(io.StringIO(source_text))]
)
else:
raise ValueError(f"Unsupported format: {format!r}") # pragma: no cover
def value_from(
url: celtypes.StringType,
format: Optional[celtypes.StringType] = None,
) -> celtypes.Value:
"""
Read values from a URL.
First, do :func:`text_from` to read the source.
Then, do :func:`parse_text` to parse the source, if needed.
This makes the format optional, and deduces it from the URL's path information.
C7N will generally replace this with a function
that leverages a more sophisticated :class:`c7n.resolver.ValuesFrom`.
"""
supported_formats = ("json", "ndjson", "ldjson", "jsonl", "txt", "csv", "csv2dict")
# 1. get format either from arg or URL
if not format:
_, suffix = os.path.splitext(url)
format = celtypes.StringType(suffix[1:])
if format not in supported_formats:
raise ValueError(f"Unsupported format: {format!r}")
# 2. read raw data
# Note this is directly bound to text_from() and does not go though the environment
# or other CEL indirection.
raw_data = cast(celtypes.StringType, text_from(url))
# 3. parse physical format (json, ldjson, ndjson, jsonl, txt, csv, csv2dict)
return parse_text(raw_data, format)
def jmes_path(
source_data: celtypes.Value, path_source: celtypes.StringType
) -> celtypes.Value:
"""
Apply JMESPath to an object read from from a URL.
"""
expression = jmespath.compile(path_source)
return json_to_cel(expression.search(source_data))
def jmes_path_map(
source_data: celtypes.ListType, path_source: celtypes.StringType
) -> celtypes.ListType:
"""
Apply JMESPath to a each object read from from a URL.
This is for ndjson, nljson and jsonl files.
"""
expression = jmespath.compile(path_source)
return celtypes.ListType(
[json_to_cel(expression.search(row)) for row in source_data]
)
def marked_key(
source: celtypes.ListType, target: celtypes.StringType
) -> celtypes.Value:
"""
Examines a list of {"Key": text, "Value": text} mappings
looking for the given Key value.
Parses a ``message:action@action_date`` value into a mapping
{"message": message, "action": action, "action_date": action_date}
If no Key or no Value or the Value isn't the right structure,
the result is a null.
"""
value = key(source, target)
if value is None:
return None
try:
msg, tgt = cast(celtypes.StringType, value).rsplit(":", 1)
action, action_date_str = tgt.strip().split("@", 1)
except ValueError:
return None
return celtypes.MapType(
{
celtypes.StringType("message"): celtypes.StringType(msg),
celtypes.StringType("action"): celtypes.StringType(action),
celtypes.StringType("action_date"): celtypes.TimestampType(action_date_str),
}
)
def image(resource: celtypes.MapType) -> celtypes.Value:
"""
Reach into C7N to get the image details for this EC2 or ASG resource.
Minimally, the creation date is transformed into a CEL timestamp.
We may want to slightly generalize this to json_to_cell() the entire Image object.
The following may be usable, but it seems too complex:
::
C7N.filter.prefetch_instance_images(C7N.policy.resources)
image = C7N.filter.get_instance_image(resource["ImageId"])
return json_to_cel(image)
.. todo:: Refactor C7N
Provide the :py:class:`InstanceImageBase` mixin in a :py:class:`CELFilter` class.
We want to have the image details in the new :py:class:`CELFilter` instance.
"""
# Assuming the :py:class:`CELFilter` class has this method extracted from the legacy filter.
# Requies the policy already did this: C7N.filter.prefetch_instance_images([resource]) to
# populate cache.
image = C7N.filter.get_instance_image(resource)
if image:
creation_date = image["CreationDate"]
image_name = image["Name"]
else:
creation_date = "2000-01-01T01:01:01.000Z"
image_name = ""
return json_to_cel({"CreationDate": parse_date(creation_date), "Name": image_name})
def get_raw_metrics(request: celtypes.MapType) -> celtypes.Value:
"""
Reach into C7N and make a statistics request using the current C7N filter object.
The ``request`` parameter is the request object that is passed through to AWS via
the current C7N filter's manager. The request is a Mapping with the following keys and values:
::
get_raw_metrics({
"Namespace": "AWS/EC2",
"MetricName": "CPUUtilization",
"Dimensions": {"Name": "InstanceId", "Value": resource.InstanceId},
"Statistics": ["Average"],
"StartTime": now - duration("4d"),
"EndTime": now,
"Period": duration("86400s")
})
The request is passed through to AWS more-or-less directly. The result is a CEL
list of values for then requested statistic. A ``.map()`` macro
can be used to compute additional details. An ``.exists()`` macro can filter the
data to look for actionable values.
We would prefer to refactor C7N and implement this with code something like this:
::
C7N.filter.prepare_query(C7N.policy.resources)
data = C7N.filter.get_resource_statistics(client, resource)
return json_to_cel(data)
.. todo:: Refactor C7N
Provide a :py:class:`MetricsAccess` mixin in a :py:class:`CELFilter` class.
We want to have the metrics processing in the new :py:class:`CELFilter` instance.
"""
client = C7N.filter.manager.session_factory().client("cloudwatch")
data = client.get_metric_statistics(
Namespace=request["Namespace"],
MetricName=request["MetricName"],
Statistics=request["Statistics"],
StartTime=request["StartTime"],
EndTime=request["EndTime"],
Period=request["Period"],
Dimensions=request["Dimensions"],
)["Datapoints"]
return json_to_cel(data)
def get_metrics(
resource: celtypes.MapType, request: celtypes.MapType
) -> celtypes.Value:
"""
Reach into C7N and make a statistics request using the current C7N filter.
This builds a request object that is passed through to AWS via the :func:`get_raw_metrics`
function.
The ``request`` parameter is a Mapping with the following keys and values:
::
resource.get_metrics({"MetricName": "CPUUtilization", "Statistic": "Average",
"StartTime": now - duration("4d"), "EndTime": now, "Period": duration("86400s")}
).exists(m, m < 30)
The namespace is derived from the ``C7N.policy``. The dimensions are derived from
the ``C7N.fiter.model``.
.. todo:: Refactor C7N
Provide a :py:class:`MetricsAccess` mixin in a :py:class:`CELFilter` class.
We want to have the metrics processing in the new :py:class:`CELFilter` instance.
"""
dimension = C7N.filter.manager.get_model().dimension
namespace = C7N.filter.manager.resource_type
# TODO: Varies by resource/policy type. Each policy's model may have different dimensions.
dimensions = [{"Name": dimension, "Value": resource.get(dimension)}]
raw_metrics = get_raw_metrics(
cast(
celtypes.MapType,
json_to_cel(
{
"Namespace": namespace,
"MetricName": request["MetricName"],
"Dimensions": dimensions,
"Statistics": [request["Statistic"]],
"StartTime": request["StartTime"],
"EndTime": request["EndTime"],
"Period": request["Period"],
}
),
)
)
return json_to_cel(
[
cast(Dict[str, celtypes.Value], item).get(request["Statistic"])
for item in cast(List[celtypes.Value], raw_metrics)
]
)
def get_raw_health_events(request: celtypes.MapType) -> celtypes.Value:
"""
Reach into C7N and make a health-events request using the current C7N filter.
The ``request`` parameter is the filter object that is passed through to AWS via
the current C7N filter's manager. The request is a List of AWS health events.
::
get_raw_health_events({
"services": ["ELASTICFILESYSTEM"],
"regions": ["us-east-1", "global"],
"eventStatusCodes": ['open', 'upcoming'],
})
"""
client = C7N.filter.manager.session_factory().client(
"health", region_name="us-east-1"
)
data = client.describe_events(filter=request)["events"]
return json_to_cel(data)
def get_health_events(
resource: celtypes.MapType, statuses: Optional[List[celtypes.Value]] = None
) -> celtypes.Value:
"""
Reach into C7N and make a health-event request using the current C7N filter.
This builds a request object that is passed through to AWS via the :func:`get_raw_health_events`
function.
.. todo:: Handle optional list of event types.
"""
if not statuses:
statuses = [celtypes.StringType("open"), celtypes.StringType("upcoming")]
phd_svc_name_map = {
"app-elb": "ELASTICLOADBALANCING",
"ebs": "EBS",
"efs": "ELASTICFILESYSTEM",
"elb": "ELASTICLOADBALANCING",
"emr": "ELASTICMAPREDUCE",
}
m = C7N.filter.manager
service = phd_svc_name_map.get(m.data["resource"], m.get_model().service.upper())
raw_events = get_raw_health_events(
cast(
celtypes.MapType,
json_to_cel(
{
"services": [service],
"regions": [m.config.region, "global"],
"eventStatusCodes": statuses,
}
),
)
)
return raw_events
def get_related_ids(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_ids() request using the current C7N filter.
.. todo:: Refactor C7N
Provide the :py:class:`RelatedResourceFilter` mixin in a :py:class:`CELFilter` class.
We want to have the related id's details in the new :py:class:`CELFilter` instance.
"""
# Assuming the :py:class:`CELFilter` class has this method extracted from the legacy filter.
related_ids = C7N.filter.get_related_ids(resource)
return json_to_cel(related_ids)
def get_related_sgs(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_sgs() request using the current C7N filter.
"""
security_groups = C7N.filter.get_related_sgs(resource)
return json_to_cel(security_groups)
def get_related_subnets(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_subnets() request using the current C7N filter.
"""
subnets = C7N.filter.get_related_subnets(resource)
return json_to_cel(subnets)
def get_related_nat_gateways(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_nat_gateways() request using the current C7N filter.
"""
nat_gateways = C7N.filter.get_related_nat_gateways(resource)
return json_to_cel(nat_gateways)
def get_related_igws(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_igws() request using the current C7N filter.
"""
igws = C7N.filter.get_related_igws(resource)
return json_to_cel(igws)
def get_related_security_configs(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_security_configs() request using the current C7N filter.
"""
security_configs = C7N.filter.get_related_security_configs(resource)
return json_to_cel(security_configs)
def get_related_vpc(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_vpc() request using the current C7N filter.
"""
vpc = C7N.filter.get_related_vpc(resource)
return json_to_cel(vpc)
def get_related_kms_keys(
resource: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related_kms_keys() request using the current C7N filter.
"""
vpc = C7N.filter.get_related_kms_keys(resource)
return json_to_cel(vpc)
def security_group(
security_group_id: celtypes.MapType,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related() request using the current C7N filter to get
the security group.
.. todo:: Refactor C7N
Provide the :py:class:`RelatedResourceFilter` mixin in a :py:class:`CELFilter` class.
We want to have the related id's details in the new :py:class:`CELFilter` instance.
See :py:class:`VpcSecurityGroupFilter` subclass of :py:class:`RelatedResourceFilter`.
"""
# Assuming the :py:class:`CELFilter` class has this method extracted from the legacy filter.
security_groups = C7N.filter.get_related([security_group_id])
return json_to_cel(security_groups)
def subnet(
subnet_id: celtypes.Value,
) -> celtypes.Value:
"""
Reach into C7N and make a get_related() request using the current C7N filter to get
the subnet.
.. todo:: Refactor C7N
Provide the :py:class:`RelatedResourceFilter` mixin in a :py:class:`CELFilter` class.
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/celparser.py | src/celpy/celparser.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
A **Facade** around the CEL parser.
The Parser is an instance of the :py:class:`lark.Lark` class.
The grammar is in the ``cel.lark`` file.
For more information on CEL syntax, see the following:
- https://github.com/google/cel-spec/blob/master/doc/langdef.md
- https://github.com/google/cel-cpp/blob/master/parser/Cel.g4
- https://github.com/google/cel-go/blob/master/parser/gen/CEL.g4
Example::
>>> from celpy.celparser import CELParser
>>> p = CELParser()
>>> text2 = 'type(null)'
>>> ast2 = p.parse(text2)
>>> print(ast2.pretty().replace("\t"," ")) # doctest: +NORMALIZE_WHITESPACE
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
ident_arg
type
exprlist
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal null
"""
import re
from pathlib import Path
from typing import Any, List, Optional, cast
import lark.visitors
from lark import Lark, Token, Tree # noqa: F401
from lark.exceptions import LexError, ParseError, UnexpectedCharacters, UnexpectedToken
class CELParseError(Exception):
"""A syntax error in the CEL expression."""
def __init__(
self, *args: Any, line: Optional[int] = None, column: Optional[int] = None
) -> None:
super().__init__(*args)
self.line = line
self.column = column
class CELParser:
"""
Creates a Lark parser with the required options.
.. important:: **Singleton**
There is one CEL_PARSER instance created by this class.
This is an optimization for environments like C7N where numerous
CEL expressions may parsed.
::
CELParse.CEL_PARSER = None
Is required to create another parser instance.
This is commonly required in test environments.
This is also an **Adapter** for the CEL parser to provide pleasant
syntax error messages.
"""
CEL_PARSER: Optional[Lark] = None
def __init__(self, tree_class: type = lark.Tree) -> None:
if CELParser.CEL_PARSER is None:
CEL_grammar = (Path(__file__).parent / "cel.lark").read_text()
CELParser.CEL_PARSER = Lark(
CEL_grammar,
parser="lalr",
start="expr",
debug=True,
g_regex_flags=re.M,
lexer_callbacks={"IDENT": self.ambiguous_literals},
propagate_positions=True,
maybe_placeholders=False,
priority="invert",
tree_class=tree_class,
)
@staticmethod
def ambiguous_literals(t: Token) -> Token:
"""Resolve a grammar ambiguity between identifiers and literals"""
if t.value == "true":
return Token("BOOL_LIT", t.value)
elif t.value == "false":
return Token("BOOL_LIT", t.value)
return t
def parse(self, text: str) -> Tree:
if CELParser.CEL_PARSER is None:
raise TypeError("No grammar loaded") # pragma: no cover
self.text = text
try:
return CELParser.CEL_PARSER.parse(self.text)
except (UnexpectedToken, UnexpectedCharacters) as ex:
message = ex.get_context(text)
raise CELParseError(message, *ex.args, line=ex.line, column=ex.column)
except (LexError, ParseError) as ex: # pragma: no cover
message = ex.args[0].splitlines()[0]
raise CELParseError(message, *ex.args)
def error_text(
self, message: str, line: Optional[int] = None, column: Optional[int] = None
) -> str:
source = self.text.splitlines()[line - 1] if line else self.text
message = (
f"ERROR: <input>:{line or '?'}:{column or '?'} {message}\n"
f" | {source}\n"
f" | {(column - 1) * '.' if column else ''}^\n"
)
return message
class DumpAST(lark.visitors.Visitor_Recursive):
"""Dump a CEL AST creating a close approximation to the original source."""
@classmethod
def display(cls_, ast: lark.Tree) -> str:
d = cls_()
d.visit(ast)
return d.stack[0]
def __init__(self) -> None:
self.stack: List[str] = []
def expr(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
cond = self.stack.pop()
self.stack.append(f"{cond} ? {left} : {right}")
def conditionalor(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} || {right}")
def conditionaland(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} && {right}")
def relation(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} {right}")
def relation_lt(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} < ")
def relation_le(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} <= ")
def relation_gt(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} > ")
def relation_ge(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} >= ")
def relation_eq(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} == ")
def relation_ne(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} != ")
def relation_in(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} in ")
def addition(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} {right}")
def addition_add(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} + ")
def addition_sub(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} - ")
def multiplication(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} {right}")
def multiplication_mul(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} * ")
def multiplication_div(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} / ")
def multiplication_mod(self, tree: lark.Tree) -> None:
left = self.stack.pop()
self.stack.append(f"{left} % ")
def unary(self, tree: lark.Tree) -> None:
if len(tree.children) == 1:
return
else:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left} {right}")
def unary_not(self, tree: lark.Tree) -> None:
self.stack.append("!")
def unary_neg(self, tree: lark.Tree) -> None:
self.stack.append("-")
def member_dot(self, tree: lark.Tree) -> None:
right = cast(lark.Token, tree.children[1]).value
if self.stack:
left = self.stack.pop()
self.stack.append(f"{left}.{right}")
def member_dot_arg(self, tree: lark.Tree) -> None:
if len(tree.children) == 3:
exprlist = self.stack.pop()
else:
exprlist = ""
right = cast(lark.Token, tree.children[1]).value
left = self.stack.pop()
self.stack.append(f"{left}.{right}({exprlist})")
def member_index(self, tree: lark.Tree) -> None:
right = self.stack.pop()
left = self.stack.pop()
self.stack.append(f"{left}[{right}]")
def member_object(self, tree: lark.Tree) -> None:
if len(tree.children) == 2:
fieldinits = self.stack.pop()
else:
fieldinits = ""
left = self.stack.pop()
self.stack.append(f"{left}{{{fieldinits}}}")
def dot_ident_arg(self, tree: lark.Tree) -> None:
if len(tree.children) == 2:
exprlist = self.stack.pop()
else:
exprlist = ""
left = cast(lark.Token, tree.children[0]).value
self.stack.append(f".{left}({exprlist})")
def dot_ident(self, tree: lark.Tree) -> None:
left = cast(lark.Token, tree.children[0]).value
self.stack.append(f".{left}")
def ident_arg(self, tree: lark.Tree) -> None:
if len(tree.children) == 2:
exprlist = self.stack.pop()
else:
exprlist = ""
left = cast(lark.Token, tree.children[0]).value
self.stack.append(f"{left}({exprlist})")
def ident(self, tree: lark.Tree) -> None:
self.stack.append(cast(lark.Token, tree.children[0]).value)
def paren_expr(self, tree: lark.Tree) -> None:
if self.stack:
left = self.stack.pop()
self.stack.append(f"({left})")
def list_lit(self, tree: lark.Tree) -> None:
if self.stack:
left = self.stack.pop()
self.stack.append(f"[{left}]")
else:
self.stack.append("")
def map_lit(self, tree: lark.Tree) -> None:
if self.stack:
left = self.stack.pop()
self.stack.append(f"{{{left}}}")
else:
self.stack.append("{}")
def exprlist(self, tree: lark.Tree) -> None:
items = ", ".join(reversed(list(self.stack.pop() for _ in tree.children)))
self.stack.append(items)
def fieldinits(self, tree: lark.Tree) -> None:
names = cast(List[lark.Token], tree.children[::2])
values = cast(List[lark.Token], tree.children[1::2])
assert len(names) == len(values)
pairs = reversed(
list((n.value, self.stack.pop()) for n, v in zip(names, values))
)
items = ", ".join(f"{n}: {v}" for n, v in pairs)
self.stack.append(items)
def mapinits(self, tree: lark.Tree) -> None:
"""Note reversed pop order for values and keys."""
keys = tree.children[::2]
values = tree.children[1::2]
assert len(keys) == len(values)
pairs = reversed(
list(
{"value": self.stack.pop(), "key": self.stack.pop()}
for k, v in zip(keys, values)
)
)
items = ", ".join(f"{k_v['key']}: {k_v['value']}" for k_v in pairs)
self.stack.append(items)
def literal(self, tree: lark.Tree) -> None:
if tree.children:
self.stack.append(cast(lark.Token, tree.children[0]).value)
def tree_dump(ast: Tree) -> str:
"""Dumps the AST to approximate the original source"""
d = DumpAST()
d.visit(ast)
return d.stack[0]
if __name__ == "__main__": # pragma: no cover
# A minimal sanity check.
# This is a smoke test for the grammar to expose shift/reduce or reduce/reduce conflicts.
# It will produce a RuntimeWarning because it's not the proper main program.
p = CELParser()
text = """
account.balance >= transaction.withdrawal
|| (account.overdraftProtection
&& account.overdraftLimit >= transaction.withdrawal - account.balance)
"""
ast = p.parse(text)
print(ast)
d = DumpAST()
d.visit(ast)
print(d.stack)
text2 = """type(null)"""
ast2 = p.parse(text2)
print(ast2.pretty())
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/src/celpy/adapter.py | src/celpy/adapter.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Adapters to convert some Python-native types into CEL structures.
Currently, atomic Python objects have direct use of types in :mod:`celpy.celtypes`.
Non-atomic Python objects are characterized by JSON and Protobuf messages.
This module has functions to convert JSON objects to CEL.
A proper protobuf decoder is TBD.
A more sophisticated type injection capability may be needed to permit
additional types or extensions to :mod:`celpy.celtypes`.
"""
import base64
import datetime
import json
from typing import Any, Dict, List, Union, cast
from celpy import celtypes
JSON = Union[Dict[str, Any], List[Any], bool, float, int, str, None]
class CELJSONEncoder(json.JSONEncoder):
"""
An Encoder to export CEL objects as JSON text.
This is **not** a reversible transformation. Some things are coerced to strings
without any more detailed type marker.
Specifically timestamps, durations, and bytes.
"""
@staticmethod
def to_python(
cel_object: celtypes.Value,
) -> Union[celtypes.Value, List[Any], Dict[Any, Any], bool]:
"""Recursive walk through the CEL object, replacing BoolType with native bool instances.
This lets the :py:mod:`json` module correctly represent the obects
with JSON ``true`` and ``false``.
This will also replace ListType and MapType with native ``list`` and ``dict``.
All other CEL objects will be left intact. This creates an intermediate hybrid
beast that's not quite a :py:class:`celtypes.Value` because a few things have been replaced.
"""
if isinstance(cel_object, celtypes.BoolType):
return True if cel_object else False
elif isinstance(cel_object, celtypes.ListType):
return [CELJSONEncoder.to_python(item) for item in cel_object]
elif isinstance(cel_object, celtypes.MapType):
return {
CELJSONEncoder.to_python(key): CELJSONEncoder.to_python(value)
for key, value in cel_object.items()
}
else:
return cel_object
def encode(self, cel_object: celtypes.Value) -> str:
"""
Override built-in encode to create proper Python :py:class:`bool` objects.
"""
return super().encode(CELJSONEncoder.to_python(cel_object))
def default(self, cel_object: celtypes.Value) -> JSON:
if isinstance(cel_object, celtypes.TimestampType):
return str(cel_object)
elif isinstance(cel_object, celtypes.DurationType):
return str(cel_object)
elif isinstance(cel_object, celtypes.BytesType):
return base64.b64encode(cel_object).decode("ASCII")
else:
return cast(JSON, super().default(cel_object))
class CELJSONDecoder(json.JSONDecoder):
"""
An Encoder to import CEL objects from JSON to the extent possible.
This does not handle non-JSON types in any form. Coercion from string
to TimestampType or DurationType or BytesType is handled by celtype
constructors.
"""
def decode(self, source: str, _w: Any = None) -> Any:
raw_json = super().decode(source)
return json_to_cel(raw_json)
def json_to_cel(document: JSON) -> celtypes.Value:
"""
Converts parsed JSON object from Python to CEL to the extent possible.
Note that it's difficult to distinguish strings which should be timestamps or durations.
Using the :py:mod:`json` package ``objecthook`` can help do these conversions.
.. csv-table::
:header: python, CEL
bool, :py:class:`celpy.celtypes.BoolType`
float, :py:class:`celpy.celtypes.DoubleType`
int, :py:class:`celpy.celtypes.IntType`
str, :py:class:`celpy.celtypes.StringType`
None, None
"tuple, list", :py:class:`celpy.celtypes.ListType`
dict, :py:class:`celpy.celtypes.MapType`
datetime.datetime, :py:class:`celpy.celtypes.TimestampType`
datetime.timedelta, :py:class:`celpy.celtypes.DurationType`
:param document: A JSON document.
:returns: :py:class:`celpy.celtypes.Value`.
:raises: internal :exc:`ValueError` or :exc:`TypeError` for failed conversions.
Example:
::
>>> from pprint import pprint
>>> from celpy.adapter import json_to_cel
>>> doc = json.loads('["str", 42, 3.14, null, true, {"hello": "world"}]')
>>> cel = json_to_cel(doc)
>>> pprint(cel)
ListType([StringType('str'), IntType(42), DoubleType(3.14), None, BoolType(True), \
MapType({StringType('hello'): StringType('world')})])
"""
if isinstance(document, bool):
return celtypes.BoolType(document)
elif isinstance(document, float):
return celtypes.DoubleType(document)
elif isinstance(document, int):
return celtypes.IntType(document)
elif isinstance(document, str):
return celtypes.StringType(document)
elif document is None:
return None
elif isinstance(document, (tuple, List)):
return celtypes.ListType([json_to_cel(item) for item in document])
elif isinstance(document, Dict):
return celtypes.MapType(
{json_to_cel(key): json_to_cel(value) for key, value in document.items()}
)
elif isinstance(document, datetime.datetime):
return celtypes.TimestampType(document)
elif isinstance(document, datetime.timedelta):
return celtypes.DurationType(document)
else:
raise ValueError(
f"unexpected type {type(document)} in JSON structure {document!r}"
)
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_adapter.py | tests/test_adapter.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
C7N Type Adapter Test Cases.
"""
import datetime
import celpy.adapter
import celpy.celtypes
def test_json_to_cel():
assert celpy.adapter.json_to_cel(True) == celpy.celtypes.BoolType(True)
assert celpy.adapter.json_to_cel(False) == celpy.celtypes.BoolType(False)
assert str(celpy.adapter.json_to_cel(False)) == str(celpy.celtypes.BoolType(False))
assert celpy.adapter.json_to_cel(2.5) == celpy.celtypes.DoubleType(2.5)
assert celpy.adapter.json_to_cel(42) == celpy.celtypes.IntType(42)
assert celpy.adapter.json_to_cel("Hello, world!") == celpy.celtypes.StringType("Hello, world!")
assert celpy.adapter.json_to_cel(None) is None
assert celpy.adapter.json_to_cel(["Hello", "world!"]) == celpy.celtypes.ListType(
[
celpy.celtypes.StringType("Hello"),
celpy.celtypes.StringType("world!"),
]
)
assert celpy.adapter.json_to_cel(tuple(["Hello", "world!"])) == celpy.celtypes.ListType(
[
celpy.celtypes.StringType("Hello"),
celpy.celtypes.StringType("world!"),
]
)
assert celpy.adapter.json_to_cel({"Hello": "world!"}) == celpy.celtypes.MapType(
{
celpy.celtypes.StringType("Hello"):
celpy.celtypes.StringType("world!"),
}
)
assert (
celpy.adapter.json_to_cel(datetime.datetime(2020, 9, 10, 11, 12, 13, tzinfo=datetime.timezone.utc))
== celpy.celtypes.TimestampType("2020-09-10T11:12:13Z")
)
assert (
celpy.adapter.json_to_cel(datetime.timedelta(days=42)) == celpy.celtypes.DurationType("42d")
)
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_celtypes.py | tests/test_celtypes.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Test all the celtype methods.
"""
import datetime
import math
from unittest.mock import sentinel
import pytest
from celpy import Int32Value
from celpy.celtypes import *
from celpy.evaluation import CELEvalError
def test_bool_type():
t, f = BoolType(True), BoolType(False)
exc = CELEvalError(('summary', 'details'))
assert logical_condition(t, sentinel.true, sentinel.false) == sentinel.true
assert logical_condition(f, sentinel.true, sentinel.false) == sentinel.false
with pytest.raises(TypeError):
logical_condition(StringType("nope"), sentinel.true, sentinel.false)
assert logical_and(t, t) == t
assert logical_and(t, f) == f
assert logical_and(f, t) == f
assert logical_and(f, f) == f
assert logical_and(t, exc) == exc
assert logical_and(exc, t) == exc
assert logical_and(f, exc) == f
assert logical_and(exc, f) == f
with pytest.raises(TypeError):
logical_and(exc, StringType("nope"))
assert logical_or(t, t) == t
assert logical_or(t, f) == t
assert logical_or(f, t) == t
assert logical_or(f, f) == f
assert logical_or(t, exc) == t
assert logical_or(exc, t) == t
assert logical_or(f, exc) == exc
assert logical_or(exc, f) == exc
with pytest.raises(TypeError):
logical_or(exc, StringType("nope"))
assert logical_not(t) == f
assert logical_not(f) == t
with pytest.raises(TypeError):
logical_not(StringType("nope"))
assert repr(f) == "BoolType(False)"
assert repr(t) == "BoolType(True)"
with pytest.raises(TypeError):
-t
assert hash(t) == hash(t)
assert hash(t) != hash(f)
assert not BoolType(None)
assert BoolType(MessageType({StringType("value"): BoolType(True)}))
def test_bytes_type():
b_0 = BytesType(b'bytes')
b_1 = BytesType('bytes')
b_2 = BytesType([98, 121, 116, 101, 115])
with pytest.raises(TypeError):
BytesType(3.14)
assert repr(b_0) == "BytesType(b'bytes')"
assert BytesType(None) == BytesType(b'')
assert BytesType(MessageType({"value": BytesType(b'42')})) == BytesType(b'42')
assert b_0.contains(b'byte')
def test_double_type():
d_pi = DoubleType(3.1415926)
d_e = DoubleType(2.718281828)
assert repr(d_pi) == "DoubleType(3.1415926)"
assert str(d_pi) == "3.1415926"
assert -d_pi == -3.1415926
with pytest.raises(TypeError):
d_pi % d_e
with pytest.raises(TypeError):
2 % d_e
assert d_pi / DoubleType(0.0) == float("inf")
assert math.isclose(d_pi / d_e, 3.1415926 / 2.718281828)
assert d_pi == d_pi
assert d_pi != d_e
with pytest.raises(TypeError):
d_pi == StringType("nope")
assert hash(d_pi) == hash(d_pi)
assert hash(d_pi) != hash(d_e)
assert 2 / DoubleType(0.0) == float("inf")
assert 3.0 / DoubleType(4.0) == DoubleType(0.75)
assert DoubleType(None) == DoubleType(0.0)
assert DoubleType(MessageType({"value": DoubleType('4.2')})) == DoubleType(4.2)
def test_int_type():
i_42 = IntType(42)
i_max = IntType(9223372036854775807)
assert IntType(DoubleType(1.9)) == IntType(1)
assert IntType(DoubleType(-123.456)) == IntType(-123)
assert IntType(TimestampType("2009-02-13T23:31:30Z")) == 1234567890
assert IntType("0x2a") == 42
assert IntType("-0x2a") == -42
assert IntType("42") == 42
assert IntType("-42") == -42
with pytest.raises(ValueError):
IntType(9223372036854775807) + IntType(1)
with pytest.raises(ValueError):
-IntType(9223372036854775808) - IntType(1)
assert id(i_42) == id(IntType(i_42))
assert repr(i_42) == "IntType(42)"
assert str(i_max) == "9223372036854775807"
assert IntType("-42") == -i_42
assert i_42 == i_42 + IntType(1) - IntType(1)
assert i_42 == i_42 * IntType(2) / IntType(2)
# x y x / y x % y
# 5 3 1 2
# -5 3 -1 -2
# 5 -3 -1 2
# -5 -3 1 -2
assert IntType(5) / IntType(3) == IntType(1)
assert -IntType(5) / IntType(3) == -IntType(1)
assert IntType(5) / -IntType(3) == -IntType(1)
assert -IntType(5) / -IntType(3) == IntType(1)
assert IntType(5) % IntType(3) == IntType(2)
assert -IntType(5) % IntType(3) == -IntType(2)
assert IntType(5) % -IntType(3) == IntType(2)
assert -IntType(5) % -IntType(3) == -IntType(2)
assert 2 + IntType(40) == i_42
assert 44 - IntType(2) == i_42
assert 6 * IntType(7) == i_42
assert 84 / IntType(2) == i_42
assert 85 % IntType(43) == i_42
assert i_42 != i_max
assert i_42 < i_max
assert i_42 <= i_max
assert i_max > i_42
assert i_max >= i_42
assert hash(i_42) == hash(i_42)
assert hash(i_42) != hash(i_max)
assert IntType(None) == IntType(0)
assert IntType(MessageType({"value": IntType(42)})) == IntType(42)
def test_uint_type():
u_42 = UintType(42)
u_max = UintType(18446744073709551615)
assert UintType(DoubleType(1.9)) == UintType(1)
with pytest.raises(ValueError):
assert UintType(DoubleType(-123.456)) == UintType(-123)
assert UintType(TimestampType("2009-02-13T23:31:30Z")) == 1234567890
assert UintType("0x2a") == 42
with pytest.raises(ValueError):
assert UintType("-0x2a") == -42
assert UintType("42") == 42
with pytest.raises(ValueError):
assert UintType("-42") == -42
with pytest.raises(ValueError):
UintType(18446744073709551615) + UintType(1)
with pytest.raises(ValueError):
UintType(0) - UintType(1)
assert id(u_42) == id(UintType(u_42))
assert repr(u_42) == "UintType(42)"
assert str(u_max) == "18446744073709551615"
with pytest.raises(TypeError):
assert -UintType("42")
assert u_42 == u_42 + UintType(1) - UintType(1)
assert u_42 == u_42 * UintType(2) / UintType(2)
# x y x / y x % y
# 5 3 1 2
# -5 3 -1 -2
# 5 -3 -1 2
# -5 -3 1 -2
assert UintType(5) / UintType(3) == UintType(1)
assert UintType(5) % UintType(3) == UintType(2)
assert 2 + UintType(40) == u_42
assert 44 - UintType(2) == u_42
assert 6 * UintType(7) == u_42
assert 84 / UintType(2) == u_42
assert 85 % UintType(43) == u_42
assert u_42 != u_max
assert u_42 < u_max
assert u_42 <= u_max
assert u_max > u_42
assert u_max >= u_42
assert hash(u_42) == hash(u_42)
assert hash(u_42) != hash(u_max)
assert UintType(None) == UintType(0)
assert UintType(MessageType({"value": UintType(42)})) == UintType(42)
def test_list_type():
l_1 = ListType([IntType(42), IntType(6), IntType(7)])
l_2 = ListType([IntType(42), StringType("2.718281828459045**1.791759469228055"), IntType(7)])
assert l_1 == l_1
with pytest.raises(TypeError):
assert l_1 != l_2
with pytest.raises(TypeError):
assert not l_1 == l_2
assert repr(l_1) == "ListType([IntType(42), IntType(6), IntType(7)])"
with pytest.raises(TypeError):
l_1 < l_2
with pytest.raises(TypeError):
l_1 <= l_2
with pytest.raises(TypeError):
l_1 > l_2
with pytest.raises(TypeError):
l_1 >= l_2
with pytest.raises(TypeError):
l_1 == DoubleType("42.0")
with pytest.raises(TypeError):
assert l_1 != DoubleType("42.0")
assert l_1 != ListType([IntType(42), IntType(42), IntType(42)])
assert ListType() == ListType([])
assert ListType(ListType([IntType(42)])) == ListType([IntType(42)])
assert l_1.contains(IntType(42))
def test_map_type():
m_0 = MapType()
m_1 = MapType({
StringType("A"): IntType(42),
StringType("X"): IntType(6),
StringType("Y"): IntType(7)}
)
m_2 = MapType({
StringType("A"): IntType(42),
StringType("X"): StringType("2.718281828459045**1.791759469228055"),
StringType("Y"): IntType(7)}
)
m_3 = MapType([
ListType([StringType("A"), IntType(42)]),
ListType([StringType("X"), IntType(6)]),
ListType([StringType("Y"), IntType(7)])]
)
m_single = MapType({StringType("A"): IntType(42),})
assert m_1 == m_1
assert m_1 == m_3
assert not m_1 != m_1
assert not m_single != m_single
with pytest.raises(TypeError):
MapType(3.1415926)
with pytest.raises(TypeError):
assert m_1 != m_2
with pytest.raises(TypeError):
assert not m_1 == m_2
assert repr(m_1) == (
"MapType({StringType('A'): IntType(42), "
"StringType('X'): IntType(6), "
"StringType('Y'): IntType(7)})")
assert m_1[StringType("A")] == IntType(42)
with pytest.raises(TypeError):
m_1[ListType([StringType("A")])]
with pytest.raises(TypeError):
m_1.get(ListType([StringType("A")]))
with pytest.raises(TypeError):
m_1 < m_2
with pytest.raises(TypeError):
m_1 <= m_2
with pytest.raises(TypeError):
m_1 > m_2
with pytest.raises(TypeError):
m_1 >= m_2
with pytest.raises(TypeError):
m_1 == DoubleType("42.0")
with pytest.raises(TypeError):
assert m_1 != DoubleType("42.0")
assert m_1 != MapType({
StringType("A"): IntType(42),
StringType("X"): IntType(42),
StringType("Y"): IntType(42)}
)
assert m_1.contains(StringType("A"))
assert m_1.get(StringType("A")) == IntType(42)
assert m_1.get(StringType("NOT_FOUND"), IntType(21)) == IntType(21)
with pytest.raises(KeyError):
m_1.get(StringType("NOT_FOUND"))
with pytest.raises(ValueError):
m_bad = MapType([("A", IntType(42)), ("A", StringType("Duplicate"))])
def test_string_type():
s_1 = StringType(b'bytes')
s_2 = StringType("string")
s_3 = StringType(42)
assert repr(s_1) == "StringType('bytes')"
assert repr(s_2) == "StringType('string')"
assert repr(s_3) == "StringType('42')"
assert s_1 == s_1
assert s_1 != s_2
assert id(s_1) == id(s_1)
assert id(s_1) != id(s_2)
assert s_2.contains("str")
def test_string_issue_48():
s_1 = StringType("temp")
n_1 = NullType()
assert s_1 != n_1
assert not (s_1 == n_1)
def test_timestamp_type():
ts_1_dt = TimestampType(datetime.datetime(2009, 2, 13, 23, 31, 30))
ts_1_tuple = TimestampType(2009, 2, 13, 23, 31, 30)
ts_1 = TimestampType("2009-02-13T23:31:30Z")
ts_1_m = TimestampType("2009-02-13T23:31:30.000000Z")
assert ts_1 == ts_1_dt
assert ts_1 == ts_1_tuple
assert ts_1 == ts_1_m
with pytest.raises(ValueError):
TimestampType("2009-02-13T23:31:xyZ")
with pytest.raises(TypeError):
TimestampType(IntType(42))
assert repr(ts_1) == repr(ts_1_m)
assert str(ts_1) == "2009-02-13T23:31:30Z"
assert TimestampType(2009, 2, 13, 23, 31, 0) + DurationType("30s") == ts_1
with pytest.raises(TypeError):
assert TimestampType(2009, 2, 13, 23, 31, 0) + StringType("30s")
assert DurationType("30s") + TimestampType(2009, 2, 13, 23, 31, 0) == ts_1
with pytest.raises(TypeError):
assert StringType("30s") + TimestampType(2009, 2, 13, 23, 31, 0)
assert (
TimestampType(2009, 2, 13, 0, 0, 0) - TimestampType(2009, 1, 1, 0, 0, 0)
== DurationType(datetime.timedelta(days=43))
)
with pytest.raises(TypeError):
assert TimestampType(2009, 2, 13, 23, 31, 0) - StringType("30s")
assert TimestampType(2009, 2, 13, 23, 32, 0) - DurationType("30s") == ts_1
assert ts_1.getDate() == IntType(13)
assert ts_1.getDate("+00:00") == IntType(13)
with pytest.raises(ValueError):
assert ts_1.getDate("+no:pe") == IntType(13)
assert ts_1.getDayOfMonth() == IntType(12)
assert ts_1.getDayOfWeek() == IntType(5)
assert ts_1.getDayOfYear() == IntType(43)
assert ts_1.getMonth() == IntType(1)
assert ts_1.getFullYear() == IntType(2009)
assert ts_1.getHours() == IntType(23)
assert ts_1.getMilliseconds() == IntType(0)
assert ts_1.getMinutes() == IntType(31)
assert ts_1.getSeconds() == IntType(30)
def test_timestamp_type_issue_28():
utc = TimestampType('2020-10-20T12:00:00Z')
not_utc = TimestampType('2020-10-20T12:00:00-05:00')
assert repr(utc) == "TimestampType('2020-10-20T12:00:00Z')"
assert repr(not_utc) == "TimestampType('2020-10-20T12:00:00-05:00')"
assert utc != not_utc
assert str(utc) != str(not_utc)
def test_extended_timestamp_type():
others = {
'et': 'US/Eastern',
}
TimestampType.TZ_ALIASES.update(others)
ts_1 = TimestampType("2009-02-13T23:31:30Z")
assert ts_1.getHours("UTC") == 23
assert ts_1.getHours("EST") == IntType(18)
assert ts_1.getHours("et") == IntType(18)
# assert ts_1.getHours("EDT") == IntType(18) # Appears unsupported in some linux distros
def test_duration_type():
d_1_dt = DurationType(datetime.timedelta(seconds=43200))
d_1_tuple = DurationType(IntType(43200), IntType(0))
d_1 = DurationType("43200s")
assert d_1 == d_1_dt
assert d_1 == d_1_tuple
with pytest.raises(ValueError):
DurationType(datetime.timedelta(seconds=315576000001))
with pytest.raises(ValueError):
DurationType("not:a:duration")
with pytest.raises(ValueError):
DurationType("315576000001s")
with pytest.raises(ValueError):
DurationType(IntType(315576000001))
with pytest.raises(TypeError):
DurationType({"Some": "JSON"})
assert repr(d_1) == "DurationType('43200s')"
assert str(d_1) == "43200s"
assert d_1 + d_1 == DurationType(IntType(86400))
assert d_1 + TimestampType(2009, 2, 13, 11, 31, 30) == TimestampType("2009-02-13T23:31:30Z")
assert DurationType("8454s").getHours() == IntType(2)
assert DurationType("8454s").getMinutes() == IntType(140)
assert DurationType("8454s").getSeconds() == IntType(8454)
assert DurationType("8454s").getMilliseconds() == IntType(8454000)
# See https://github.com/google/cel-spec/issues/138
assert DurationType("+2m30s").getSeconds() == IntType(150)
assert DurationType("-2m30s").getSeconds() == IntType(-150)
with pytest.raises(ValueError):
DurationType("-2w30z")
def test_function_type():
f_1 = FunctionType()
with pytest.raises(NotImplementedError):
f_1(IntType(0))
def test_int32_value():
"""This should be refactored into a protobuf module."""
x = Int32Value(42)
assert x == IntType(42)
y = Int32Value(IntType(0))
assert y == IntType(0)
def test_type_type():
t_2 = TypeType("IntType")
t_3 = TypeType("not_a_type")
t_4 = TypeType(DoubleType(3.14159))
assert t_2 == t_2
assert t_2 == t_3
assert t_2 != t_4
assert TypeType(DoubleType) is TypeType
def test_message_type():
mt_1 = MessageType({"name": IntType(42)})
assert mt_1["name"] == IntType(42)
mt_2 = MessageType(value=IntType(42))
assert mt_2["value"] == IntType(42)
with pytest.raises(TypeError):
MessageType("not", "good")
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_parser.py | tests/test_parser.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Test Parser Features
- Identifiers
- Literals
- Aggregates
TODO: Test *all* production rules separately here.
TODO: Create a better, more useful tree-walker than the Tree.pretty() to examine the resulting AST.
"""
from textwrap import dedent
from lark import Tree
from pytest import * # type: ignore[import]
from celpy.celparser import CELParseError, CELParser, DumpAST, tree_dump
@fixture
def parser():
return CELParser()
def test_terminal_ident(parser):
tree_xyzzy = parser.parse("xyzzy")
pretty = tree_xyzzy.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
ident\txyzzy
"""
)
def test_terminal_int_lit(parser):
tree_int_1 = parser.parse("42")
pretty = tree_int_1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t42
"""
)
tree_int_2 = parser.parse("0x2a")
pretty = tree_int_2.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t0x2a
"""
)
def test_terminal_uint_lit(parser):
tree_42u = parser.parse("42u")
pretty = tree_42u.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t42u
"""
)
def test_terminal_float_lit(parser):
tree_float_1 = parser.parse("2.71828")
pretty = tree_float_1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t2.71828
"""
)
tree_float_2 = parser.parse("1E6")
pretty = tree_float_2.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t1E6
"""
)
tree_float_3 = parser.parse("7.")
pretty = tree_float_3.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t7.
"""
)
def test_terminal_string(parser):
"""
See https://github.com/google/cel-spec/blob/master/doc/langdef.md#string-and-bytes-values
for additional test cases.
"""
tree_string_1 = parser.parse('"Hello, World!"')
pretty = tree_string_1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t"Hello, World!"
"""
)
tree_string_2 = parser.parse("'Hello, World!'")
pretty = tree_string_2.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t'Hello, World!'
"""
)
tree_string_esc1 = parser.parse(r'"Hello, World!\n"')
pretty = tree_string_esc1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t"Hello, World!\\n"
"""
)
tree_string_esc2 = parser.parse(r'"\x2aHello, World\x2a"')
pretty = tree_string_esc2.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t"\\x2aHello, World\\x2a"
"""
)
tree_string_esc3 = parser.parse(r'"\u002aHello, World\u002a"')
pretty = tree_string_esc3.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t"\\u002aHello, World\\u002a"
"""
)
def test_terminal_ml_string(parser):
tree_string_1 = parser.parse('"""Hello, World!\n\nLine 2"""')
pretty = tree_string_1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\t\"\"\"Hello, World!\n \n Line 2\"\"\"
"""
)
def test_terminal_bytes(parser):
tree_bytes_1 = parser.parse(r'b"\x42\x42\x42"')
pretty = tree_bytes_1.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\tb"\\x42\\x42\\x42"
"""
)
def test_terminal_bool_null_lit(parser):
tree_true = parser.parse("true")
pretty = tree_true.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\ttrue
"""
)
tree_false = parser.parse("false")
pretty = tree_false.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\tfalse
"""
)
tree_null = parser.parse("null")
pretty = tree_null.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
literal\tnull
"""
)
def test_comment(parser):
# identifier, bytes, could be confused with b"bytes": both begin with b.
tree_bytes = parser.parse("// example terminal\nbytes")
pretty = tree_bytes.pretty()
assert pretty == dedent(
"""\
expr
conditionalor
conditionaland
relation
addition
multiplication
unary
member
primary
ident\tbytes
"""
)
def test_aggregate(parser):
"""
https://github.com/google/cel-spec/blob/master/doc/langdef.md#aggregate-values
"""
tree_list = parser.parse("[1, 1, 2, 3]")
pretty = tree_list.pretty()
assert "exprlist" in pretty
assert "literal\t1" in pretty
assert "literal\t2" in pretty
assert "literal\t3" in pretty
map_list = parser.parse("{1: 'one', 2: 'two'}")
pretty = map_list.pretty()
assert "mapinits" in pretty
assert "literal\t1" in pretty
assert "literal 'one'" in pretty
assert "literal\t2" in pretty
assert "literal\t'two'" in pretty
field_list = parser.parse("message{field1: 'one', field2: 2}")
pretty = field_list.pretty()
assert "fieldinits" in pretty
assert "field1" in pretty
assert "literal\t'one'" in pretty
assert "field2" in pretty
assert "literal\t2" in pretty
def test_error_text(parser):
"""GIVEN text; WHEN syntax error; THEN results reflect the source"""
with raises(CELParseError) as exc_info:
parser.parse("nope*()/-+")
assert exc_info.value.line == 1
assert exc_info.value.column == 7
lines = parser.error_text(
exc_info.value.args[0], exc_info.value.line, exc_info.value.column
)
assert lines.splitlines() == [
"ERROR: <input>:1:7 nope*()/-+",
' ^',
'',
' | nope*()/-+',
" | ......^",
]
def test_dump_ast(parser):
"""
GIVEN parsed AST; WHEN dump; THEN results reflect the source.
"""
ast = parser.parse("-(3*4+5-1/2%3==1)?name[index]:f(1,2)||false&&true")
assert (
DumpAST.display(ast)
== "- (3 * 4 + 5 - 1 / 2 % 3 == 1) ? name[index] : f(1, 2) || false && true"
)
ast2 = parser.parse(
'!true in [1<2, 1<=2, 2>1, 2>=1, 3==3, 4!=1, size(x), now(), {"pi": 3.14}]'
)
assert (
DumpAST.display(ast2) == (
'! true in [1 < 2, 1 <= 2, 2 > 1, 2 >= 1, 3 == 3, 4 != 1, '
'size(x), now(), {"pi": 3.14}]'
)
)
ast3 = parser.parse(
".name.name / .name() + .name(42) * name.name - name.one(1) % name.zero()"
)
assert (
DumpAST.display(ast3)
== ".name.name / .name() + .name(42) * name.name - name.one(1) % name.zero()"
)
ast4 = parser.parse("message{field: 1, field: 2} || message{}")
assert DumpAST.display(ast4) == "message{field: 1, field: 2} || message{}"
ast5 = parser.parse("{}.a")
assert DumpAST.display(ast5) == "{}.a"
# An odd degenerate case
ast6 = parser.parse("[].min()")
assert DumpAST.display(ast6) == ".min()"
def test_dump_issue_35():
cel = "[]"
tree = CELParser().parse(cel)
assert DumpAST.display(tree) == ""
def test_tree_dump(parser):
ast = parser.parse("-(3*4+5-1/2%3==1)?name[index]:f(1,2)||false&&true")
assert tree_dump(ast) == '- (3 * 4 + 5 - 1 / 2 % 3 == 1) ? name[index] : f(1, 2) || false && true'
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | false |
cloud-custodian/cel-python | https://github.com/cloud-custodian/cel-python/blob/3a134c10394058c73a6bbe0e4ca7e862ea9707b3/tests/test_evaluation.py | tests/test_evaluation.py | # SPDX-Copyright: Copyright (c) Capital One Services, LLC
# SPDX-License-Identifier: Apache-2.0
# Copyright 2020 Capital One Services, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
"""
Test all the evaluation methods.
A large number of tests exercise :py:meth:`Evaluator.evaluate`.
The approach used here may not be ideal from a unit testing perspective.
This approach tends to test the superclass :py:meth:`lark.visitors.Interpreter.visit`,
which involves re-testing a fair amount of Lark code.
The alternative is to test methods in detail. For example,
using :py:meth:`Evaluator.expr` directly with a :py:class:`lark.Tree` object and
a patch for :py:meth:`Evaluator.visit_children` to emit answers directly.
For member, primary, and literal, we take this approach of invoking the
visitor method directly.
"""
from unittest.mock import Mock, call, sentinel
import os
import lark
import pytest
# IMPORTANT: Enables the `@trace` decorator.
# Must be set prior to import.
os.environ["CEL_TRACE"] = "true"
import celpy.evaluation # Expose the name for monkeypatching
from celpy import celparser, celtypes
from celpy.evaluation import *
def test_exception_syntax_error():
with pytest.raises(CELSyntaxError) as exc_info_1:
raise CELSyntaxError(sentinel.syntax_message, sentinel.syntax_line, sentinel.syntax_col)
assert exc_info_1.value.args == (sentinel.syntax_message,)
assert exc_info_1.value.line == sentinel.syntax_line
assert exc_info_1.value.column == sentinel.syntax_col
def test_exception_unsupported_error():
with pytest.raises(CELUnsupportedError) as exc_info_2:
raise CELUnsupportedError(sentinel.unsup_message, sentinel.unsup_line, sentinel.unsup_col)
assert exc_info_2.value.args == (sentinel.unsup_message,)
assert exc_info_2.value.line == sentinel.unsup_line
assert exc_info_2.value.column == sentinel.unsup_col
def test_exception_eval_error():
mock_tree = Mock(
meta=Mock(
line=sentinel.src_line,
column=sentinel.src_col,
),
data=sentinel.data,
children=[],
)
with pytest.raises(CELEvalError) as exc_info_3:
raise CELEvalError(sentinel.eval_message, tree=mock_tree)
assert exc_info_3.value.args == (sentinel.eval_message,)
assert exc_info_3.value.line == sentinel.src_line
assert exc_info_3.value.column == sentinel.src_col
mock_token = Mock(
value=sentinel.token,
line=sentinel.src_line,
column=sentinel.src_col,
)
with pytest.raises(CELEvalError) as exc_info_4:
raise CELEvalError(sentinel.eval_message, token=mock_token)
assert exc_info_4.value.args == (sentinel.eval_message,)
assert exc_info_4.value.line == sentinel.src_line
assert exc_info_4.value.column == sentinel.src_col
ex = exc_info_4.value
assert -ex == ex
assert ex + 1 == ex
assert ex - 1 == ex
assert ex * 1 == ex
assert ex / 1 == ex
assert ex // 1 == ex
assert ex % 1 == ex
assert ex ** 1 == ex
assert 1 + ex == ex
assert 1 - ex == ex
assert 1 * ex == ex
assert 1 / ex == ex
assert 1 // ex == ex
assert 1 % ex == ex
assert 1 ** ex == ex
assert not 1 == ex
assert not ex == 1
assert ex() == ex
def test_eval_error_decorator():
@eval_error(sentinel.eval_message, TypeError)
def mock_operation(a, b):
if a == sentinel.TypeError:
raise TypeError(sentinel.type_error_message)
elif a == sentinel.OtherError:
raise ValueError(sentinel.value_error_message)
else:
return sentinel.A_OP_B
result_1 = mock_operation(sentinel.TypeError, sentinel.VALUE)
assert isinstance(result_1, CELEvalError)
assert result_1.args == (sentinel.eval_message, TypeError, (sentinel.type_error_message,))
assert result_1.__cause__.__class__ == TypeError
with pytest.raises(ValueError) as exc_info:
result_2 = mock_operation(sentinel.OtherError, sentinel.VALUE)
assert not isinstance(exc_info.value, CELEvalError)
assert exc_info.value.args == (sentinel.value_error_message,)
result_3 = mock_operation(sentinel.A, sentinel.B)
assert result_3 == sentinel.A_OP_B
def test_boolean_decorator():
@boolean
def mock_operation(a, b):
if a == sentinel.not_implemented:
return NotImplemented
else:
return a
result_1 = mock_operation(True, sentinel.b)
assert result_1 == celtypes.BoolType(True)
result_2 = mock_operation(False, sentinel.b)
assert result_2 == celtypes.BoolType(False)
result_3 = mock_operation(sentinel.not_implemented, sentinel.b)
assert result_3 == NotImplemented
def test_operator_in():
"""
Was a separate function.
Revised with 0.4.0 release to be method of String,Type ListType, and MapType.
"""
container_1 = celtypes.ListType([
celtypes.IntType(42),
celtypes.IntType(6),
celtypes.IntType(7),
])
assert operator_in(celtypes.IntType(42), container_1)
assert not operator_in(celtypes.IntType(-1), container_1)
container_2 = celtypes.ListType([
celtypes.IntType(42),
celtypes.StringType("six"),
celtypes.IntType(7),
])
assert operator_in(celtypes.IntType(42), container_2)
assert isinstance(operator_in(celtypes.IntType(-1), container_2), CELEvalError)
@pytest.mark.skipif("re2" not in celpy.evaluation.function_matches.__globals__, reason="Not using RE2")
def test_function_matches_re2():
empty_string = celtypes.StringType("")
# re-specific patterns which behave differently than re2
assert function_matches(empty_string, "^\\z")
assert isinstance(function_matches(empty_string, "^\\Z"), CELEvalError)
@pytest.mark.skipif("re2" in celpy.evaluation.function_matches.__globals__, reason="Using RE2")
def test_function_matches_re():
empty_string = celtypes.StringType("")
# re2-specific patterns which behave differently than standard re
assert isinstance(function_matches(empty_string, "^\\z"), CELEvalError)
assert function_matches(empty_string, "^\\Z")
def test_function_matches():
empty_string = celtypes.StringType("")
assert function_matches(empty_string, "^$")
def test_function_size():
container_1 = celtypes.ListType([
celtypes.IntType(42),
celtypes.IntType(6),
celtypes.IntType(7),
])
assert function_size(container_1) == celtypes.IntType(3)
with pytest.raises(TypeError):
function_size(celtypes.DoubleType("3.14"))
assert function_size(None) == 0
def test_referent():
r_0 = Referent()
assert r_0.annotation is None
assert r_0.container is None
assert r_0.value is None
r_1 = Referent(celtypes.IntType)
assert r_1.annotation is celtypes.IntType
assert r_1.container is None
assert r_1.value is celtypes.IntType
assert r_0 != r_1
r_1.value = celtypes.IntType(42)
assert r_1.annotation is celtypes.IntType
assert r_1.container is None
assert r_1.value == celtypes.IntType(42)
nc = NameContainer()
r_1.container = nc
assert repr(r_1) == f"Referent(annotation={celtypes.IntType!r}, container={nc!r}, _value={celtypes.IntType(42)!r})"
assert r_1.annotation is celtypes.IntType
assert r_1.container is nc
assert r_1.value == nc # preferred over the assigned value.
r_c = r_1.clone()
assert r_c == r_1
assert r_c.container == r_1.container
assert r_c.value == r_1.value
def test_name_container():
"""See fields.feature acceptance test cases for more of these."""
nc = NameContainer()
nc.load_annotations({"a.b": celtypes.MapType, "a.b.c": celtypes.StringType})
nc.load_values(
{
"a.b": celtypes.MapType({"c": celtypes.StringType("oops")}),
"a.b.c": celtypes.StringType("yeah"),
}
)
assert nc.find_name([]).value == nc
assert nc.find_name(["a","b","c"]).value == celtypes.StringType("yeah")
member_dot = nc.resolve_name("", "a").container.resolve_name("", "b").container.resolve_name("", "c")
assert member_dot.value == celtypes.StringType("yeah")
nc2 = NameContainer()
nc2.load_values({"answer": celtypes.IntType(42)})
with pytest.raises(TypeError):
nc2.find_name(["answer", "nope"]).value
def test_name_container_init():
nc = NameContainer("a", celtypes.MapType)
assert nc["a"] == celtypes.MapType
def test_name_container_errors():
nc = NameContainer("a", celtypes.MapType)
assert nc["a"] == celtypes.MapType
with pytest.raises(ValueError):
nc.load_annotations({"123 456": celtypes.MapType})
with pytest.raises(ValueError):
nc.load_values({"123 456": celtypes.StringType("Invalid")})
def test_activation_no_package_no_vars():
a = Activation()
with pytest.raises(KeyError):
a.resolve_variable("x")
assert a.identifiers == {}
a_n = a.nested_activation(
annotations={"x": celtypes.IntType},
vars={"x": celtypes.IntType(42)})
assert a_n.resolve_variable("x") == celtypes.IntType(42)
def test_activation_annotation_no_vars():
a = Activation(annotations={"answer": celtypes.IntType})
with pytest.raises(KeyError) as exc_info:
print(f"Found {a.undefined=}")
assert exc_info.value.args == ("undefined",)
def test_activation_jq_package_vars():
"""
This test pushes the envelope a on what CEL should be able to do.
The package construct is *intended* to support protobuf packages, not JSON objects.
"""
a = Activation(
annotations={"jq": celtypes.MapType},
package="jq",
vars={
"jq": {celtypes.StringType("json"): celtypes.StringType("document")}
}
)
# The JQ-like ``.json`` expression is resolved inside the "jq" package.
assert a.resolve_variable(celtypes.StringType("json")) == celtypes.StringType("document")
# A nested activation (inside a macro, for example)
a_n = a.nested_activation(
annotations={"x": celtypes.IntType},
vars={"x": celtypes.IntType(42)}
)
assert a_n.resolve_variable("x") == celtypes.IntType(42)
# We should see globals (in the outer context)
assert a_n.resolve_variable(celtypes.StringType("json")) == celtypes.StringType("document")
def test_activation_activation():
b = Activation(
vars={
celtypes.StringType("param"): celtypes.DoubleType(42.0)
}
)
c = b.clone()
assert c.resolve_variable(celtypes.StringType("param")) == celtypes.DoubleType(42.0)
def test_activation_dot_names():
a = Activation(
package='x',
vars={
'x.y': celtypes.DoubleType(42.0)
}
)
assert a.resolve_variable(celtypes.StringType("y")) == celtypes.DoubleType(42.0)
with pytest.raises(KeyError):
a.resolve_variable(celtypes.StringType("z"))
def test_activation_overlapping_dot_names():
a = Activation(
annotations={
'A.B': celtypes.DoubleType,
'A.C': celtypes.BoolType,
}
)
assert isinstance(a.resolve_variable("A"), NameContainer)
print(f'{a.resolve_variable("A")!r}')
assert a.resolve_variable("A")["B"].value == celtypes.DoubleType
assert a.resolve_variable("A")["C"].value == celtypes.BoolType
def test_activation_multi_package_name():
a = Activation(
annotations={
'A.B.a': celtypes.DoubleType,
'A.B.C.a': celtypes.BoolType,
'A.B.C': celtypes.IntType, # This is ambiguous and is ignored when finding "a".
},
package="A.B.C"
)
assert a.resolve_variable("a") == celtypes.BoolType
def test_activation_bad_dot_name_syntax():
with pytest.raises(ValueError):
a = Activation(
package='x',
vars={
'x.y+z': celtypes.DoubleType(42.0)
}
)
@pytest.fixture
def mock_tree():
tree = Mock(
name='mock_tree',
data='ident',
children=[
Mock(value=sentinel.ident)
]
)
return tree
def test_trace_decorator(mock_tree):
class Mock_Eval:
def __init__(self):
self.logger = Mock()
self.level = 1
@trace
def method(self, tree):
return sentinel.result
e = Mock_Eval()
result = e.method(mock_tree)
assert result == sentinel.result
assert e.logger.debug.mock_calls == [
call('%s%r', '| ', mock_tree),
call('%s%s -> %r', '| ', 'ident', sentinel.result)
]
def test_set_activation():
tree = lark.Tree(data="literal", children=[])
activation = Activation(
vars={
'name': sentinel.value
}
)
e_0 = Evaluator(tree, activation)
assert e_0.ident_value('name') == sentinel.value
assert e_0.ident_value('int') == celtypes.IntType
e_1 = Evaluator(ast=e_0.tree, activation=e_0.activation)
e_1.set_activation(
{'name': sentinel.local_value}
)
assert e_1.ident_value('name') == sentinel.local_value
assert e_1.ident_value('int') == celtypes.IntType
assert e_0.ident_value('name') == sentinel.value
assert e_0.ident_value('int') == celtypes.IntType
def test_function_eval_0(monkeypatch):
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation, resolve_function=Mock(side_effect=KeyError))
evaluator = Evaluator(
tree,
activation
)
unknown_function_result = evaluator.function_eval(lark.Token("IDENT", "nope"))
print(f"{unknown_function_result=}")
assert isinstance(unknown_function_result, CELEvalError)
def test_function_eval_1(monkeypatch):
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation, resolve_function=Mock(return_value=function_size))
evaluator = Evaluator(
tree,
activation
)
error = CELEvalError(sentinel.message)
function_of_error_result = evaluator.function_eval(lark.Token("IDENT", "size"), error)
print(f"{function_of_error_result=}")
assert function_of_error_result == error
def test_function_eval_2(monkeypatch):
mock_size = Mock(side_effect=ValueError(sentinel.value))
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation,
resolve_function=Mock(return_value=mock_size))
evaluator = Evaluator(
tree,
activation
)
value = evaluator.function_eval(lark.Token("IDENT", "size"))
assert isinstance(value, CELEvalError)
assert value.args[1] == ValueError, f"{value.args} != (..., ValueError, ...)"
assert value.args[2] == (sentinel.value,), f"{value.args} != (..., ..., (sentinel.value,))"
def test_function_eval_3(monkeypatch):
mock_size = Mock(side_effect=TypeError(sentinel.type))
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation,
resolve_function=Mock(return_value=mock_size))
evaluator = Evaluator(
tree,
activation
)
value = evaluator.function_eval(lark.Token("IDENT", "size"))
assert isinstance(value, CELEvalError)
assert value.args[1] == TypeError, f"{value.args} != (..., TypeError, ...)"
assert value.args[2] == (sentinel.type,), f"{value.args} != (..., ..., (sentinel.type,))"
def test_method_eval_0(monkeypatch):
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation, functions=sentinel.FUNCTIONS, resolve_function=Mock(side_effect=KeyError))
evaluator = Evaluator(
tree,
activation
)
unknown_method_result = evaluator.method_eval(None, lark.Token("IDENT", "nope"))
print(f"{unknown_method_result=}")
assert isinstance(unknown_method_result, CELEvalError)
def test_method_eval_1(monkeypatch):
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation, resolve_function=Mock(return_value=function_size))
evaluator = Evaluator(
tree,
activation
)
error = CELEvalError(sentinel.message)
assert evaluator.method_eval(error, lark.Token("IDENT", "size"), None) == error
assert evaluator.method_eval(None, lark.Token("IDENT", "size"), error) == error
def test_method_eval_2(monkeypatch):
mock_function = Mock(side_effect=ValueError(sentinel.value))
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation,
resolve_function=Mock(return_value=mock_function))
evaluator = Evaluator(
tree,
activation
)
value = evaluator.method_eval(None, lark.Token("IDENT", "size"))
assert isinstance(value, CELEvalError)
assert value.args[1] == ValueError, f"{value.args} != (..., ValueError, ...)"
assert value.args[2] == (sentinel.value,), f"{value.args} != (..., ..., (sentinel.value,))"
def test_method_eval_3(monkeypatch):
mock_function = Mock(side_effect=TypeError(sentinel.type))
tree = lark.Tree(
data="primary",
children=[]
)
activation = Mock(spec=Activation,
resolve_function=Mock(return_value=mock_function))
evaluator = Evaluator(
tree,
activation
)
value = evaluator.method_eval(None, lark.Token("IDENT", "size"))
assert isinstance(value, CELEvalError)
assert value.args[1] == TypeError, f"{value.args} != (..., TypeError, ...)"
assert value.args[2] == (sentinel.type,), f"{value.args} != (..., ..., (sentinel.type,))"
def test_macro_has_eval(monkeypatch):
visit_children = Mock(
return_value=[sentinel.values]
)
monkeypatch.setattr(Evaluator, 'visit_children', visit_children)
tree = lark.Tree(
data="exprlist",
children=[],
meta=Mock(line=1, column=1)
)
evaluator_0 = Evaluator(
tree,
activation=Mock()
)
assert evaluator_0.macro_has_eval(sentinel.exprlist) == celpy.celtypes.BoolType(True)
# Many of the following tests all use :py:meth:`Evaluator.evaluate`.
# These will involve evaluating visit_children to evaluate "literal"
# :py:class:`lark.Tree` objects.
def test_eval_expr_1():
"""
::
expr : conditionalor ["?" conditionalor ":" expr]
"""
tree = lark.Tree(
data='expr',
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_="INT_LIT", value="42"),
]
),
]
)
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
assert evaluator.evaluate() == celtypes.IntType(42)
@pytest.fixture
def mock_left_expr_tree():
tree = lark.Tree(
data='expr',
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_="BOOL_LIT", value="true"),
]
),
lark.Tree(
data='literal',
children=[
lark.Token(type_="INT_LIT", value="6"),
]
),
sentinel.DO_NOT_EVALUATE # Test will crash if this is evaluated
],
meta=Mock(line=1, column=1)
)
return tree
def test_eval_expr_3_left_good(mock_left_expr_tree):
"""Assert ``true ? 6 : invalid`` does not execute the invalid expression."""
activation = Mock(resolve_function=Mock(return_value=celpy.celtypes.logical_condition))
evaluator = Evaluator(
mock_left_expr_tree,
activation
)
assert evaluator.evaluate() == celtypes.IntType(6)
# assert did not crash; therefore, invalid node not touched
def test_eval_expr_3_bad_override(mock_left_expr_tree):
def bad_condition(a, b, c):
raise TypeError
activation = Mock(resolve_function=Mock(return_value=bad_condition))
evaluator = Evaluator(
mock_left_expr_tree,
activation,
)
with pytest.raises(celpy.evaluation.CELEvalError) as exc_info:
evaluator.evaluate()
assert exc_info.value.args == ("found no matching overload for _?_:_ applied to '(<class 'celpy.celtypes.BoolType'>, <class 'celpy.celtypes.IntType'>, <class 'celpy.celtypes.BoolType'>)'", TypeError, ())
def test_eval_expr_3_bad_cond_value(mock_left_expr_tree):
def bad_condition(a, b, c):
raise celpy.evaluation.CELEvalError("Baseline Error")
activation = Mock(resolve_function=Mock(return_value=bad_condition))
evaluator = Evaluator(
mock_left_expr_tree,
activation,
)
with pytest.raises(celpy.evaluation.CELEvalError) as exc_info:
evaluator.evaluate()
print(repr(exc_info.value.args))
assert exc_info.value.args == ('Baseline Error',)
@pytest.fixture
def mock_right_expr_tree():
tree = lark.Tree(
data='expr',
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_="BOOL_LIT", value="false"),
]
),
sentinel.DO_NOT_EVALUATE, # Test will crash if this is evaluated
lark.Tree(
data='literal',
children=[
lark.Token(type_="INT_LIT", value="7"),
]
),
],
meta=Mock(line=1, column=1)
)
return tree
def test_eval_expr_3_right_good(mock_right_expr_tree):
"""Assert ``false ? invalid : 7`` does not execute the invalid expression."""
activation = Mock(resolve_function=Mock(return_value=celtypes.logical_condition))
evaluator = Evaluator(
mock_right_expr_tree,
activation
)
assert evaluator.evaluate() == celtypes.IntType(7)
# assert did not crash; therefore, invalid node not touched
def test_eval_expr_0():
tree = lark.Tree(
data='expr',
children=[],
meta=Mock(line=1, column=1)
)
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
with pytest.raises(celpy.evaluation.CELSyntaxError):
evaluator.evaluate()
def binop_1_tree(data, lit_type, lit_value):
tree = lark.Tree(
data=data,
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=lit_value),
]
),
]
)
return tree
def test_eval_conditionalor_1():
tree = binop_1_tree("conditionalor", "INT_LIT", "42")
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
assert evaluator.evaluate() == celtypes.IntType(42)
def binop_2_tree(data, lit_type, lit_value_1, lit_value_2):
tree = lark.Tree(
data=data,
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=lit_value_1),
]
),
lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=lit_value_2),
]
),
],
meta=Mock(line=1, column=1)
)
return tree
def test_eval_conditionalor_2_good():
tree = binop_2_tree("conditionalor", "BOOL_LIT", "false", "true")
activation = Mock(resolve_function=Mock(return_value=celtypes.logical_or))
evaluator = Evaluator(
tree,
activation
)
assert evaluator.evaluate() == celtypes.BoolType(True)
def test_eval_conditionalor_2_bad_override():
def bad_logical_or(a, b):
raise TypeError
tree = binop_2_tree("conditionalor", "BOOL_LIT", "false", "true")
activation = Mock(resolve_function=Mock(return_value=bad_logical_or))
evaluator = Evaluator(
tree,
activation,
# functions={"_||_": bad_logical_or}
)
with pytest.raises(celpy.evaluation.CELEvalError):
evaluator.evaluate()
def binop_broken_tree(data):
tree = lark.Tree(
data=data,
children=[],
meta=Mock(line=1, column=1)
)
return tree
def test_eval_conditionalor_0():
tree = binop_broken_tree("conditionalor")
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
with pytest.raises(celpy.evaluation.CELSyntaxError):
evaluator.evaluate()
def test_eval_conditionaland_1():
tree = binop_1_tree("conditionaland", "INT_LIT", "42")
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
assert evaluator.evaluate() == celtypes.IntType(42)
def test_eval_conditionaland_2_good():
tree = binop_2_tree("conditionaland", "BOOL_LIT", "false", "true")
activation = Mock(resolve_function=Mock(return_value=celtypes.logical_and))
evaluator = Evaluator(
tree,
activation
)
assert evaluator.evaluate() == celtypes.BoolType(False)
def test_eval_conditionaland_2_bad_override():
def bad_logical_and(a, b):
raise TypeError
tree = binop_2_tree("conditionaland", "BOOL_LIT", "false", "true")
activation = Mock(resolve_function=Mock(return_value=bad_logical_and))
evaluator = Evaluator(
tree,
activation,
)
with pytest.raises(celpy.evaluation.CELEvalError):
evaluator.evaluate()
def test_eval_conditionaland_0():
tree = binop_broken_tree("conditionaland")
activation = Mock()
evaluator = Evaluator(
tree,
activation
)
with pytest.raises(celpy.evaluation.CELSyntaxError):
evaluator.evaluate()
# This is used to generate a number of similar binop_trees fixture values
# parent_tree_data, tree_data, lit_type, lit_value_1, lit_value_2, expected, function
binary_operator_params = [
("relation", "relation_lt", "INT_LIT", "6", "7", celtypes.BoolType(True), "_<_"),
("relation", "relation_le", "INT_LIT", "6", "7", celtypes.BoolType(True), "_<=_"),
("relation", "relation_gt", "INT_LIT", "6", "7", celtypes.BoolType(False), "_>_"),
("relation", "relation_ge", "INT_LIT", "6", "7", celtypes.BoolType(False), "_>=_"),
("relation", "relation_eq", "INT_LIT", "42", "42", celtypes.BoolType(True), "_==_"),
("relation", "relation_ne", "INT_LIT", "42", "42", celtypes.BoolType(False), "_!=_"),
("relation", "relation_in",
"STRING_LIT", "b", ["a", "b", "c"], celtypes.BoolType(True), "_in_"),
("addition", "addition_add", "INT_LIT", "40", "2", celtypes.IntType(42), "_+_"),
("addition", "addition_sub", "INT_LIT", "44", "2", celtypes.IntType(42), "_-_"),
("addition", "addition_add", "INT_LIT", "9223372036854775807", "1", CELEvalError, "_+_"),
("multiplication", "multiplication_mul", "INT_LIT", "6", "7", celtypes.IntType(42), "_*_"),
("multiplication", "multiplication_div", "INT_LIT", "84", "2", celtypes.IntType(42), "_/_"),
("multiplication", "multiplication_mod", "INT_LIT", "85", "43", celtypes.IntType(42), "_%_"),
("multiplication", "multiplication_mul",
"INT_LIT", "9223372036854775807", "2", CELEvalError, "_*_"),
("multiplication", "multiplication_div", "INT_LIT", "84", "0", CELEvalError, "_/_"),
]
@pytest.fixture(params=binary_operator_params, ids=lambda f: f[6])
def binop_trees(request):
"""Creates three binary operator trees:
- t_0 is the broken tree with no children.
This can be tested to be sure it raises a syntax error.
These should not occur normally, but the exception is provided as a debugging aid.
- t_1 is the degenerate tree with no operator and a single operand.
In the long run, an optimizer should remove these nodes.
The value is always 42.
- t_2 is the tree with two operands. The right-hand operand may be an expression list.
The expected values can be a simple value or the CELEvalError type. A test will generally
check the ``t_2`` tree against the expected value. It can also check the tree against the
exception.
The function name is used to exercise the ``t_2`` tree with a bad function binding that
raises an expected TypeError.
"""
parent_tree_data, tree_data, lit_type, lit_value_1, lit_value_2, expected, function = request.param
# Broken tree.
t_0 = lark.Tree(
data=parent_tree_data,
children=[],
meta=Mock(line=1, column=1)
)
# No operand tree.
t_1 = binop_1_tree(parent_tree_data, "INT_LIT", "42")
# A two-operand treee with either a simple or complex right-hand-side.
if isinstance(lit_value_2, list):
right_hand_side = lark.Tree(
data='exprlist',
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=expr)
]
)
for expr in lit_value_2
]
)
else:
right_hand_side = lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=lit_value_2),
]
)
t_2 = lark.Tree(
data=parent_tree_data,
children=[
lark.Tree(
data=tree_data,
children=[
lark.Tree(
data='literal',
children=[
lark.Token(type_=lit_type, value=lit_value_1),
]
),
lark.Token(type_="relop", value="not used"),
]
),
right_hand_side
],
meta=Mock(line=1, column=1)
)
return t_0, t_1, t_2, expected, function
def test_binops(binop_trees):
"""
The binop_trees fixture provides three trees, an expected value, and a function name
to provide an override for.
"""
t_0, t_1, t_2, expected, function = binop_trees
activation = Mock(resolve_function=Mock(return_value=base_functions[function]))
evaluator_0 = Evaluator(
t_0,
activation
)
with pytest.raises(celpy.evaluation.CELSyntaxError):
evaluator_0.evaluate()
evaluator_1 = Evaluator(
t_1,
activation
)
assert evaluator_1.evaluate() == celtypes.IntType(42)
evaluator_2_g = Evaluator(
t_2,
activation
)
if isinstance(expected, type):
with pytest.raises(expected):
evaluator_2_g.evaluate()
else:
assert evaluator_2_g.evaluate() == expected
def bad_function(a, b):
raise TypeError
activation = Mock(resolve_function=Mock(return_value=bad_function))
evaluator_2_b = Evaluator(
t_2,
activation,
)
with pytest.raises(celpy.evaluation.CELEvalError):
evaluator_2_b.evaluate()
# This is used to generate a number of similar unop_trees fixture values
# parent_tree_data, tree_data, lit_type, lit_value, ignored, expected, function
unary_operator_params = [
("unary", "unary_not", "BOOL_LIT", "true", None, celtypes.BoolType(False), "!_"),
("unary", "unary_neg", "INT_LIT", "42", None, celtypes.IntType(-42), "-_"),
("unary", "unary_neg", "INT_LIT", "-9223372036854775808", None, CELEvalError, "-_"),
]
@pytest.fixture(params=unary_operator_params, ids=lambda f: f[6])
def unop_trees(request):
"""Creates three unary operator trees:
- t_0 is the broken tree with no children.
This can be tested to be sure it raises a syntax error.
These should not occur normally, but the exception is provided as a debugging aid.
- t_1 is the degenerate tree with no operator and a single operand.
In the long run, an optimizer should remove these nodes.
The value is always 42.
- t_2 is the tree with operator and operand.
The expected values can be a simple value or the CELEvalError type. A test will generally
check the ``t_2`` tree against the expected value. It can also check the tree against the
exception.
| python | Apache-2.0 | 3a134c10394058c73a6bbe0e4ca7e862ea9707b3 | 2026-01-05T07:13:01.631050Z | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.