Skip to content

Commit e9180a2

Browse files
committed
feat: remove root
BREAKING CHANGE: The Root class is gone and so is the root attribute on files Fixes #145
1 parent 09eb844 commit e9180a2

32 files changed

+196
-254
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ its python counterpart. This means that all the builtin operations defined on th
4343
import nbtlib
4444

4545
nbt_file = nbtlib.load('bigtest.nbt')
46-
assert nbt_file.root['intTest'] == 2147483647
46+
assert nbt_file['intTest'] == 2147483647
4747
```
4848

4949
For example, instances of `nbtlib.File` inherit from regular `Compound` tags, which themselves inherit from the builtin python dictionary `dict`. Similarly, instances of `Int` tags inherit from the builtin class `int`.
@@ -61,7 +61,7 @@ import nbtlib
6161
from nbtlib.tag import Int
6262

6363
with nbtlib.load('demo.nbt') as demo:
64-
demo.root['counter'] = Int(demo.root['counter'] + 1)
64+
demo['counter'] = Int(demo['counter'] + 1)
6565
```
6666

6767
You can also call the `save` method manually.
@@ -71,7 +71,7 @@ import nbtlib
7171
from nbtlib.tag import Int
7272

7373
demo = nbtlib.load('demo.nbt')
74-
demo.root['counter'] = Int(demo.root['counter'] + 1)
74+
demo['counter'] = Int(demo['counter'] + 1)
7575
demo.save()
7676
```
7777

0 commit comments

Comments
 (0)