Skip to content

Commit e3bb89a

Browse files
[pre-commit.ci] Apply automatic pre-commit fixes
1 parent 29daa62 commit e3bb89a

7 files changed

Lines changed: 49 additions & 105 deletions

File tree

β€Ž.gitignoreβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ shell.nix
3333
build.nix
3434
.direnv
3535

36-
# ignore deploments
36+
# ignore deployments
3737
do-jupyterhub
3838
jupyterhub-aws
3939
gcp-jupyterhub

β€Žsrc/_nebari/deploy.pyβ€Ž

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ def deploy_configuration(
1717
disable_checks: bool = False,
1818
) -> Dict[str, Any]:
1919
if config.prevent_deploy:
20-
raise ValueError(
21-
textwrap.dedent(
22-
"""
20+
raise ValueError(textwrap.dedent("""
2321
Deployment prevented due to the prevent_deploy setting in your nebari-config.yaml file.
2422
You could remove that field to deploy your Nebari, but please do NOT do so without fully understanding why that value was set in the first place.
2523
@@ -29,9 +27,7 @@ def deploy_configuration(
2927
3028
PLEASE get in touch with Nebari development team at https://github.com/nebari-dev/nebari for assistance in proceeding.
3129
Your data may be at risk without our guidance.
32-
"""
33-
)
34-
)
30+
"""))
3531

3632
if config.domain is None:
3733
logger.info(

β€Žsrc/_nebari/provider/cicd/linter.pyβ€Ž

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ def generate_lint_message(config):
3636
# lint/validate nebari-config.yaml
3737
all_pass, messages, validate_code = nebari_validate(config)
3838

39-
pass_lint = textwrap.dedent(
40-
"""
39+
pass_lint = textwrap.dedent("""
4140
This is an automatic response from the Nebari linter.
4241
I just wanted to let you know that I linted your `nebari-config.yaml` in your PR and I didn't find any
4342
problems.
44-
"""
45-
)
43+
""")
4644

4745
# it should be better to parse this messages first
4846
bad_lint = (
@@ -56,12 +54,10 @@ def generate_lint_message(config):
5654

5755
if not pr_config:
5856
status = "no configuration file"
59-
message = textwrap.dedent(
60-
"""
57+
message = textwrap.dedent("""
6158
This is an automatic response from the Nebari linter.
6259
I was trying to look for the `nebari-config.yaml` file to lint for you, but couldn't find any...
63-
"""
64-
)
60+
""")
6561

6662
elif all_pass:
6763
status = "Success"

β€Žsrc/_nebari/upgrade.pyβ€Ž

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,8 +1331,7 @@ def _version_specific_upgrade(
13311331
provider_full_name = provider_enum_name_map[provider]
13321332
if not config.get(provider_full_name, {}).get("node_groups", {}):
13331333
try:
1334-
text = textwrap.dedent(
1335-
f"""
1334+
text = textwrap.dedent(f"""
13361335
The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%.
13371336
This change will affect your current deployment, and will result in ~15 minutes of downtime during the upgrade step as the node groups are switched out, but shouldn't result in data loss.
13381337
@@ -1343,8 +1342,7 @@ def _version_specific_upgrade(
13431342
13441343
Would you like to upgrade to the cost effective node groups [purple]{config_filename}[/purple]?
13451344
If not, select "N" and the old default node groups will be added to the nebari config file.
1346-
"""
1347-
)
1345+
""")
13481346
continue_ = kwargs.get("attempt_fixes", False) or Confirm.ask(
13491347
text,
13501348
default=True,
@@ -1370,8 +1368,7 @@ def _version_specific_upgrade(
13701368
except KeyError:
13711369
pass
13721370
else:
1373-
text = textwrap.dedent(
1374-
"""
1371+
text = textwrap.dedent("""
13751372
The default node groups for GCP have been changed to cost efficient e2 family nodes reducing the running cost of Nebari on GCP by ~50%.
13761373
Consider upgrading your node group instance types to the new default configuration.
13771374
@@ -1380,8 +1377,7 @@ def _version_specific_upgrade(
13801377
As always, make sure to backup data before upgrading. See https://www.nebari.dev/docs/how-tos/manual-backup for more information.
13811378
13821379
The new default node groups instances are:
1383-
"""
1384-
)
1380+
""")
13851381
text += json.dumps(
13861382
{
13871383
"general": {"instance": "e2-highmem-4"},
@@ -1467,8 +1463,7 @@ def _version_specific_upgrade(
14671463

14681464
rich.print("\n ⚠️ Upgrade Warning ⚠️")
14691465

1470-
text = textwrap.dedent(
1471-
"""
1466+
text = textwrap.dedent("""
14721467
Please ensure no users are currently logged in prior to deploying this
14731468
update.
14741469
@@ -1489,8 +1484,7 @@ def _version_specific_upgrade(
14891484
mounted.
14901485
14911486
For more details check our [green][link=https://www.nebari.dev/docs/references/release/]release notes[/link][/green].
1492-
"""
1493-
)
1487+
""")
14941488
rich.print(text)
14951489
keycloak_admin = None
14961490

@@ -1522,15 +1516,11 @@ def _version_specific_upgrade(
15221516
)
15231517
except ValueError as e:
15241518
if "invalid_grant" in str(e):
1525-
rich.print(
1526-
textwrap.dedent(
1527-
"""
1519+
rich.print(textwrap.dedent("""
15281520
[red bold]Failed to connect to the Keycloak server.[/red bold]\n
15291521
[yellow]Please set the [bold]KEYCLOAK_ADMIN_USERNAME[/bold] and [bold]KEYCLOAK_ADMIN_PASSWORD[/bold]
15301522
environment variables with the Keycloak root credentials and try again.[/yellow]
1531-
"""
1532-
)
1533-
)
1523+
"""))
15341524
exit()
15351525
else:
15361526
# Handle other exceptions
@@ -1633,8 +1623,7 @@ def _version_specific_upgrade(
16331623
):
16341624
rich.print("\n ⚠️ Upgrade Warning ⚠️")
16351625

1636-
text = textwrap.dedent(
1637-
"""
1626+
text = textwrap.dedent("""
16381627
In this release, we have updated our maximum supported Kubernetes version from 1.29 to 1.31.
16391628
Please note that Nebari will NOT automatically upgrade your running Kubernetes version as part of
16401629
the redeployment process.
@@ -1645,8 +1634,7 @@ def _version_specific_upgrade(
16451634
16461635
For more information on upgrading Kubernetes for your specific cloud provider, please visit:
16471636
https://www.nebari.dev/docs/how-tos/kubernetes-version-upgrade
1648-
"""
1649-
)
1637+
""")
16501638
rich.print(text)
16511639

16521640
# If the Nebari provider is Azure, we must handle a major version upgrade
@@ -1657,9 +1645,7 @@ def _version_specific_upgrade(
16571645

16581646
if config.get("provider", "") == "azure":
16591647
rich.print("\n ⚠️ Azure Provider Upgrade Notice ⚠️")
1660-
rich.print(
1661-
textwrap.dedent(
1662-
"""
1648+
rich.print(textwrap.dedent("""
16631649
In this Nebari release, the Azure Terraform provider has been upgraded
16641650
from version 3.97.1 to 4.7.0. This major update includes internal schema
16651651
changes for certain resources, most notably the `azurerm_storage_account`.
@@ -1670,9 +1656,7 @@ def _version_specific_upgrade(
16701656
16711657
For detailed information on the Azure provider 4.x changes, please visit:
16721658
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide
1673-
"""
1674-
)
1675-
)
1659+
"""))
16761660

16771661
# Prompt user for confirmation
16781662
continue_ = kwargs.get("attempt_fixes", False) or Confirm.ask(
@@ -1753,8 +1737,7 @@ def _version_specific_upgrade(
17531737
]:
17541738
rich.print("\n ⚠️ Node Taints Update ⚠️")
17551739

1756-
text = textwrap.dedent(
1757-
"""
1740+
text = textwrap.dedent("""
17581741
Starting with Nebari version 2025.4.1, node taints will be automatically applied to all non-general node groups by default.
17591742
Node taints help ensure that specific workloads run only on designated nodes,
17601743
improving resource utilization and isolation. This change will include:
@@ -1764,8 +1747,7 @@ def _version_specific_upgrade(
17641747
17651748
If you prefer not to use node taints, you can opt out by adding `taints: []`
17661749
to each node group definition in your nebari-config.yaml file.
1767-
"""
1768-
)
1750+
""")
17691751
rich.print(text)
17701752

17711753
provider_full_name = provider_enum_name_map.get(provider)
@@ -2074,9 +2056,7 @@ def _version_specific_upgrade(
20742056
namespace = config.get("namespace", "dev")
20752057

20762058
rich.print("\n ⚠️ CRITICAL UPGRADE WARNING ⚠️")
2077-
rich.print(
2078-
textwrap.dedent(
2079-
f"""
2059+
rich.print(textwrap.dedent(f"""
20802060
This version includes a major [bold red]Keycloak upgrade[/bold red] from the [green]keycloak[/green] chart (15.0.2)
20812061
to the [green]keycloakx[/green] chart (7.1.3). This upgrade changes the underlying architecture
20822062
from JBoss/WildFly to Quarkus.
@@ -2092,9 +2072,7 @@ def _version_specific_upgrade(
20922072
20932073
After this upgrade step completes, you will need to run:
20942074
[cyan]nebari deploy -c {config_filename}[/cyan] to apply the changes
2095-
"""
2096-
)
2097-
)
2075+
"""))
20982076
# Get all available contexts
20992077
contexts, active_context = kubernetes.config.list_kube_config_contexts()
21002078

β€Žtests/tests_unit/test_cli_keycloak.pyβ€Ž

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,15 @@ def parse_yaml(stdout_str: str, headers: list):
124124

125125

126126
def test_parse_table():
127-
table_str = dedent(
128-
""" Keycloak Users (Count: 3)
127+
table_str = dedent(""" Keycloak Users (Count: 3)
129128
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓
130129
┃ Username ┃ Email ┃ Groups ┃
131130
┑━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩
132131
β”‚ test-dev β”‚ test-dev@example.com β”‚ ['analyst', 'developer'] β”‚
133132
β”‚ test-admin β”‚ test-admin@example.com β”‚ ['admin'] β”‚
134133
β”‚ test-nogroup β”‚ test-nogroup@example.com β”‚ [] β”‚
135134
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
136-
"""
137-
)
135+
""")
138136
expected = [
139137
{
140138
"username": "test-dev",
@@ -160,14 +158,12 @@ def test_parse_table():
160158

161159

162160
def test_parse_yaml():
163-
yaml_str = dedent(
164-
"""
161+
yaml_str = dedent("""
165162
- name: test
166163
roles:
167164
- allow-test-to-pass
168165
- other-role
169-
"""
170-
)
166+
""")
171167
expected = [
172168
{
173169
"name": "test",

0 commit comments

Comments
Β (0)