vuer 0.0.17__py3-none-any.whl → 0.0.18__py3-none-any.whl

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.

Potentially problematic release.


This version of vuer might be problematic. Click here for more details.

Binary file
Binary file
@@ -118,29 +118,29 @@ class Facemesh(SceneElement):
118
118
  """Renders an oriented MediaPipe face mesh:
119
119
 
120
120
  :param points: An array of 468+ keypoints as returned by google/mediapipe tasks-vision. Defaults to a sample face.
121
- :type points: MediaPipePoints, optional
121
+ :type points: MediaPipePoints, optional
122
122
  :param face: An face object as returned by tensorflow/tfjs-models face-landmarks-detection. This parameter is deprecated.
123
- :type face: MediaPipeFaceMesh, optional
123
+ :type face: MediaPipeFaceMesh, optional
124
124
  :param width: Constant width of the mesh. Defaults to undefined.
125
- :type width: int, optional
125
+ :type width: int, optional
126
126
  :param height: Constant height of the mesh. Defaults to undefined.
127
- :type height: int, optional
127
+ :type height: int, optional
128
128
  :param depth: Constant depth of the mesh. Defaults to 1.
129
- :type depth: int, optional
129
+ :type depth: int, optional
130
130
  :param verticalTri: A landmarks tri supposed to be vertical. Defaults to [159, 386, 200]. See: https://github.com/tensorflow/tfjs-models/tree/master/face-landmarks-detection#mediapipe-facemesh-keypoints
131
- :type verticalTri: Tuple[int, int, int], optional
131
+ :type verticalTri: Tuple[int, int, int], optional
132
132
  :param origin: A landmark index (to get the position from) or a vec3 to be the origin of the mesh. Defaults to undefined (i.e., the bbox center).
133
- :type origin: Union[int, THREE.Vector3], optional
133
+ :type origin: Union[int, THREE.Vector3], optional
134
134
  :param facialTransformationMatrix: A facial transformation matrix, as returned by FaceLandmarkerResult.facialTransformationMatrixes. See: https://developers.google.com/mediapipe/solutions/vision/face_landmarker/web_js#handle_and_display_results
135
- :type facialTransformationMatrix: FacemeshDatas.SAMPLE_FACELANDMARKER_RESULT.facialTransformationMatrixes[0], optional
135
+ :type facialTransformationMatrix: FacemeshDatas.SAMPLE_FACELANDMARKER_RESULT.facialTransformationMatrixes[0], optional
136
136
  :param offset: Apply position offset extracted from `facialTransformationMatrix`.
137
- :type offset: bool, optional
137
+ :type offset: bool, optional
138
138
  :param offsetScalar: Offset sensitivity factor, less is more sensible.
139
- :type offsetScalar: float, optional
139
+ :type offsetScalar: float, optional
140
140
  :param faceBlendshapes: Face blendshapes, as returned by FaceLandmarkerResult.faceBlendshapes. See: https://developers.google.com/mediapipe/solutions/vision/face_landmarker/web_js#handle_and_display_results
141
- :type faceBlendshapes: FacemeshDatas.SAMPLE_FACELANDMARKER_RESULT.faceBlendshapes[0], optional
141
+ :type faceBlendshapes: FacemeshDatas.SAMPLE_FACELANDMARKER_RESULT.faceBlendshapes[0], optional
142
142
  :param eyes: Whether to enable eyes (note: `faceBlendshapes` is required for this). Defaults to True.
143
- :type eyes: bool, optional
143
+ :type eyes: bool, optional
144
144
 
145
145
  Usage::
146
146
 
@@ -30,6 +30,7 @@ class Element:
30
30
  def serialize(self):
31
31
  """
32
32
  Serialize the element to a dictionary for sending over the websocket.
33
+
33
34
  :return: Dictionary representing the element.
34
35
  """
35
36
 
@@ -39,6 +39,56 @@ class SceneElement(BlockElement):
39
39
 
40
40
 
41
41
  class Frustum(SceneElement):
42
+ """Camera Frustum
43
+
44
+ :param position: An optional tuple of three numbers representing the position.
45
+ :type position: tuple[float, float, float]
46
+ :param rotation: An optional tuple of three numbers representing the rotation.
47
+ :type rotation: tuple[float, float, float]
48
+ :param matrix: An optional tuple of sixteen numbers representing the matrix.
49
+ :type matrix: tuple[float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float]
50
+ :param aspect: An optional number representing the aspect.
51
+ :type aspect: float
52
+ :param focus: An optional number representing the focus.
53
+ :type focus: float
54
+ :param fov: An optional number representing the field of view.
55
+ :type fov: float
56
+ :param near: An optional number representing the near field.
57
+ :type near: float
58
+ :param far: An optional number representing the far field.
59
+ :type far: float
60
+ :param scale: An optional number representing the scale.
61
+ :type scale: float
62
+ :param upScale: An optional number representing the up scale.
63
+ :type upScale: float
64
+ :param focalLength: An optional number representing the focal length.
65
+ :type focalLength: float
66
+ :param showUp: An optional boolean indicating whether to show up.
67
+ :type showUp: bool
68
+ :param showFrustum: An optional boolean indicating whether to show the frustum.
69
+ :type showFrustum: bool
70
+ :param showFocalPlane: An optional boolean indicating whether to show the focal plane.
71
+ :type showFocalPlane: bool
72
+ :param showImagePlane: An optional boolean indicating whether to show the image plane.
73
+ :type showImagePlane: bool
74
+ :param src: An optional string representing the source.
75
+ :type src: str
76
+ :param colorOrigin: An optional ColorRepresentation for the origin color.
77
+ :type colorOrigin: ColorRepresentation
78
+ :param colorFrustum: An optional ColorRepresentation for the frustum color.
79
+ :type colorFrustum: ColorRepresentation
80
+ :param colorCone: An optional ColorRepresentation for the cone color.
81
+ :type colorCone: ColorRepresentation
82
+ :param colorFocalPlane: An optional ColorRepresentation for the focal plane color.
83
+ :type colorFocalPlane: ColorRepresentation
84
+ :param colorUp: An optional ColorRepresentation for the up color.
85
+ :type colorUp: ColorRepresentation
86
+ :param colorTarget: An optional ColorRepresentation for the target color.
87
+ :type colorTarget: ColorRepresentation
88
+ :param colorCross: An optional ColorRepresentation for the cross color.
89
+ :type colorCross: ColorRepresentation
90
+ """
91
+
42
92
  tag = "Frustum"
43
93
 
44
94
 
@@ -132,6 +182,9 @@ class PointCloud(SceneElement):
132
182
  self.colors = self.colors.flatten().tobytes()
133
183
 
134
184
 
185
+ p = PointCloud
186
+
187
+
135
188
  class Box(SceneElement):
136
189
  tag = "Box"
137
190
 
@@ -442,9 +495,7 @@ class DefaultScene(Scene):
442
495
  ):
443
496
  rawChildren = [
444
497
  AmbientLight(intensity=1.0, key="default_ambient_light"),
445
- DirectionalLight(
446
- intensity=1, key="default_directional_light", helper=show_helper
447
- ),
498
+ DirectionalLight(intensity=1, key="default_directional_light", helper=show_helper),
448
499
  *(rawChildren or []),
449
500
  ]
450
501
 
@@ -468,4 +519,4 @@ class DefaultScene(Scene):
468
519
  ],
469
520
  up=up,
470
521
  **kwargs,
471
- )
522
+ )
vuer/server.py CHANGED
@@ -27,7 +27,7 @@ from vuer.events import (
27
27
  Upsert,
28
28
  )
29
29
  from vuer.schemas import Page
30
- from vuer.types import EventHandler, Spawnable
30
+ from vuer.types import EventHandler, SocketHandler
31
31
 
32
32
 
33
33
  class At:
@@ -242,6 +242,22 @@ class Vuer(PrefixProto, Server):
242
242
 
243
243
  app.run()
244
244
 
245
+
246
+ .. automethod:: bind
247
+ .. automethod:: spawn
248
+ .. automethod:: relay
249
+ .. automethod:: bound_fn
250
+ .. automethod:: spawn_task
251
+ .. automethod:: get_url
252
+ .. automethod:: send
253
+ .. automethod:: rpc
254
+ .. automethod:: rpc_stream
255
+ .. automethod:: close_ws
256
+ .. automethod:: uplink
257
+ .. automethod:: downlink
258
+ .. automethod:: add_handler
259
+ .. automethod:: _ttl_handler
260
+ .. automethod:: run
245
261
  """
