dissect.cim 3.11.dev2__tar.gz → 3.12.dev1__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 (37) hide show
  1. dissect_cim-3.12.dev1/.gitattributes +1 -0
  2. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/PKG-INFO +3 -2
  3. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/cim.py +5 -6
  4. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/classes.py +24 -0
  5. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect.cim.egg-info/PKG-INFO +3 -2
  6. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect.cim.egg-info/SOURCES.txt +10 -8
  7. {dissect_cim-3.11.dev2/tests/docs → dissect_cim-3.12.dev1/tests/_docs}/Makefile +1 -1
  8. dissect_cim-3.12.dev1/tests/_docs/__init__.py +0 -0
  9. {dissect_cim-3.11.dev2/tests/docs → dissect_cim-3.12.dev1/tests/_docs}/conf.py +7 -0
  10. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/tests/conftest.py +3 -3
  11. dissect_cim-3.12.dev1/tests/test_cim.py +15 -0
  12. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/tox.ini +4 -4
  13. dissect_cim-3.11.dev2/tests/test_cim.py +0 -10
  14. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/.git-blame-ignore-revs +0 -0
  15. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/COPYRIGHT +0 -0
  16. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/LICENSE +0 -0
  17. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/MANIFEST.in +0 -0
  18. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/README.md +0 -0
  19. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/__init__.py +0 -0
  20. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/c_cim.py +0 -0
  21. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/exceptions.py +0 -0
  22. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/index.py +0 -0
  23. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/mappings.py +0 -0
  24. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/objects.py +0 -0
  25. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect/cim/utils.py +0 -0
  26. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect.cim.egg-info/dependency_links.txt +0 -0
  27. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect.cim.egg-info/requires.txt +0 -0
  28. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/dissect.cim.egg-info/top_level.txt +0 -0
  29. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/pyproject.toml +0 -0
  30. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/setup.cfg +0 -0
  31. {dissect_cim-3.11.dev2 → dissect_cim-3.12.dev1}/tests/__init__.py +0 -0
  32. {dissect_cim-3.11.dev2/tests/data → dissect_cim-3.12.dev1/tests/_data}/INDEX.BTR.gz +0 -0
  33. {dissect_cim-3.11.dev2/tests/data → dissect_cim-3.12.dev1/tests/_data}/MAPPING1.MAP.gz +0 -0
  34. {dissect_cim-3.11.dev2/tests/data → dissect_cim-3.12.dev1/tests/_data}/MAPPING2.MAP.gz +0 -0
  35. {dissect_cim-3.11.dev2/tests/data → dissect_cim-3.12.dev1/tests/_data}/MAPPING3.MAP.gz +0 -0
  36. {dissect_cim-3.11.dev2/tests/data → dissect_cim-3.12.dev1/tests/_data}/OBJECTS.DATA.gz +0 -0
  37. {dissect_cim-3.11.dev2/tests/docs → dissect_cim-3.12.dev1/tests/_docs}/index.rst +0 -0
