Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
reinout committed Jan 5, 2024
1 parent 402d28f commit f17ce1b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
18 changes: 11 additions & 7 deletions serverscripts/geoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,9 @@ def extract_datastore_info(datastore_file):
connection, "./entry[@key='database']"
)
result["database_user"] = get_text_or_none(connection, "./entry[@key='user']")
jndi_connection = get_text_or_none(connection, "./entry[@key='jndiReferenceName']")
jndi_connection = get_text_or_none(
connection, "./entry[@key='jndiReferenceName']"
)
if jndi_connection:
result["database_name"] = jndi_connection

Expand Down Expand Up @@ -196,11 +198,11 @@ def extract_from_dirs(data_dir):
for workspace_datastore_file in workspace_datastore_files
]
for key in [
"enabled",
"type",
"database_server",
"database_user",
"database_name",
"enabled",
"type",
"database_server",
"database_user",
"database_name",
]:
workspace[key] = _combine_with_comma(datastores, key)
result[workspace_name] = workspace
Expand Down Expand Up @@ -238,7 +240,9 @@ def extract_workspaces_info(geoserver_configuration):
if found_workspace_name != workspace_name:
continue
referers.update({referer: count})
common_referers = ["%s (%d)" % (referer, count) for (referer, count) in referers.most_common(5)]
common_referers = [
"%s (%d)" % (referer, count) for (referer, count) in referers.most_common(5)
]
workspaces[workspace_name] = {
"usage": workspace_count,
"referers": " + ".join(common_referers),
Expand Down
8 changes: 5 additions & 3 deletions serverscripts/tests/test_geoserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ def test_config_file():


def test_extract_from_logfiles():
lines = list(geoserver.extract_from_logfiles(
os.path.join(OUR_DIR, "example_geoserver_logs/access.log")
))
lines = list(
geoserver.extract_from_logfiles(
os.path.join(OUR_DIR, "example_geoserver_logs/access.log")
)
)
assert len(lines) == 439
# ^^^ this used to be 210, but now I'm also looking at LAYERS= instead of
# only layers= in the query parameters...
Expand Down

0 comments on commit f17ce1b

Please sign in to comment.