pw_tokenizer: Fix _DatabasePath.__init__()

_DatabasePath.__init__() would previously fail to extract the domain if
passed a Path() object instead of a str. This issue was originally
discovered when attempting to add the #metrics domain for loading
tokenized metrics.

This commit updates test_token_domains() to expose this bug, and applies
the necessary fix.

_DatabasePath.__init__() now handles all possible _PathOrFile arguments
correctly.

Additional clean-up suggested in:
Bug: b/265334753

Change-Id: Ibced5abe15be4f9d4755e94dec5fe260ea6bbd87
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126462
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
2 files changed
tree: fb0947ad7897876f8f41d2a3eaadb9286debf27d
  1. .allstar/
  2. .vscode/
  3. build_overrides/
  4. docker/
  5. docs/
  6. pw_allocator/
  7. pw_analog/
  8. pw_android_toolchain/
  9. pw_arduino_build/
  10. pw_assert/
  11. pw_assert_basic/
  12. pw_assert_log/
  13. pw_assert_tokenized/
  14. pw_assert_zephyr/
  15. pw_async/
  16. pw_base64/
  17. pw_bloat/
  18. pw_blob_store/
  19. pw_bluetooth/
  20. pw_bluetooth_hci/
  21. pw_boot/
  22. pw_boot_cortex_m/
  23. pw_build/
  24. pw_build_info/
  25. pw_build_mcuxpresso/
  26. pw_bytes/
  27. pw_checksum/
  28. pw_chrono/
  29. pw_chrono_embos/
  30. pw_chrono_freertos/
  31. pw_chrono_stl/
  32. pw_chrono_threadx/
  33. pw_chrono_zephyr/
  34. pw_cli/
  35. pw_compilation_testing/
  36. pw_console/
  37. pw_containers/
  38. pw_cpu_exception/
  39. pw_cpu_exception_cortex_m/
  40. pw_crypto/
  41. pw_digital_io/
  42. pw_docgen/
  43. pw_doctor/
  44. pw_env_setup/
  45. pw_file/
  46. pw_function/
  47. pw_fuzzer/
  48. pw_hdlc/
  49. pw_hex_dump/
  50. pw_i2c/
  51. pw_i2c_mcuxpresso/
  52. pw_ide/
  53. pw_interrupt/
  54. pw_interrupt_cortex_m/
  55. pw_interrupt_zephyr/
  56. pw_intrusive_ptr/
  57. pw_kvs/
  58. pw_libc/
  59. pw_log/
  60. pw_log_android/
  61. pw_log_basic/
  62. pw_log_null/
  63. pw_log_rpc/
  64. pw_log_string/
  65. pw_log_tokenized/
  66. pw_log_zephyr/
  67. pw_malloc/
  68. pw_malloc_freelist/
  69. pw_metric/
  70. pw_minimal_cpp_stdlib/
  71. pw_module/
  72. pw_multisink/
  73. pw_package/
  74. pw_perf_test/
  75. pw_persistent_ram/
  76. pw_polyfill/
  77. pw_preprocessor/
  78. pw_presubmit/
  79. pw_protobuf/
  80. pw_protobuf_compiler/
  81. pw_random/
  82. pw_result/
  83. pw_ring_buffer/
  84. pw_router/
  85. pw_rpc/
  86. pw_rust/
  87. pw_snapshot/
  88. pw_software_update/
  89. pw_span/
  90. pw_spi/
  91. pw_status/
  92. pw_stm32cube_build/
  93. pw_stream/
  94. pw_string/
  95. pw_symbolizer/
  96. pw_sync/
  97. pw_sync_baremetal/
  98. pw_sync_embos/
  99. pw_sync_freertos/
  100. pw_sync_stl/
  101. pw_sync_threadx/
  102. pw_sync_zephyr/
  103. pw_sys_io/
  104. pw_sys_io_arduino/
  105. pw_sys_io_baremetal_lm3s6965evb/
  106. pw_sys_io_baremetal_stm32f429/
  107. pw_sys_io_emcraft_sf2/
  108. pw_sys_io_mcuxpresso/
  109. pw_sys_io_pico/
  110. pw_sys_io_stdio/
  111. pw_sys_io_stm32cube/
  112. pw_sys_io_zephyr/
  113. pw_system/
  114. pw_target_runner/
  115. pw_thread/
  116. pw_thread_embos/
  117. pw_thread_freertos/
  118. pw_thread_stl/
  119. pw_thread_threadx/
  120. pw_tls_client/
  121. pw_tls_client_boringssl/
  122. pw_tls_client_mbedtls/
  123. pw_tokenizer/
  124. pw_tool/
  125. pw_toolchain/
  126. pw_trace/
  127. pw_trace_tokenized/
  128. pw_transfer/
  129. pw_unit_test/
  130. pw_varint/
  131. pw_watch/
  132. pw_web/
  133. pw_work_queue/
  134. seed/
  135. targets/
  136. third_party/
  137. ts/
  138. zephyr/
  139. .bazelignore
  140. .bazelrc
  141. .clang-format
  142. .clang-tidy
  143. .eslintrc.json
  144. .git-blame-ignore-revs
  145. .gitattributes
  146. .gitignore
  147. .gn
  148. .mypy.ini
  149. .prettierrc.js
  150. .pw_ide.yaml
  151. .pylintrc
  152. activate.bat
  153. Android.bp
  154. AUTHORS
  155. bootstrap.bat
  156. bootstrap.sh
  157. BUILD.bazel
  158. BUILD.gn
  159. BUILDCONFIG.gn
  160. CMakeLists.txt
  161. jest.config.ts
  162. Kconfig.zephyr
  163. LICENSE
  164. modules.gni
  165. OWNERS
  166. package-lock.json
  167. package.json
  168. PIGWEED_MODULES
  169. PW_PLUGINS
  170. pyproject.toml
  171. README.md
  172. rollup.config.js
  173. tsconfig.json
  174. WORKSPACE
README.md

Pigweed

Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.

For more information please see our website: https://pigweed.dev/.

Links