Skip to content

Commit 476dbb7

Browse files
committed
black, added message in list_activity_events
1 parent 3fd6844 commit 476dbb7

File tree

8 files changed

+32
-8
lines changed

8 files changed

+32
-8
lines changed

src/sempy_labs/_helper_functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,4 +1149,4 @@ def _get_max_run_id(lakehouse: str, table_name: str) -> int:
11491149

11501150
def make_list_unique(my_list):
11511151

1152-
return list(set(my_list))
1152+
return list(set(my_list))

src/sempy_labs/_icons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,4 +141,4 @@
141141
"URL": data_type_string,
142142
"RunId": data_type_long,
143143
"Timestamp": data_type_timestamp,
144-
}
144+
}

src/sempy_labs/_model_bpa.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,9 @@ def translate_using_spark(rule_file):
387387
dfExport.insert(5, colName, dfExport.pop(colName))
388388

389389
dfExport.columns = dfExport.columns.str.replace(" ", "_")
390-
schema = {key.replace(' ', '_'): value for key, value in icons.bpa_schema.items()}
390+
schema = {
391+
key.replace(" ", "_"): value for key, value in icons.bpa_schema.items()
392+
}
391393
save_as_delta_table(
392394
dataframe=dfExport,
393395
delta_table_name=delta_table_name,

src/sempy_labs/_model_bpa_bulk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ def run_model_bpa_bulk(
149149
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..."
150150
)
151151

152-
schema = {key.replace(' ', '_'): value for key, value in icons.bpa_schema.items()}
152+
schema = {
153+
key.replace(" ", "_"): value
154+
for key, value in icons.bpa_schema.items()
155+
}
153156

154157
save_as_delta_table(
155158
dataframe=df,

src/sempy_labs/admin/_basic_functions.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@
1111
import pandas as pd
1212
import time
1313
import urllib.parse
14+
from datetime import datetime
1415

1516

1617
def list_workspaces(
17-
top: Optional[int] = 5000, filter: Optional[str] = None, skip: Optional[int] = None,
18+
top: Optional[int] = 5000,
19+
filter: Optional[str] = None,
20+
skip: Optional[int] = None,
1821
) -> pd.DataFrame:
1922
"""
2023
Lists workspaces for the organization. This function is the admin version of list_workspaces.
@@ -939,6 +942,14 @@ def list_activity_events(
939942
A pandas dataframe showing a list of audit activity events for a tenant.
940943
"""
941944

945+
start_dt = datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S")
946+
end_dt = datetime.strptime(end_time, "%Y-%m-%dT%H:%M:%S")
947+
948+
if not start_dt.date() == end_dt.date():
949+
raise ValueError(
950+
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"
951+
)
952+
942953
df = pd.DataFrame(
943954
columns=[
944955
"Id",

src/sempy_labs/admin/_domains.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
def resolve_domain_id(domain_name: str) -> UUID:
1111
"""
12-
Obtains the domain Id for a given domain name.
12+
Obtains the domain Id for a given domain name.
1313
1414
Parameters
1515
----------

src/sempy_labs/lakehouse/_shortcuts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def delete_shortcut(
171171
"""
172172
Deletes a shortcut.
173173
174-
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`_.
174+
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`_.
175175
176176
Parameters
177177
----------

src/sempy_labs/report/_paginated.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ def get_report_datasources(
2727
"""
2828

2929
df = pd.DataFrame(
30-
columns=["Report Name", "Report Id", "Datasource Id", "Datasource Type", "Gateway Id", "Server", "Database"]
30+
columns=[
31+
"Report Name",
32+
"Report Id",
33+
"Datasource Id",
34+
"Datasource Type",
35+
"Gateway Id",
36+
"Server",
37+
"Database",
38+
]
3139
)
3240

3341
if workspace is None:

0 commit comments

Comments
 (0)