forked from auracaster/bumble_mirror
Merge pull request #315 from google/gbg/company-ids
update to latest list of company ids
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -91,6 +91,7 @@ development =
|
|||||||
mypy == 1.5.0
|
mypy == 1.5.0
|
||||||
nox >= 2022
|
nox >= 2022
|
||||||
pylint == 2.15.8
|
pylint == 2.15.8
|
||||||
|
pyyaml >= 6.0
|
||||||
types-appdirs >= 1.4.3
|
types-appdirs >= 1.4.3
|
||||||
types-invoke >= 1.7.3
|
types-invoke >= 1.7.3
|
||||||
types-protobuf >= 4.21.0
|
types-protobuf >= 4.21.0
|
||||||
|
|||||||
@@ -14,25 +14,25 @@
|
|||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# This script generates a python-syntax list of dictionary entries for the
|
# 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/
|
# company IDs listed at:
|
||||||
# The input to this script is the CSV file that can be obtained at that URL
|
# 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
|
# Imports
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
import sys
|
import sys
|
||||||
import csv
|
import yaml
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
with open(sys.argv[1], newline='') as csvfile:
|
with open(sys.argv[1], "r") as yaml_file:
|
||||||
reader = csv.reader(csvfile, delimiter=',', quotechar='"')
|
root = yaml.safe_load(yaml_file)
|
||||||
lines = []
|
companies = {}
|
||||||
for row in reader:
|
for company in root["company_identifiers"]:
|
||||||
if len(row) == 3 and row[1].startswith('0x'):
|
companies[company["value"]] = company["name"]
|
||||||
company_id = row[1]
|
|
||||||
company_name = row[2]
|
|
||||||
escaped_company_name = company_name.replace('"', '\\"')
|
|
||||||
lines.append(f' {company_id}: "{escaped_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