246
262
 
247
263
  name = "vuer"
@@ -279,7 +295,7 @@ class Vuer(PrefixProto, Server):
279
295
  self.page = Page()
280
296
 
281
297
  self.ws = {}
282
- self.spawned_fn: Spawnable = None
298
+ self.socket_handler: SocketHandler = None
283
299
  self.spawned_coroutines = []
284
300
 
285
301
  async def relay(self, request):
@@ -290,11 +306,11 @@ class Vuer(PrefixProto, Server):
290
306
 
291
307
  Interface:
292
308
  <uri>/relay?sid=<websocket_id>
309
+
293
310
  :return:
294
311
  - Status 200
295
312
  - Status 400
296
313
 
297
-
298
314
  """
299
315
  # todo: need to implement msgpack encoding, interface
300
316
  bytes = request.bytes()
@@ -350,20 +366,18 @@ class Vuer(PrefixProto, Server):
350
366
  loop = asyncio.get_running_loop()
351
367
  return loop.create_task(task)
352
368
 
353
- def spawn(self, fn: Spawnable = None, start=False):
369
+ def spawn(self, fn: SocketHandler = None, start=False):
354
370
  """
355
- Spawn a function as a task. This is useful in the following scenario:
356
-
357
- code::
358
371
 
372
+ Note: this is really a misnomer.
359
373
 
360
374
  :param fn: The function to spawn.
361
375
  :param start: Start server after binding
362
376
  :return: None
363
377
  """
364
378
 
365
- def wrap_fn(fn: Spawnable):
366
- self.spawned_fn = fn
379
+ def wrap_fn(fn: SocketHandler):
380
+ self.socket_handler = fn
367
381
  if start:
368
382
  self.run()
369
383
 
@@ -375,7 +389,7 @@ class Vuer(PrefixProto, Server):
375
389
 
376
390
  def bind(self, fn=None, start=False):
377
391
  """
378
- Bind a function to the Tassa. The function should be a generator that yields Page objects.
392
+ Bind an asynchronous generator function for use in socket connection handler. The function should be a generator that yields Page objects.
379
393
 
380
394
  :param fn: The function to bind.
381
395
  :return: None
@@ -515,8 +529,8 @@ class Vuer(PrefixProto, Server):
515
529
 
516
530
  self._add_task(self.uplink(vuer_proxy))
517
531
 
518
- if self.spawned_fn is not None:
519
- task = self._add_task(self.spawned_fn(vuer_proxy))
532
+ if self.socket_handler is not None:
533
+ task = self._add_task(self.socket_handler(vuer_proxy))
520
534
 
521
535
  if hasattr(generator, "__anext__"):
522
536
  serverEvent = await generator.__anext__()
vuer/types.py CHANGED
@@ -16,7 +16,7 @@ EventHandler = Callable[[ClientEvent, "VuerProxy"], None]
16
16
  """Defines a function that handles a client event. Second argument is the VuerProxy instance bound
17
17
  to a specific client connected through a websocket session."""
18
18
 
19
- Spawnable = Callable[["VuerProxy"], Coroutine]
19
+ SocketHandler = Callable[["VuerProxy"], Coroutine]
20
20
  """Defines a function that spawns a new entity. Argument is the VuerProxy instance."""
