def diagnostics(local_data="."): st.header("Streamlit instance info") st.subheader("Locally-installed libraries") try: import PyOpenColorIO as ocio st.write(f"PyOpenColorIO v{ocio.__version__}") except ImportError: pass try: import OpenImageIO as oiio st.write(f"OpenImageIO v{oiio.__version__}") except: pass st.subheader("`colour-science` library info") with st_stdout("code"): colour.utilities.describe_environment() st.subheader("System") st.write(get_profile()) st.subheader("Local contents") with st_stdout("code"): print(str(local_data)) fs.open_fs(str(local_data)).tree() st.subheader("Python system paths") st.write(sys.path)
def maybe_print_debug_info(meta: "GitMeta") -> None: if not os.getenv("SEMGREP_AGENT_DEBUG"): return debug_echo("\n== ecosystem profile:") debug_echo(json.dumps(ecoutils.get_profile(), indent=2, sort_keys=True)) debug_echo("\n== meta info:") debug_echo(json.dumps(meta.to_dict(), indent=2, sort_keys=True))
def system_profile(anonymize=False, as_dict=False): '''Return a summary of this system. The default output format is a string that is more or less human readable. If the value of parameter "as_dict" is True, the output is a Python dict. If the value of parameter "anonymize" is True, the results will have values of '-' for certain identifiable information. This includes current working directory, hostname, Python executable path, command-line arguments, and username. The output of this function is identical to that of "get_profile" from the Boltons ecoutils module, reformatted and returned as a string that can be printed for human consumption. ''' details = ecoutils.get_profile(scrub=anonymize) return details if as_dict else yaml.dump(details)
import logging import sys from operator import methodcaller from pathlib import Path from boltons.ecoutils import get_profile from boltons.iterutils import unique # Canonical name of the CLI. CLI_NAME = "mdedup" __version__ = "6.0.3" # Environment data. env_data = get_profile(scrub=True) # Initialize global logger. logger = logging.getLogger(CLI_NAME) # Ordered list of headers to use by default to compute the hash of a mail. HASH_HEADERS = ( "Date", "From", "To", # No Cc since mailman apparently sometimes trims list members from the Cc # header to avoid sending duplicates: https://mail.python.org/pipermail # /mailman-developers/2002-September/013233.html . But this means that # copies of mail reflected back from the list server will have a different # Cc to the copy saved by the MUA at send-time. # 'Cc',
def test_basic(): # basic sanity test prof = ecoutils.get_profile() assert prof['python']['bin'] == sys.executable
def test_scrub(): prof = ecoutils.get_profile(scrub=True) assert prof['username'] == '-'