@@ -0,0 +1 @@
1
+ tests/_data/** filter=lfs diff=lfs merge=lfs -text
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dissect.cim
3
- Version: 3.11.dev2
3
+ Version: 3.12.dev1
4
4
  Summary: A Dissect module implementing a parser for the Windows Common Information Model (CIM) database, used in the Windows operating system
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -27,6 +27,7 @@ Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: dev
28
28
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
29
29
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
30
+ Dynamic: license-file
30
31
 
31
32
  # dissect.cim
32
33
 
@@ -22,6 +22,7 @@ from dissect.cim.classes import (
22
22
  ClassDefinition,
23
23
  ClassDefinitionProperty,
24
24
  ClassInstance,
25
+ ClassInstanceProperty,
25
26
  InstanceKey,
26
27
  PropertyDefaultValues,
27
28
  Qualifier,
@@ -302,12 +303,6 @@ class Instance:
302
303
  self.class_definition = class_.class_definition
303
304
  self.class_instance = class_instance
304
305
 
305
- def __getattr__(self, attr: str) -> Any:
306
- try:
307
- return getattr(self.class_instance, attr)
308
- except AttributeError:
309
- return object.__getattribute__(self, attr)
310
-
311
306
  @property
312
307
  def key(self) -> InstanceKey:
313
308
  return self.class_instance.key
@@ -328,6 +323,10 @@ class Instance:
328
323
  def ci(self) -> ClassInstance:
329
324
  return self.class_instance
330
325
 
326
+ @property
327
+ def properties(self) -> dict[str, ClassInstanceProperty]:
328
+ return self.class_instance.properties
329
+
331
330
 
332
331
  class Property:
333
332
  def __init__(self, class_: Class, prop: ClassDefinitionProperty):
@@ -331,6 +331,18 @@ class ClassInstance:
331
331
 
332
332
 
333
333
  class InstanceKey(dict):
334
+ """A dictionary subclass that allows for attribute-style access and assignment.
335
+
336
+ Is represented as a string in the format "key1=value1;key2=value2" or "default" if empty.
337
+
338
+ Example:
339
+
340
+ >>> d = InstanceKey()
341
+ >>> d.foo = "bar"
342
+ >>> d.foo
343
+ "bar"
344
+ """
345
+
334
346
  def __getattr__(self, key: str) -> Any:
335
347
  return self[key]
336
348
 
@@ -412,6 +424,18 @@ class DataRegion:
412
424
  if t in (CIM_TYPES.STRING, CIM_TYPES.REFERENCE, CIM_TYPES.DATETIME):
413
425
  return self.get_string(value)
414
426
 
427
+ if t in (
428
+ CIM_TYPES.INT8,
429
+ CIM_TYPES.UINT8,
430
+ CIM_TYPES.INT16,
431
+ CIM_TYPES.UINT16,
432
+ CIM_TYPES.INT32,
433
+ CIM_TYPES.UINT32,
434
+ CIM_TYPES.INT64,
435
+ CIM_TYPES.UINT64,
436
+ ):
437
+ return value
438
+
415
439
  if t == CIM_TYPES.BOOLEAN:
416
440
  return value == BOOLEAN_STATES.TRUE
417
441
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: dissect.cim
3
- Version: 3.11.dev2
3
+ Version: 3.12.dev1
4
4
  Summary: A Dissect module implementing a parser for the Windows Common Information Model (CIM) database, used in the Windows operating system
5
5
  Author-email: Dissect Team <dissect@fox-it.com>
6
6
  License: Affero General Public License v3
@@ -27,6 +27,7 @@ Requires-Dist: dissect.util<4,>=3
27
27
  Provides-Extra: dev
28
28
  Requires-Dist: dissect.cstruct<5.0.dev,>=4.0.dev; extra == "dev"
29
29
  Requires-Dist: dissect.util<4.0.dev,>=3.0.dev; extra == "dev"
30
+ Dynamic: license-file
30
31
 
31
32
  # dissect.cim
32
33
 
@@ -1,4 +1,5 @@
1
1
  .git-blame-ignore-revs
2
+ .gitattributes
2
3
  COPYRIGHT
3
4
  LICENSE
4
5
  MANIFEST.in
@@ -22,11 +23,12 @@ dissect/cim/utils.py
22
23
  tests/__init__.py
23
24
  tests/conftest.py
24
25
  tests/test_cim.py
25
- tests/data/INDEX.BTR.gz
26
- tests/data/MAPPING1.MAP.gz
27
- tests/data/MAPPING2.MAP.gz
28
- tests/data/MAPPING3.MAP.gz
29
- tests/data/OBJECTS.DATA.gz
30
- tests/docs/Makefile
31
- tests/docs/conf.py
32
- tests/docs/index.rst
26
+ tests/_data/INDEX.BTR.gz
27
+ tests/_data/MAPPING1.MAP.gz
28
+ tests/_data/MAPPING2.MAP.gz
29
+ tests/_data/MAPPING3.MAP.gz
30
+ tests/_data/OBJECTS.DATA.gz
31
+ tests/_docs/Makefile
32
+ tests/_docs/__init__.py
33
+ tests/_docs/conf.py
34
+ tests/_docs/index.rst
@@ -3,7 +3,7 @@
3
3
 
4
4
  # You can set these variables from the command line, and also
5
5
  # from the environment for the first two.
6
- SPHINXOPTS ?= -jauto
6
+ SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning
7
7
  SPHINXBUILD ?= sphinx-build
8
8
  SOURCEDIR = .
9
9
  BUILDDIR = build
File without changes
@@ -1,3 +1,5 @@
1
+ project = "dissect.cim"
2
+
1
3
  extensions = [
2
4
  "autoapi.extension",
3
5
  "sphinx.ext.autodoc",
@@ -32,3 +34,8 @@ autodoc_typehints = "signature"
32
34
  autodoc_member_order = "groupwise"
33
35
 
34
36
  autosectionlabel_prefix_document = True
37
+
38
+ suppress_warnings = [
39
+ # https://github.com/readthedocs/sphinx-autoapi/issues/285
40
+ "autoapi.python_import_resolution",
41
+ ]
@@ -21,14 +21,14 @@ def open_file_gz(name: str, mode: str = "rb") -> Iterator[gzip.GzipFile]:
21
21
 
22
22
  @pytest.fixture
23
23
  def index_bin() -> Iterator[BinaryIO]:
24
- yield from open_file_gz("data/INDEX.BTR.gz")
24
+ yield from open_file_gz("_data/INDEX.BTR.gz")
25
25
 
26
26
 
27
27
  @pytest.fixture
28
28
  def objects_bin() -> Iterator[BinaryIO]:
29
- yield from open_file_gz("data/OBJECTS.DATA.gz")
29
+ yield from open_file_gz("_data/OBJECTS.DATA.gz")
30
30
 
31
31
 
32
32
  @pytest.fixture
33
33
  def mappings_bin() -> Iterator[list[BinaryIO]]:
34
- yield from zip(*[open_file_gz(f"data/MAPPING{i}.MAP.gz") for i in range(1, 4)])
34
+ yield from zip(*[open_file_gz(f"_data/MAPPING{i}.MAP.gz") for i in range(1, 4)])
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import BinaryIO
4
+
5
+ from dissect.cim.cim import CIM
6
+
7
+
8
+ def test_cim(index_bin: BinaryIO, objects_bin: BinaryIO, mappings_bin: list[BinaryIO]) -> None:
9
+ repo = CIM(index_bin, objects_bin, mappings_bin)
10
+ assert repo
11
+
12
+ subscription_ns = repo.root.namespace("subscription")
13
+ binding = next(subscription_ns.class_("__filtertoconsumerbinding").instances)
14
+ consumer = subscription_ns.query(binding.properties["Consumer"].value)
15
+ assert consumer.properties["SourceName"].value == "Service Control Manager"
@@ -62,12 +62,12 @@ deps =
62
62
  sphinx-design
63
63
  furo
64
64
  commands =
65
- make -C tests/docs clean
66
- make -C tests/docs html
65
+ make -C tests/_docs clean
66
+ make -C tests/_docs html
67
67
 
68
68
  [testenv:docs-linkcheck]
69
69
  allowlist_externals = make
70
70
  deps = {[testenv:docs-build]deps}
71
71
  commands =
72
- make -C tests/docs clean
73
- make -C tests/docs linkcheck
72
+ make -C tests/_docs clean
73
+ make -C tests/_docs linkcheck
@@ -1,10 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import BinaryIO
4
-
5
- from dissect.cim.cim import CIM
6
-
7
-
8
- def test_cim(index_bin: BinaryIO, objects_bin: BinaryIO, mappings_bin: list[BinaryIO]) -> None:
9
- repo = CIM(index_bin, objects_bin, mappings_bin)
10
- assert repo
File without changes