21
21
 
22
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vuer
3
- Version: 0.0.17
3
+ Version: 0.0.18
4
4
  Home-page: https://github.com/geyang/vuer
5
5
  Author: Ge Yang<ge.ike.yang@gmail.com>
6
6
  Author-email: ge.ike.yang@gmail.com
@@ -3,15 +3,15 @@ vuer/base.py,sha256=R-PtD39ouihiEGmSfJL26chlU0XkFJP-JmBNYzDdEvM,3068
3
3
  vuer/events.py,sha256=8AAzkfbm5jHkeMh17Z57n8YTxF4mheWC3Qbya4XkQSc,7291
4
4
  vuer/schemas.py,sha256=aZOocE02gO43SLLfeYSxxac0x38TmyTcfs_iFh5hsJ4,18152
5
5
  vuer/serdes.py,sha256=gD2iA9Yypu1QjocneOT3Nc0y6q_mdHn9zW1ko5j3I7c,2600
6
- vuer/server.py,sha256=L57AATVFQpCrTyt3_bINixvMarEx9RkiRZeI4cHA2wE,19508
7
- vuer/types.py,sha256=TjRtc2UfRHTDBL0gTr7GGA9bh8FqMMU5Rk1DnJSQoew,1275
6
+ vuer/server.py,sha256=OsXSq6iScFTG-yvAXWAik-EwNwEKdd1F84nUqBwyrjE,19955
7
+ vuer/types.py,sha256=N2KLa0fl6z8Jm6cJwZoD8Vqrins_AayG5BCGk1p3Eek,1279
8
8
  vuer/__pycache__/__init__.cpython-38.pyc,sha256=rS-9zzAjFEXnObk5q3E5Rex_uvoJ-Ccfz7Hs9DGNVgs,188
9
9
  vuer/__pycache__/base.cpython-38.pyc,sha256=Z5EFlRX9RqZsQUszvqPtAhLv_5QG5wlUXW7JbFd_XDc,3824
10
10
  vuer/__pycache__/events.cpython-38.pyc,sha256=zx3bXeJixqOyCFe2nA7qpq6jiCJ49kRaXO-xONGUyeQ,9616
11
11
  vuer/__pycache__/schemas.cpython-38.pyc,sha256=hvY9Aak8zE-zKcWiwuNe6DghOw9qH_zSe_FtkBOAPPk,23234
12
12
  vuer/__pycache__/serdes.cpython-38.pyc,sha256=KMxTjPEWuSGn2bqBAl5OLIDSCSoqfPDGfk3fvNnRDYA,2253
13
- vuer/__pycache__/server.cpython-38.pyc,sha256=1DKrzznGhC9ReG4UYlDED8GC-YKYOd-UhC5f_yD_BmA,18270
14
- vuer/__pycache__/types.cpython-38.pyc,sha256=OcUWJXEUF2K2w-pmEybOVKY7xJqjtr_N0UuyMIKzEG4,1815
13
+ vuer/__pycache__/server.cpython-38.pyc,sha256=kAsC8t-JgTOOccZMaXZMEqgTSV3C3T5Oyj1sl-QABM4,18696
14
+ vuer/__pycache__/types.cpython-38.pyc,sha256=IhlXtkT-XWM0V1420FDuoqIYnpvRvekYVkGqEK7fAV8,1819
15
15
  vuer/addons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  vuer/addons/nerf_vuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  vuer/addons/nerf_vuer/control_components.py,sha256=K4PU0nD572L4J7lLFfShWficWZQnH4t-x6WWMrAVw8g,290
@@ -22,16 +22,16 @@ vuer/addons/nerf_vuer/render_nodes.py,sha256=5TKqIbMPiOtBxfF4FQI6uB0w_9FTfGiwS8x
22
22
  vuer/addons/nerfuer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
