whylogs.api.whylabs.session.session_types#

Module Contents#

Classes#

NotSupported

Indicates that one of the session apis isn't supported for the current session type.

InteractiveLogger

Logger for interactive environments.

SessionType

Generic enumeration.

ApiKeyV1

ApiKeyV2

Functions#

parse_api_key(→ ApiKey)

validate_org_id(→ None)

parse_api_key_v1(→ ApiKeyV1)

Parse the key id from an api key.

parse_api_key_v2(→ ApiKeyV2)

Parse the key id and the org id from an api key

Attributes#

class whylogs.api.whylabs.session.session_types.NotSupported#

Indicates that one of the session apis isn’t supported for the current session type.

whylogs.api.whylabs.session.session_types.LogFunction#
class whylogs.api.whylabs.session.session_types.InteractiveLogger#

Logger for interactive environments.

static init_notebook_logging() None#
Return type

None

static message(message: str = '', log_fn: Optional[LogFunction] = None, ignore_suppress: bool = False) None#

Log a message only if we’re in a notebook environment.

Parameters
  • message (str) – The message to log

  • log_fn (Optional[LogFunction]) – A function to log to instead of printing if we’re not in a notebook.

  • ignore_suppress (bool) – If true, will log even if WHYLOGS_SUPPRESS_LOG_OUTPUT is set. It still needs to be in a notebook though or it won’t show.

Return type

None

static option(message: str, ignore_suppress: bool = False) None#

Log an option line, which is anything that has multiple related lines in a row like multiple choices or a list things.

Parameters
  • message (str) –

  • ignore_suppress (bool) –

Return type

None

static inspect(message: str) None#

Log a message that the user is intended to interact with or inspect, like a url

Parameters

message (str) –

Return type

None

static question(message: str, ignore_suppress: bool = False) None#

Log a question.

Parameters
  • message (str) –

  • ignore_suppress (bool) –

Return type

None

static success(message: str, ignore_suppress: bool = False) None#

Log a success line, which has a green checkmark.

Parameters
  • message (str) –

  • ignore_suppress (bool) –

Return type

None

static failure(message: str, ignore_suppress: bool = False) None#

Log a failure, which has a red x.

Parameters
  • message (str) –

  • ignore_suppress (bool) –

Return type

None

static warning(message: str, log_fn: Optional[LogFunction] = None, ignore_suppress: bool = False) None#

Log a warning, which has a warning sign.

Parameters
  • message (str) –

  • log_fn (Optional[LogFunction]) –

  • ignore_suppress (bool) –

Return type

None

static warning_once(message: str, log_fn: Optional[LogFunction] = None, ignore_suppress: bool = False) None#

Like warning, but only logs once.

Parameters
  • message (str) –

  • log_fn (Optional[LogFunction]) –

  • ignore_suppress (bool) –

Return type

None

class whylogs.api.whylabs.session.session_types.SessionType#

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

WHYLABS_ANONYMOUS = 'whylabs_anonymous'#
WHYLABS = 'whylabs'#
LOCAL = 'local'#
name()#

The name of the Enum member.

value()#

The value of the Enum member.

class whylogs.api.whylabs.session.session_types.ApiKeyV1#
api_key_id: str#
full_key: str#
class whylogs.api.whylabs.session.session_types.ApiKeyV2#
api_key_id: str#
org_id: str#
full_key: str#
whylogs.api.whylabs.session.session_types.ApiKey#
whylogs.api.whylabs.session.session_types.parse_api_key(api_key: str) ApiKey#
Parameters

api_key (str) –

Return type

ApiKey

whylogs.api.whylabs.session.session_types.validate_org_id(org_id: str) None#
Parameters

org_id (str) –

Return type

None

whylogs.api.whylabs.session.session_types.parse_api_key_v1(api_key: str) ApiKeyV1#

Parse the key id from an api key. V1 api keys have the format key_id.key

Parameters

api_key (str) –

Return type

ApiKeyV1

whylogs.api.whylabs.session.session_types.parse_api_key_v2(api_key: str) ApiKeyV2#

Parse the key id and the org id from an api key V2 api keys have the format key_id.key:org_id

Parameters

api_key (str) –

Return type

ApiKeyV2