MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / replace_binary_path

Function replace_binary_path

web/pgadmin/utils/__init__.py:443–461  ·  view source on GitHub ↗

This function is used to check if $DIR is present in the binary path. If it is there then replace it with module.

(binary_path)

Source from the content-addressed store, hash-verified

441
442
443def replace_binary_path(binary_path):
444 """
445 This function is used to check if $DIR is present in
446 the binary path. If it is there then replace it with
447 module.
448 """
449 if "$DIR" in binary_path:
450 # When running as an WSGI application, we will not find the
451 # '__file__' attribute for the '__main__' module.
452 main_module_file = getattr(
453 sys.modules['__main__'], '__file__', None
454 )
455
456 if main_module_file is not None:
457 binary_path = binary_path.replace(
458 "$DIR", os.path.dirname(main_module_file)
459 )
460
461 return binary_path
462
463
464def add_value(attr_dict, key, value):

Callers 2

utilityMethod · 0.90
get_binary_path_versionsFunction · 0.85

Calls 1

dirnameMethod · 0.80

Tested by

no test coverage detected