uproot-custom 2.5.1__tar.gz → 2.5.2__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.
Files changed (84) hide show
  1. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.pre-commit-config.yaml +2 -2
  2. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/PKG-INFO +2 -2
  3. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/cpp/include/uproot-custom/uproot-custom.hh +25 -7
  4. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/pyproject.toml +3 -3
  5. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/_version.py +3 -3
  6. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.clang-format +0 -0
  7. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/release.yml +0 -0
  8. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/build-wheels.yml +0 -0
  9. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/deploy-docs.yml +0 -0
  10. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/python-publish.yml +0 -0
  11. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/semantic-pr-titles.yml +0 -0
  12. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/test-package.yml +0 -0
  13. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.github/workflows/weekly-build.yml +0 -0
  14. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/.gitignore +0 -0
  15. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/LICENSE +0 -0
  16. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/README.md +0 -0
  17. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/cpp/CMakeLists.txt +0 -0
  18. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/cpp/share/cmake/uproot-customConfig.cmake +0 -0
  19. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/cpp/src/uproot-custom.cc +0 -0
  20. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/Doxyfile +0 -0
  21. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/conf.py +0 -0
  22. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/example/override-streamer.md +0 -0
  23. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/example/read-tobjarray.md +0 -0
  24. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/get-started.md +0 -0
  25. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/index.md +0 -0
  26. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/api/.gitignore +0 -0
  27. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/api/cpp-api.md +0 -0
  28. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/api/uproot-custom-ref.md +0 -0
  29. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/api.md +0 -0
  30. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/binary-format.md +0 -0
  31. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/reader-backends.md +0 -0
  32. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/reference/version-requirements.md +0 -0
  33. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader/investigate-data.md +0 -0
  34. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader/pipeline.md +0 -0
  35. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader/port-to-cpp.md +0 -0
  36. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader/project-setup.md +0 -0
  37. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader/reader-and-factory.md +0 -0
  38. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/docs/tutorial/customize-factory-reader.md +0 -0
  39. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/conftest.py +0 -0
  40. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_cstyle_array.root +0 -0
  41. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_pointers.root +0 -0
  42. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_primitive.root +0 -0
  43. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_pure_struct.root +0 -0
  44. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_root_objects.root +0 -0
  45. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_simple_obj.root +0 -0
  46. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_array.root +0 -0
  47. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_complicated.root +0 -0
  48. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_map.root +0 -0
  49. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_map_with_obj.root +0 -0
  50. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_nested.root +0 -0
  51. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_seq_with_obj.root +0 -0
  52. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_sequence.root +0 -0
  53. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/data/test_stl_string.root +0 -0
  54. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/CMakeLists.txt +0 -0
  55. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/README.md +0 -0
  56. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/LinkDef.h +0 -0
  57. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TBasicTypes.hh +0 -0
  58. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TCStyleArray.hh +0 -0
  59. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TComplicatedSTL.hh +0 -0
  60. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TNestedSTL.hh +0 -0
  61. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TPointers.hh +0 -0
  62. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TPureStruct.hh +0 -0
  63. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TRootObjects.hh +0 -0
  64. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLArray.hh +0 -0
  65. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLMap.hh +0 -0
  66. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLMapWithObj.hh +0 -0
  67. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLSeqWithObj.hh +0 -0
  68. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLSequence.hh +0 -0
  69. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSTLString.hh +0 -0
  70. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/include/TSimpleObject.hh +0 -0
  71. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/gen-test-data/src/main.cc +0 -0
  72. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/test_AsCustom.py +0 -0
  73. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/tests/test_readers.py +0 -0
  74. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/__init__.py +0 -0
  75. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/as_custom.py +0 -0
  76. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/cpp.pyi +0 -0
  77. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/factories.py +0 -0
  78. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/readers/__init__.py +0 -0
  79. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/readers/_forth.py +0 -0
  80. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/readers/backend.py +0 -0
  81. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/readers/cpp.py +0 -0
  82. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/readers/python.py +0 -0
  83. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/share/cmake/__init__.py +0 -0
  84. {uproot_custom-2.5.1 → uproot_custom-2.5.2}/uproot_custom/utils.py +0 -0
@@ -23,12 +23,12 @@ repos:
23
23
  - id: trailing-whitespace
24
24
 
25
25
  - repo: https://github.com/psf/black-pre-commit-mirror
26
- rev: 26.5.1
26
+ rev: 26.10.1
27
27
  hooks:
28
28
  - id: black
29
29
 
30
30
  - repo: https://github.com/astral-sh/ruff-pre-commit
31
- rev: v0.16.6
31
+ rev: v0.17.3
32
32
  hooks:
33
33
  - id: ruff-check
34
34
  args: [--fix, --show-fixes]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: uproot-custom
3
- Version: 2.5.1
4
- Summary: uproot extension for reading custom classes
3
+ Version: 2.5.2
4
+ Summary: Uproot extension for reading custom classes
5
5
  Author-Email: Mingrun Li <mrli@ihep.ac.cn>
6
6
  Classifier: Development Status :: 3 - Alpha
7
7
  Classifier: Intended Audience :: Developers
