MCPcopy
hub / github.com/plotly/dash / _get_worker_url

Method _get_worker_url

dash/dash.py:1066–1091  ·  view source on GitHub ↗

Get the URL for the WebSocket worker script. Returns: The fingerprinted URL for the worker script served via component suites.

(self)

Source from the content-addressed store, hash-verified

1064 return self.backend.make_response("OK", status=200, mimetype="text/plain")
1065
1066 def _get_worker_url(self) -> str:
1067 """Get the URL for the WebSocket worker script.
1068
1069 Returns:
1070 The fingerprinted URL for the worker script served via component suites.
1071 """
1072 relative_path = "dash-renderer/build/dash-ws-worker.js"
1073 namespace = "dash"
1074
1075 # Register the path so it can be served
1076 self.registered_paths[namespace].add(relative_path)
1077
1078 # Build fingerprinted URL (same pattern as _collect_and_register_resources)
1079 module_path = os.path.join(
1080 os.path.dirname(sys.modules[namespace].__file__), # type: ignore
1081 relative_path,
1082 )
1083
1084 # Use a fallback if the file doesn't exist yet (during development)
1085 try:
1086 modified = int(os.stat(module_path).st_mtime)
1087 except FileNotFoundError:
1088 modified = 0
1089
1090 fingerprint = build_fingerprint(relative_path, __version__, modified)
1091 return f"{self.config.requests_pathname_prefix}_dash-component-suites/{namespace}/{fingerprint}"
1092
1093 def get_dist(self, libraries: Sequence[str]) -> list:
1094 dists = []

Callers 1

_configMethod · 0.95

Calls 2

build_fingerprintFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected