Skip to content

Commit

Permalink
new format lint
Browse files Browse the repository at this point in the history
  • Loading branch information
rfl-urbaniak committed Sep 9, 2024
1 parent c958a71 commit 6e2a361
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 31 deletions.
2 changes: 1 addition & 1 deletion cities/modeling/model_interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from typing import Optional

import dill
import pyro
import pyro.distributions as dist
import torch

import pyro
from cities.modeling.modeling_utils import (
prep_wide_data_for_inference,
train_interactions_model,
Expand Down
2 changes: 1 addition & 1 deletion cities/modeling/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import matplotlib.pyplot as plt
import pandas as pd
import pyro
import torch
from pyro.infer import SVI, Trace_ELBO
from pyro.infer.autoguide import AutoNormal
from pyro.optim import Adam # type: ignore
from scipy.stats import spearmanr

import pyro
from cities.utils.data_grabber import (
DataGrabber,
list_available_features,
Expand Down
5 changes: 3 additions & 2 deletions cities/queries/causal_insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import pyro
import torch
from sklearn.preprocessing import StandardScaler

import pyro
from cities.modeling.model_interactions import model_cities_interaction
from cities.modeling.modeling_utils import prep_wide_data_for_inference
from cities.utils.cleaning_utils import (
Expand Down Expand Up @@ -576,7 +576,8 @@ def estimate_ATE(self):
label=f"mean = {tau_samples.mean():.3f}",
)
plt.title(
f"ATE for {self.intervention_dataset} and {self.outcome_dataset} with forward shift = {self.forward_shift}"
f"ATE for {self.intervention_dataset} and {self.outcome_dataset} "
f"with forward shift = {self.forward_shift}"
)
plt.ylabel("counts")
plt.xlabel("ATE")
Expand Down
22 changes: 4 additions & 18 deletions scripts/clean.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
#!/bin/bash
set -euxo pipefail

# isort suspended as conflicting with black
# nbqa isort docs/guides/


# this sometimes conflicts with black but does some
# preliminary import sorting
# and is then overriden by black
isort cities/ tests/

black ./cities/ ./tests/ ./docs/guides/

black docs/guides/

isort --profile="black" cities/ tests/
autoflake --remove-all-unused-imports --in-place --recursive ./cities ./tests

nbqa autoflake --nbqa-shell --remove-all-unused-imports --recursive --in-place docs/guides/

#nbqa black docs/guides/

nbqa --nbqa-shell isort --profile="black" docs/guides/
nbqa --nbqa-shell autoflake --nbqa-shell --remove-all-unused-imports --recursive --in-place docs/guides/
black ./cities ./tests docs/guides/
14 changes: 5 additions & 9 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
#!/bin/bash
set -euxo pipefail

mypy --ignore-missing-imports cities/
#isort --check --diff cities/ tests/
black --check cities/ tests/
flake8 cities/ tests/ --ignore=E203,W503 --max-line-length=127


nbqa autoflake -v --recursive --check docs/guides/
#nbqa isort --check docs/guides/
nbqa black --check docs/guides/
mypy --ignore-missing-imports cities/ tests/
isort --check --profile="black" --diff cities/ tests/
black --check cities/ tests/ docs/guides/
flake8 cities/ tests/
nbqa --nbqa-shell autoflake --nbqa-shell --recursive --check docs/guides/

0 comments on commit 6e2a361

Please sign in to comment.