23
  vuer/addons/nerfuer/render_nodes.py,sha256=EJK5N3xne5n7abTaAoLPX7SRqQ_tEen9zNypvSnZTTw,4465
24
24
  vuer/schemas/__init__.py,sha256=ZI6UyeLZXqJbHmp6LiE3Q3mHvt1zeV-SJmmcqq-wBZE,94
25
- vuer/schemas/drei_components.py,sha256=Y8c7Oey3IYkJxoSwaH7ry4MfwVfzW6MlSeb6muzVXec,6977
26
- vuer/schemas/html_components.py,sha256=tS_RxkuiAFMdFCJLL7xKaOganvRiYTqgb4j5At76yrY,5925
27
- vuer/schemas/scene_components.py,sha256=vK1ZvgNGf0u43TmGNtdKrRXHh7774lZu7retXBQLJOs,12338
25
+ vuer/schemas/drei_components.py,sha256=U9svEOnNprhZaobLagaFnqEtZxo5hiriSqjDnvQutoA,6989
26
+ vuer/schemas/html_components.py,sha256=NCqmSPic-ExPrXqNPXbKjtTXMB8sGBywIpE6cXpiy08,5926
27
+ vuer/schemas/scene_components.py,sha256=L9GbgFnrhxUYKi4EyexaAun7gmn6aHnCQIeSGSGwIRU,14913
28
28
  vuer/schemas/__pycache__/__init__.cpython-38.pyc,sha256=NRnVrpIDBKne93xOUY1-WpavCG7vwYiqU3VDTEEwuUE,221
29
- vuer/schemas/__pycache__/drei_components.cpython-38.pyc,sha256=gSH1mBOidXpib8V9d2PjRlwhLsbzNZdGR9BG1agIhuo,7700
30
- vuer/schemas/__pycache__/html_components.cpython-38.pyc,sha256=MzfeVcGa2fMgFh_g0qphppvXscmgL8egJQci2Y5dATw,8214
31
- vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=eN-zQIxYDeFsBiKuOeXPh2Q5z24IskdiCBacE_numJg,15548
32
- vuer-0.0.17.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
33
- vuer-0.0.17.dist-info/METADATA,sha256=zHj5jx1Y0W5nhwobQXXFLoT721bXzF4c1wUdy90P0Zo,4277
34
- vuer-0.0.17.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
- vuer-0.0.17.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
36
- vuer-0.0.17.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
37
- vuer-0.0.17.dist-info/RECORD,,
29
+ vuer/schemas/__pycache__/drei_components.cpython-38.pyc,sha256=g_ufcKxf-XKfZLdUV-HqKnjIrgxGWFv51aHLWQgH-ws,7712
30
+ vuer/schemas/__pycache__/html_components.cpython-38.pyc,sha256=q0DMFwNkYbnaH1A8w3BowMiQAlmGpFWOOKsjLVE6CIk,8215
31
+ vuer/schemas/__pycache__/scene_components.cpython-38.pyc,sha256=eRxB-Tp24yqBR4zbLMGX_4o1P_D-tW1nrDeBPSJKoU4,18135
32
+ vuer-0.0.18.dist-info/LICENSE,sha256=MGF-inVBUaGe2mEjqT0g6XsHIXwoNXgNHqD7Z1MzR0k,1063
33
+ vuer-0.0.18.dist-info/METADATA,sha256=cbpGK1fH2Wx_FmSLe_X9M59Dk0E_V-7v5FCS-KRfvx0,4277
34
+ vuer-0.0.18.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
35
+ vuer-0.0.18.dist-info/entry_points.txt,sha256=J_NM6fbpipmD9oP7cdxd1UyBR8mVEQVx0xjlE_56yss,41
36
+ vuer-0.0.18.dist-info/top_level.txt,sha256=ermmVkwvGFAK4gfSgDIwOmKpxwpqNt-oo7gVQQUSHok,5
37
+ vuer-0.0.18.dist-info/RECORD,,
File without changes
File without changes