Skip to content

Commit

Permalink
black, added message in list_activity_events
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kovalsky committed Oct 23, 2024
1 parent 3fd6844 commit 476dbb7
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sempy_labs/_helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,4 +1149,4 @@ def _get_max_run_id(lakehouse: str, table_name: str) -> int:

def make_list_unique(my_list):

return list(set(my_list))
return list(set(my_list))
2 changes: 1 addition & 1 deletion src/sempy_labs/_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,4 +141,4 @@
"URL": data_type_string,
"RunId": data_type_long,
"Timestamp": data_type_timestamp,
}
}
4 changes: 3 additions & 1 deletion src/sempy_labs/_model_bpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,9 @@ def translate_using_spark(rule_file):
dfExport.insert(5, colName, dfExport.pop(colName))

dfExport.columns = dfExport.columns.str.replace(" ", "_")
schema = {key.replace(' ', '_'): value for key, value in icons.bpa_schema.items()}
schema = {
key.replace(" ", "_"): value for key, value in icons.bpa_schema.items()
}
save_as_delta_table(
dataframe=dfExport,
delta_table_name=delta_table_name,
Expand Down
5 changes: 4 additions & 1 deletion src/sempy_labs/_model_bpa_bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,10 @@ def run_model_bpa_bulk(
f"{icons.in_progress} Saving the Model BPA results of the '{wksp}' workspace to the '{output_table}' within the '{lakehouse}' lakehouse within the '{lakehouse_workspace}' workspace..."
)

schema = {key.replace(' ', '_'): value for key, value in icons.bpa_schema.items()}
schema = {
key.replace(" ", "_"): value
for key, value in icons.bpa_schema.items()
}

save_as_delta_table(
dataframe=df,
Expand Down
13 changes: 12 additions & 1 deletion src/sempy_labs/admin/_basic_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
import pandas as pd
import time
import urllib.parse
from datetime import datetime


def list_workspaces(
top: Optional[int] = 5000, filter: Optional[str] = None, skip: Optional[int] = None,
top: Optional[int] = 5000,
filter: Optional[str] = None,
skip: Optional[int] = None,
) -> pd.DataFrame:
"""
Lists workspaces for the organization. This function is the admin version of list_workspaces.
Expand Down Expand Up @@ -939,6 +942,14 @@ def list_activity_events(
A pandas dataframe showing a list of audit activity events for a tenant.
"""

start_dt = datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S")
end_dt = datetime.strptime(end_time, "%Y-%m-%dT%H:%M:%S")

if not start_dt.date() == end_dt.date():
raise ValueError(
f"{icons.red_dot} Start and End Times must be within the same UTC day. Please refer to the documentation here: https://learn.microsoft.com/rest/api/power-bi/admin/get-activity-events#get-audit-activity-events-within-a-time-window-and-for-a-specific-activity-type-and-user-id-example"
)

df = pd.DataFrame(
columns=[
"Id",
Expand Down
2 changes: 1 addition & 1 deletion src/sempy_labs/admin/_domains.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def resolve_domain_id(domain_name: str) -> UUID:
"""
Obtains the domain Id for a given domain name.
Obtains the domain Id for a given domain name.
Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion src/sempy_labs/lakehouse/_shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def delete_shortcut(
"""
Deletes a shortcut.
This is a wrapper function for the following API: `OneLake Shortcuts - Delete Shortcut <https://learn.microsoft.com/rest/api/fabric/core/onelake-shortcuts/delete-shortcut`_.
This is a wrapper function for the following API: `OneLake Shortcuts - Delete Shortcut <https://learn.microsoft.com/rest/api/fabric/core/onelake-shortcuts/delete-shortcut`_.
Parameters
----------
Expand Down
10 changes: 9 additions & 1 deletion src/sempy_labs/report/_paginated.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,15 @@ def get_report_datasources(
"""

df = pd.DataFrame(
columns=["Report Name", "Report Id", "Datasource Id", "Datasource Type", "Gateway Id", "Server", "Database"]
columns=[
"Report Name",
"Report Id",
"Datasource Id",
"Datasource Type",
"Gateway Id",
"Server",
"Database",
]
)

if workspace is None:
Expand Down

0 comments on commit 476dbb7

Please sign in to comment.