python-fitparse 2.1.7__tar.gz → 2.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-fitparse
3
- Version: 2.1.7
3
+ Version: 2.2.0
4
4
  Summary: Python library to parse ANT/Garmin .FIT files
5
5
  Project-URL: Homepage, https://github.com/nbr23/python-fitparse
6
6
  Project-URL: Repository, https://github.com/nbr23/python-fitparse
@@ -1,7 +1,7 @@
1
1
  # ***************** BEGIN AUTOMATICALLY GENERATED FIT PROFILE ******************
2
2
  # *************************** DO NOT EDIT THIS FILE ****************************
3
- # *********** EXPORTED PROFILE FROM SDK VERSION 21.205 ON 2026-05-20 ***********
4
- # ********* PARSED 201 TYPES (4399 VALUES), 124 MESSAGES (1411 FIELDS) *********
3
+ # *********** EXPORTED PROFILE FROM SDK VERSION 21.205 ON 2026-06-02 ***********
4
+ # ********* PARSED 201 TYPES (4399 VALUES), 124 MESSAGES (1412 FIELDS) *********
5
5
 
6
6
  from fitparse.records import (
7
7
  ComponentField,
@@ -11848,6 +11848,12 @@ MESSAGE_TYPES = {
11848
11848
  def_num=1,
11849
11849
  units='s',
11850
11850
  ),
11851
+ 3: Field( # Undocumented Garmin Body Battery level (0-100)
11852
+ name='body_battery',
11853
+ type=BASE_TYPES[0x01], # sint8
11854
+ def_num=3,
11855
+ units='percent',
11856
+ ),
11851
11857
  },
11852
11858
  ),
11853
11859
  229: MessageType(
@@ -0,0 +1,25 @@
1
+ # patches/message_types/stress_level.py
2
+ import sys
3
+ import os
4
+ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'scripts'))
5
+ from generate_profile import MessageInfo, FieldInfo
6
+
7
+ MESSAGE_INFO = MessageInfo(
8
+ name='stress_level',
9
+ num=227,
10
+ group_name='',
11
+ fields=[
12
+ FieldInfo(
13
+ name='body_battery',
14
+ type='sint8',
15
+ num=3,
16
+ scale=None,
17
+ offset=None,
18
+ units='percent',
19
+ components=[],
20
+ subfields=[],
21
+ comment='Undocumented Garmin Body Battery level (0-100)'
22
+ ),
23
+ ],
24
+ comment=''
25
+ )
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "python-fitparse"
7
- version = "2.1.7"
7
+ version = "2.2.0"
8
8
  description = "Python library to parse ANT/Garmin .FIT files"
9
9
  authors = [
10
10
  {name = "David Cooper", email = "dave@kupesoft.com"},
@@ -318,6 +318,12 @@ class ReferenceFieldInfo(namedtuple('ReferenceFieldInfo', ('name', 'value', 'num
318
318
  return s
319
319
 
320
320
 
321
+ def normalize_def_num(num):
322
+ if isinstance(num, str):
323
+ return int(num, 16)
324
+ return num
325
+
326
+
321
327
  def render_comment(comment):
322
328
  if comment:
323
329
  return ' # %s' % comment
@@ -662,7 +668,13 @@ def apply_patches(type_list, message_list):
662
668
  message_list.messages.append(patch_message_info)
663
669
  print(f" Added message type: {patch_message_info.name} (num: {patch_num})")
664
670
  else:
665
- print(f" Skipped message type: {patch_message_info.name} (num: {patch_num}, already exists in generated profile)")
671
+ existing_nums = {normalize_def_num(f.num) for f in existing_message.fields}
672
+ for patch_field in patch_message_info.fields:
673
+ if normalize_def_num(patch_field.num) in existing_nums:
674
+ print(f" Skipped field: {existing_message.name}.{patch_field.name} (def_num {patch_field.num} already defined)")
675
+ else:
676
+ existing_message.fields.append(patch_field)
677
+ print(f" Added field: {existing_message.name}.{patch_field.name} (def_num {patch_field.num})")
666
678
 
667
679
 
668
680
  def download_latest_sdk(path):
File without changes