beet-observer 0.7.1__tar.gz → 0.7.2__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: beet-observer
3
- Version: 0.7.1
3
+ Version: 0.7.2
4
4
  Summary: A beet plugin to automatically generate overlays from previous datapacks
5
5
  License: MIT
6
6
  Author: BPR02
@@ -1,3 +1,3 @@
1
- __version__ = "0.7.1"
1
+ __version__ = "0.7.2"
2
2
 
3
3
  from .plugin import *
@@ -10,10 +10,11 @@ def gen_dp_overlays(
10
10
  """
11
11
  Generates overlays between two datapacks.
12
12
 
13
- Keyword arguments:</br>
14
- `ctx` -- the build context</br>
15
- `ctx_overlay` -- the overlay context</br>
16
- `overlay_dir` -- the directory of the overlay</br>
13
+ Keyword arguments: \n
14
+ `ctx` -- the build context \n
15
+ `ctx_overlay` -- the overlay context \n
16
+ `overlay_dir` -- the directory of the overlay \n
17
+ `ignore` -- a list of overlays to ignore (existing overlays that should not be touched) \n
17
18
  """
18
19
  # create list of all datapack file types
19
20
  file_types: list[tuple[NamespaceProxy[Any], NamespaceProxy[Any]]] = [
@@ -108,7 +109,7 @@ def gen_dp_overlays(
108
109
  ]
109
110
  # for each file type, check for required overlays
110
111
  for registry, registry_overlay in file_types:
111
- check_registry(ctx, ctx_overlay, overlay_dir, registry, registry_overlay)
112
+ check_registry(ctx, overlay_dir, registry, registry_overlay)
112
113
 
113
114
  # get pack.mcmeta overlay entries
114
115
  mcmeta: dict[str, dict[str, list[dict[str, Any]]]] = ctx.data.mcmeta.data.copy()
@@ -156,7 +157,6 @@ def gen_dp_overlays(
156
157
 
157
158
  def check_registry(
158
159
  ctx: Context,
159
- ctx_overlay: Context,
160
160
  overlay_dir: str,
161
161
  registry: NamespaceProxy[Any],
162
162
  registry_overlay: NamespaceProxy[Any],
@@ -164,12 +164,11 @@ def check_registry(
164
164
  """
165
165
  Generates overlays for each namespace proxy.
166
166
 
167
- Keyword arguments:</br>
168
- `ctx` -- the build context</br>
169
- `ctx_overlay` -- the overlay context</br>
170
- `overlay_dir` -- the directory of the overlay</br>
171
- `registry` -- the namespace proxy from the build context</br>
172
- `registry_overlay` -- the namespace proxy from the overlay context</br>
167
+ Keyword arguments: \n
168
+ `ctx` -- the build context \n
169
+ `overlay_dir` -- the directory of the overlay \n
170
+ `registry` -- the namespace proxy from the build context \n
171
+ `registry_overlay` -- the namespace proxy from the overlay context \n
173
172
  """
174
173
  # check each file in the build pack
175
174
  for name in list(registry):
@@ -198,15 +197,15 @@ def gen_registry_overlay(
198
197
  type: str = "",
199
198
  ) -> None:
200
199
  """
201
- Checks if two functions have the same contents and generate an overlay if they don't.
202
-
203
- Keyword arguments:</br>
204
- `ctx` -- the build context</br>
205
- `overlay_dir` -- the directory of the generated overlay</br>
206
- `name` -- the name of the file</br>
207
- `registry` -- the namespace proxy from the build context</br>
208
- `registry_overlay` -- the namespace proxy from the overlay context</br>
209
- `type` -- either "deletion" or "addition" (default: `""`)</br>
200
+ Checks if two files have the same contents and generate an overlay if they don't.
201
+
202
+ Keyword arguments: \n
203
+ `ctx` -- the build context \n
204
+ `overlay_dir` -- the directory of the generated overlay \n
205
+ `name` -- the name of the file \n
206
+ `registry` -- the namespace proxy from the build context \n
207
+ `registry_overlay` -- the namespace proxy from the overlay context \n
208
+ `type`(optional) -- either "deletion" or "addition" (default: `""`) \n
210
209
  """
211
210
  if type == "deletion":
212
211
  # move file from build pack to overlay in build pack
@@ -1,14 +1,14 @@
1
1
  from beet import Context, run_beet
2
2
 
3
- from .data_pack import *
4
- from .resource_pack import *
3
+ from .data_pack import gen_dp_overlays
4
+ from .resource_pack import gen_rp_overlays
5
5
 
6
6
 
7
7
  def beet_default(ctx: Context):
8
8
  if "observer" not in ctx.meta:
9
9
  return
10
10
 
11
- # # check cache
11
+ # check cache
12
12
  cache = ctx.cache["observer"]
13
13
  cached_dp = False
14
14
  cached_rp = False
@@ -45,9 +45,12 @@ def beet_default(ctx: Context):
45
45
  "rp"
46
46
  ]
47
47
  # save current overlays
48
- save: list[str] = []
48
+ save_dp: list[str] = []
49
+ save_rp: list[str] = []
49
50
  for overlay in ctx.data.overlays:
50
- save.append(overlay)
51
+ save_dp.append(overlay)
52
+ for overlay in ctx.assets.overlays:
53
+ save_rp.append(overlay)
51
54
  # loop through all overlays
52
55
  for overlay in ctx.meta["observer"]["overlays"]:
53
56
  # get pack
@@ -67,9 +70,9 @@ def beet_default(ctx: Context):
67
70
  rp_dir = overlay["directory"]
68
71
  # compare build pack and overlay pack
69
72
  if not cached_dp and ctx.data:
70
- gen_dp_overlays(ctx, ctx_overlay, dp_dir, save)
73
+ gen_dp_overlays(ctx, ctx_overlay, dp_dir, save_dp)
71
74
  if not cached_rp and ctx.assets:
72
- gen_rp_overlays(ctx, ctx_overlay, rp_dir, save)
75
+ gen_rp_overlays(ctx, ctx_overlay, rp_dir, save_rp)
73
76
 
74
77
  # save to cache
75
78
  if not cached_dp and ctx.data:
@@ -9,10 +9,11 @@ def gen_rp_overlays(
9
9
  """
10
10
  Generates overlays between two resource packs.
11
11
 
12
- Keyword arguments:</br>
13
- `ctx` -- the build context</br>
14
- `ctx_overlay` -- the overlay context</br>
15
- `overlay_dir` -- the directory of the overlay</br>
12
+ Keyword arguments: \n
13
+ `ctx` -- the build context \n
14
+ `ctx_overlay` -- the overlay context \n
15
+ `overlay_dir` -- the directory of the overlay \n
16
+ `ignore` -- a list of overlays to ignore (existing overlays that should not be touched) \n
16
17
  """
17
18
  # create list of all resource pack file types
18
19
  file_types: list[tuple[NamespaceProxy[Any], NamespaceProxy[Any]]] = [
@@ -36,7 +37,7 @@ def gen_rp_overlays(
36
37
  ]
37
38
  # for each file type, check for required overlays
38
39
  for registry, registry_overlay in file_types:
39
- check_registry(ctx, ctx_overlay, overlay_dir, registry, registry_overlay)
40
+ check_registry(ctx, overlay_dir, registry, registry_overlay)
40
41
 
41
42
  # get pack.mcmeta overlay entries
42
43
  mcmeta: dict[str, dict[str, list[dict[str, Any]]]] = ctx.assets.mcmeta.data.copy()
@@ -84,7 +85,6 @@ def gen_rp_overlays(
84
85
 
85
86
  def check_registry(
86
87
  ctx: Context,
87
- ctx_overlay: Context,
88
88
  overlay_dir: str,
89
89
  registry: NamespaceProxy[Any],
90
90
  registry_overlay: NamespaceProxy[Any],
@@ -92,12 +92,11 @@ def check_registry(
92
92
  """
93
93
  Generates overlays for each namespace proxy.
94
94
 
95
- Keyword arguments:</br>
96
- `ctx` -- the build context</br>
97
- `ctx_overlay` -- the overlay context</br>
98
- `overlay_dir` -- the directory of the overlay</br>
99
- `registry` -- the namespace proxy from the build context</br>
100
- `registry_overlay` -- the namespace proxy from the overlay context</br>
95
+ Keyword arguments: \n
96
+ `ctx` -- the build context \n
97
+ `overlay_dir` -- the directory of the overlay \n
98
+ `registry` -- the namespace proxy from the build context \n
99
+ `registry_overlay` -- the namespace proxy from the overlay context \n
101
100
  """
102
101
  # check each file in the build pack
103
102
  for name in list(registry):
@@ -126,15 +125,15 @@ def gen_registry_overlay(
126
125
  type: str = "",
127
126
  ) -> None:
128
127
  """
129
- Checks if two functions have the same contents and generate an overlay if they don't.
130
-
131
- Keyword arguments:</br>
132
- `ctx` -- the build context</br>
133
- `overlay_dir` -- the directory of the generated overlay</br>
134
- `name` -- the name of the file</br>
135
- `registry` -- the namespace proxy from the build context</br>
136
- `registry_overlay` -- the namespace proxy from the overlay context</br>
137
- `type` -- either "deletion" or "addition" (default: `""`)</br>
128
+ Checks if two files have the same contents and generate an overlay if they don't.
129
+
130
+ Keyword arguments: \n
131
+ `ctx` -- the build context \n
132
+ `overlay_dir` -- the directory of the generated overlay \n
133
+ `name` -- the name of the file \n
134
+ `registry` -- the namespace proxy from the build context \n
135
+ `registry_overlay` -- the namespace proxy from the overlay context \n
136
+ `type`(optional) -- either "deletion" or "addition" (default: `""`) \n
138
137
  """
139
138
  if type == "deletion":
140
139
  # move file from build pack to overlay in build pack
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "beet-observer"
3
- version = "0.7.1"
3
+ version = "0.7.2"
4
4
  description = "A beet plugin to automatically generate overlays from previous datapacks"
5
5
  authors = ["BPR02 <dev@bpr02.com>"]
6
6
  license = "MIT"
@@ -36,8 +36,8 @@ profile = "black"
36
36
  typeCheckingMode = "strict"
37
37
 
38
38
  [tool.poe.tasks]
39
- format = {shell = "isort beet_observer & black beet_observer"}
40
- check = {shell = "isort --check-only beet_observer & black --check beet_observer"}
39
+ format = {shell = "isort beet_observer & black beet_observer & pyright"}
40
+ check = {shell = "isort --check-only beet_observer & black --check beet_observer & pyright"}
41
41
  typing = {shell = "pyright"}
42
42
 
43
43
  [build-system]
File without changes
File without changes