mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
use the new yaml file instead of the previous CSV file
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -91,6 +91,7 @@ development =
|
||||
mypy == 1.5.0
|
||||
nox >= 2022
|
||||
pylint == 2.15.8
|
||||
pyyaml >= 6.0
|
||||
types-appdirs >= 1.4.3
|
||||
types-invoke >= 1.7.3
|
||||
types-protobuf >= 4.21.0
|
||||
|
||||
@@ -14,25 +14,26 @@
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# This script generates a python-syntax list of dictionary entries for the
|
||||
# company IDs listed at: https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers/
|
||||
# The input to this script is the CSV file that can be obtained at that URL
|
||||
# company IDs listed at:
|
||||
# https://bitbucket.org/bluetooth-SIG/public/src/main/assigned_numbers/company_identifiers/company_identifiers.yaml
|
||||
# The input to this script is the YAML file that can be obtained at that URL
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Imports
|
||||
# -----------------------------------------------------------------------------
|
||||
import sys
|
||||
import csv
|
||||
import yaml
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
with open(sys.argv[1], newline='') as csvfile:
|
||||
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
||||
lines = []
|
||||
for row in reader:
|
||||
if len(row) == 3 and row[1].startswith('0x'):
|
||||
company_id = row[1]
|
||||
company_name = row[2]
|
||||
escaped_company_name = company_name.replace('"', '\\"')
|
||||
lines.append(f' {company_id}: "{escaped_company_name}"')
|
||||
with open(sys.argv[1], "r") as yaml_file:
|
||||
root = yaml.safe_load(yaml_file)
|
||||
#print(root)
|
||||
companies = {}
|
||||
for company in root["company_identifiers"]:
|
||||
companies[company["value"]] = company["name"]
|
||||
|
||||
print(',\n'.join(reversed(lines)))
|
||||
for company_id in sorted(companies.keys()):
|
||||
company_name = companies[company_id]
|
||||
escaped_company_name = company_name.replace('"', '\\"')
|
||||
print(f' 0x{company_id:04X}: "{escaped_company_name}",')
|
||||
|
||||
Reference in New Issue
Block a user