@@ -104,7 +104,8 @@ namespace uproot_custom {
104
104
  , m_offsets( static_cast<uint32_t*>( offsets.request().ptr ) )
105
105
  , m_initial_cursor_offset( initial_cursor_position )
106
106
  , m_entries( offsets.request().size - 1 )
107
- , m_cursor( static_cast<uint8_t*>( data.request().ptr ) ) {}
107
+ , m_cursor( static_cast<uint8_t*>( data.request().ptr ) )
108
+ , m_debug_print( getenv( "UPROOT_CUSTOM_DEBUG" ) ) {}
108
109
 
109
110
  /**
110
111
  * @brief Read a value of type T from the stream, handling endianness.
@@ -313,7 +314,11 @@ namespace uproot_custom {
313
314
  *
314
315
  * @param n Number of bytes to print.
315
316
  */
316
- void debug_print( const size_t n = 100 ) const {
317
+ void debug_print( size_t n = 100 ) const {
318
+ if ( !m_debug_print ) return;
319
+
320
+ n = std::min( n, static_cast<size_t>( m_data + m_offsets[m_entries] - m_cursor ) );
321
+
317
322
  for ( size_t i = 0; i < n; i++ ) { std::cout << (int)*( m_cursor + i ) << " "; }
318
323
  std::cout << std::endl;
319
324
  }
@@ -325,6 +330,7 @@ namespace uproot_custom {
325
330
  const uint32_t* m_offsets; ///< entry offsets pointer
326
331
  const uint32_t m_initial_cursor_offset; ///< initial cursor position, used for
327
332
  ///< calculating relative offsets
333
+ const bool m_debug_print; ///< whether to print debug information
328
334
 
329
335
  std::map<uint32_t, Reference> m_refs; ///< offset -> reference, used for pointer
330
336
  ///< reading
@@ -347,6 +353,16 @@ namespace uproot_custom {
347
353
  class IReader {
348
354
  protected:
349
355
  const std::string m_name; ///< name of the reader
356
+ const bool m_debug_print; ///< whether to print debug information
357
+
358
+ template <typename... Args>
359
+ inline void debug_printf( const char* msg, Args... args ) const {
360
+ if ( m_debug_print ) printf( msg, args... );
361
+ }
362
+
363
+ inline void debug_printf( uproot_custom::BinaryStream& stream, const size_t n = 100 ) {
364
+ if ( m_debug_print ) stream.debug_print( n );
365
+ }
350
366
 
351
367
  public:
352
368
  /**
@@ -354,7 +370,8 @@ namespace uproot_custom {
354
370
  *
355
371
  * @param name Name of the reader.
356
372
  */
357
- IReader( std::string name ) : m_name( name ) {}
373
+ IReader( std::string name )
374
+ : m_name( name ), m_debug_print( getenv( "UPROOT_CUSTOM_DEBUG" ) ) {}
358
375
 
359
376
  virtual ~IReader() = default;
360
377
 
@@ -516,7 +533,10 @@ namespace uproot_custom {
516
533
 
517
534
  /**
518
535
  * @brief Debug print function. Prints only when environment variable with name
519
- * `UPROOT_CUSTOM_DEBUG` is defined. Use this function like `printf()`.
536
+ * `UPROOT_CUSTOM_DEBUG` is defined. Use this function like `printf()`. DO NOT
537
+ * use this function in `read()` methods of the reader, since it may significantly
538
+ * slow down the reading process due to frequently retrieving the environment
539
+ * variable.
520
540
  *
521
541
  * @tparam Args Argument types. No need to specify explicitly.
522
542
  * @param msg The format string.
@@ -537,9 +557,7 @@ namespace uproot_custom {
537
557
  * @param stream The BinaryStream to print.
538
558
  * @param n Number of bytes to print.
539
559
  */
540
- inline void debug_printf( uproot_custom::BinaryStream& stream, const size_t n = 100 ) {
541
- bool do_print = getenv( "UPROOT_CUSTOM_DEBUG" );
542
- if ( !do_print ) return;
560
+ inline void debug_printf( uproot_custom::BinaryStream& stream, size_t n = 100 ) {
543
561
  stream.debug_print( n );
544
562
  }
545
563
 
@@ -23,7 +23,7 @@ ipynb = ["ipykernel"]
23
23
  numba = ["numba", "black", "pytest-xdist"]
24
24
 
25
25
  [project]
26
- authors = [{name = "Mingrun Li", email = "mrli@ihep.ac.cn"}]
26
+ authors = [{ name = "Mingrun Li", email = "mrli@ihep.ac.cn" }]
27
27
  classifiers = [
28
28
  "Development Status :: 3 - Alpha",
29
29
  "Intended Audience :: Developers",
@@ -50,12 +50,12 @@ classifiers = [
50
50
  "Topic :: Utilities"
51
51
  ]
52
52
  dependencies = ["uproot>=5.6.7", "numpy", "awkward>=2.8.0"]
53
- description = "uproot extension for reading custom classes"
53
+ description = "Uproot extension for reading custom classes"
54
54
  dynamic = ["version"]
55
55
  name = "uproot-custom"
56
56
  readme = "README.md"
57
57
  requires-python = ">=3.9, <3.15"
58
- urls = {"Homepage" = "https://github.com/mrzimu/uproot-custom"}
58
+ urls = { "Homepage" = "https://github.com/mrzimu/uproot-custom" }
59
59
 
60
60
  [project.entry-points."cmake.root"]
61
61
  uproot-custom = "uproot_custom.share.cmake"
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.5.1'
22
- __version_tuple__ = version_tuple = (2, 5, 1)
21
+ __version__ = version = '2.5.2'
22
+ __version_tuple__ = version_tuple = (2, 5, 2)
23
23
 
24
- __commit_id__ = commit_id = 'g7360044a1'
24
+ __commit_id__ = commit_id = 'g3468fe281'
File without changes
File without changes
File without changes